Merge lp:~ubuntu-branches/ubuntu/natty/gtksourceview3/natty-201104070312 into lp:ubuntu/natty/gtksourceview3
- Natty (11.04)
- natty-201104070312
- Merge into natty
Proposed by
James Westby
Status: | Merged |
---|---|
Merged at revision: | 11 |
Proposed branch: | lp:~ubuntu-branches/ubuntu/natty/gtksourceview3/natty-201104070312 |
Merge into: | lp:ubuntu/natty/gtksourceview3 |
Diff against target: |
8759 lines (+8748/-0) (has conflicts) 1 file modified
.pc/99_ltmain_as-needed.patch/ltmain.sh (+8748/-0) Text conflict in .pc/99_ltmain_as-needed.patch/ltmain.sh |
To merge this branch: | bzr merge lp:~ubuntu-branches/ubuntu/natty/gtksourceview3/natty-201104070312 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ubuntu Development Team | Pending | ||
Review via email: mp+56681@code.launchpad.net |
Commit message
Description of the change
The package history in the archive and the history in the bzr branch differ. As the archive is authoritative the history of lp:ubuntu/natty/gtksourceview3 now reflects that and the old bzr branch has been pushed to lp:~ubuntu-branches/ubuntu/natty/gtksourceview3/natty-201104070312. A merge should be performed if necessary.
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file '.pc/99_ltmain_as-needed.patch/ltmain.sh' |
2 | --- .pc/99_ltmain_as-needed.patch/ltmain.sh 2011-04-06 17:25:57 +0000 |
3 | +++ .pc/99_ltmain_as-needed.patch/ltmain.sh 2011-04-07 03:16:31 +0000 |
4 | @@ -1,3 +1,4 @@ |
5 | +<<<<<<< TREE |
6 | |
7 | # libtool (GNU libtool) 2.4 |
8 | # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 |
9 | @@ -9634,3 +9635,8750 @@ |
10 | # End: |
11 | # vi:sw=2 |
12 | |
13 | +======= |
14 | +# Generated from ltmain.m4sh. |
15 | + |
16 | +# libtool (GNU libtool) 2.2.10 |
17 | +# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 |
18 | + |
19 | +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, |
20 | +# 2007, 2008, 2009, 2010 Free Software Foundation, Inc. |
21 | +# This is free software; see the source for copying conditions. There is NO |
22 | +# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
23 | + |
24 | +# GNU Libtool is free software; you can redistribute it and/or modify |
25 | +# it under the terms of the GNU General Public License as published by |
26 | +# the Free Software Foundation; either version 2 of the License, or |
27 | +# (at your option) any later version. |
28 | +# |
29 | +# As a special exception to the GNU General Public License, |
30 | +# if you distribute this file as part of a program or library that |
31 | +# is built using GNU Libtool, you may include this file under the |
32 | +# same distribution terms that you use for the rest of that program. |
33 | +# |
34 | +# GNU Libtool is distributed in the hope that it will be useful, but |
35 | +# WITHOUT ANY WARRANTY; without even the implied warranty of |
36 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
37 | +# General Public License for more details. |
38 | +# |
39 | +# You should have received a copy of the GNU General Public License |
40 | +# along with GNU Libtool; see the file COPYING. If not, a copy |
41 | +# can be downloaded from http://www.gnu.org/licenses/gpl.html, |
42 | +# or obtained by writing to the Free Software Foundation, Inc., |
43 | +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
44 | + |
45 | +# Usage: $progname [OPTION]... [MODE-ARG]... |
46 | +# |
47 | +# Provide generalized library-building support services. |
48 | +# |
49 | +# --config show all configuration variables |
50 | +# --debug enable verbose shell tracing |
51 | +# -n, --dry-run display commands without modifying any files |
52 | +# --features display basic configuration information and exit |
53 | +# --mode=MODE use operation mode MODE |
54 | +# --preserve-dup-deps don't remove duplicate dependency libraries |
55 | +# --quiet, --silent don't print informational messages |
56 | +# --no-quiet, --no-silent |
57 | +# print informational messages (default) |
58 | +# --tag=TAG use configuration variables from tag TAG |
59 | +# -v, --verbose print more informational messages than default |
60 | +# --no-verbose don't print the extra informational messages |
61 | +# --version print version information |
62 | +# -h, --help, --help-all print short, long, or detailed help message |
63 | +# |
64 | +# MODE must be one of the following: |
65 | +# |
66 | +# clean remove files from the build directory |
67 | +# compile compile a source file into a libtool object |
68 | +# execute automatically set library path, then run a program |
69 | +# finish complete the installation of libtool libraries |
70 | +# install install libraries or executables |
71 | +# link create a library or an executable |
72 | +# uninstall remove libraries from an installed directory |
73 | +# |
74 | +# MODE-ARGS vary depending on the MODE. When passed as first option, |
75 | +# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that. |
76 | +# Try `$progname --help --mode=MODE' for a more detailed description of MODE. |
77 | +# |
78 | +# When reporting a bug, please describe a test case to reproduce it and |
79 | +# include the following information: |
80 | +# |
81 | +# host-triplet: $host |
82 | +# shell: $SHELL |
83 | +# compiler: $LTCC |
84 | +# compiler flags: $LTCFLAGS |
85 | +# linker: $LD (gnu? $with_gnu_ld) |
86 | +# $progname: (GNU libtool) 2.2.10 |
87 | +# automake: $automake_version |
88 | +# autoconf: $autoconf_version |
89 | +# |
90 | +# Report bugs to <bug-libtool@gnu.org>. |
91 | + |
92 | +PROGRAM=libtool |
93 | +PACKAGE=libtool |
94 | +VERSION=2.2.10 |
95 | +TIMESTAMP="" |
96 | +package_revision=1.3175 |
97 | + |
98 | +# Be Bourne compatible |
99 | +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then |
100 | + emulate sh |
101 | + NULLCMD=: |
102 | + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which |
103 | + # is contrary to our usage. Disable this feature. |
104 | + alias -g '${1+"$@"}'='"$@"' |
105 | + setopt NO_GLOB_SUBST |
106 | +else |
107 | + case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac |
108 | +fi |
109 | +BIN_SH=xpg4; export BIN_SH # for Tru64 |
110 | +DUALCASE=1; export DUALCASE # for MKS sh |
111 | + |
112 | +# A function that is used when there is no print builtin or printf. |
113 | +func_fallback_echo () |
114 | +{ |
115 | + eval 'cat <<_LTECHO_EOF |
116 | +$1 |
117 | +_LTECHO_EOF' |
118 | +} |
119 | + |
120 | +# NLS nuisances: We save the old values to restore during execute mode. |
121 | +lt_user_locale= |
122 | +lt_safe_locale= |
123 | +for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES |
124 | +do |
125 | + eval "if test \"\${$lt_var+set}\" = set; then |
126 | + save_$lt_var=\$$lt_var |
127 | + $lt_var=C |
128 | + export $lt_var |
129 | + lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" |
130 | + lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" |
131 | + fi" |
132 | +done |
133 | +LC_ALL=C |
134 | +LANGUAGE=C |
135 | +export LANGUAGE LC_ALL |
136 | + |
137 | +$lt_unset CDPATH |
138 | + |
139 | + |
140 | +# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh |
141 | +# is ksh but when the shell is invoked as "sh" and the current value of |
142 | +# the _XPG environment variable is not equal to 1 (one), the special |
143 | +# positional parameter $0, within a function call, is the name of the |
144 | +# function. |
145 | +progpath="$0" |
146 | + |
147 | + |
148 | + |
149 | +: ${CP="cp -f"} |
150 | +test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'} |
151 | +: ${EGREP="/bin/grep -E"} |
152 | +: ${FGREP="/bin/grep -F"} |
153 | +: ${GREP="/bin/grep"} |
154 | +: ${LN_S="ln -s"} |
155 | +: ${MAKE="make"} |
156 | +: ${MKDIR="mkdir"} |
157 | +: ${MV="mv -f"} |
158 | +: ${RM="rm -f"} |
159 | +: ${SED="/bin/sed"} |
160 | +: ${SHELL="${CONFIG_SHELL-/bin/sh}"} |
161 | +: ${Xsed="$SED -e 1s/^X//"} |
162 | + |
163 | +# Global variables: |
164 | +EXIT_SUCCESS=0 |
165 | +EXIT_FAILURE=1 |
166 | +EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. |
167 | +EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. |
168 | + |
169 | +exit_status=$EXIT_SUCCESS |
170 | + |
171 | +# Make sure IFS has a sensible default |
172 | +lt_nl=' |
173 | +' |
174 | +IFS=" $lt_nl" |
175 | + |
176 | +dirname="s,/[^/]*$,," |
177 | +basename="s,^.*/,," |
178 | + |
179 | +# func_dirname_and_basename file append nondir_replacement |
180 | +# perform func_basename and func_dirname in a single function |
181 | +# call: |
182 | +# dirname: Compute the dirname of FILE. If nonempty, |
183 | +# add APPEND to the result, otherwise set result |
184 | +# to NONDIR_REPLACEMENT. |
185 | +# value returned in "$func_dirname_result" |
186 | +# basename: Compute filename of FILE. |
187 | +# value retuned in "$func_basename_result" |
188 | +# Implementation must be kept synchronized with func_dirname |
189 | +# and func_basename. For efficiency, we do not delegate to |
190 | +# those functions but instead duplicate the functionality here. |
191 | +func_dirname_and_basename () |
192 | +{ |
193 | + # Extract subdirectory from the argument. |
194 | + func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"` |
195 | + if test "X$func_dirname_result" = "X${1}"; then |
196 | + func_dirname_result="${3}" |
197 | + else |
198 | + func_dirname_result="$func_dirname_result${2}" |
199 | + fi |
200 | + func_basename_result=`$ECHO "${1}" | $SED -e "$basename"` |
201 | +} |
202 | + |
203 | +# Generated shell functions inserted here. |
204 | + |
205 | +# These SED scripts presuppose an absolute path with a trailing slash. |
206 | +pathcar='s,^/\([^/]*\).*$,\1,' |
207 | +pathcdr='s,^/[^/]*,,' |
208 | +removedotparts=':dotsl |
209 | + s@/\./@/@g |
210 | + t dotsl |
211 | + s,/\.$,/,' |
212 | +collapseslashes='s@/\{1,\}@/@g' |
213 | +finalslash='s,/*$,/,' |
214 | + |
215 | +# func_normal_abspath PATH |
216 | +# Remove doubled-up and trailing slashes, "." path components, |
217 | +# and cancel out any ".." path components in PATH after making |
218 | +# it an absolute path. |
219 | +# value returned in "$func_normal_abspath_result" |
220 | +func_normal_abspath () |
221 | +{ |
222 | + # Start from root dir and reassemble the path. |
223 | + func_normal_abspath_result= |
224 | + func_normal_abspath_tpath=$1 |
225 | + func_normal_abspath_altnamespace= |
226 | + case $func_normal_abspath_tpath in |
227 | + "") |
228 | + # Empty path, that just means $cwd. |
229 | + func_stripname '' '/' "`pwd`" |
230 | + func_normal_abspath_result=$func_stripname_result |
231 | + return |
232 | + ;; |
233 | + # The next three entries are used to spot a run of precisely |
234 | + # two leading slashes without using negated character classes; |
235 | + # we take advantage of case's first-match behaviour. |
236 | + ///*) |
237 | + # Unusual form of absolute path, do nothing. |
238 | + ;; |
239 | + //*) |
240 | + # Not necessarily an ordinary path; POSIX reserves leading '//' |
241 | + # and for example Cygwin uses it to access remote file shares |
242 | + # over CIFS/SMB, so we conserve a leading double slash if found. |
243 | + func_normal_abspath_altnamespace=/ |
244 | + ;; |
245 | + /*) |
246 | + # Absolute path, do nothing. |
247 | + ;; |
248 | + *) |
249 | + # Relative path, prepend $cwd. |
250 | + func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath |
251 | + ;; |
252 | + esac |
253 | + # Cancel out all the simple stuff to save iterations. We also want |
254 | + # the path to end with a slash for ease of parsing, so make sure |
255 | + # there is one (and only one) here. |
256 | + func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ |
257 | + -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"` |
258 | + while :; do |
259 | + # Processed it all yet? |
260 | + if test "$func_normal_abspath_tpath" = / ; then |
261 | + # If we ascended to the root using ".." the result may be empty now. |
262 | + if test -z "$func_normal_abspath_result" ; then |
263 | + func_normal_abspath_result=/ |
264 | + fi |
265 | + break |
266 | + fi |
267 | + func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ |
268 | + -e "$pathcar"` |
269 | + func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ |
270 | + -e "$pathcdr"` |
271 | + # Figure out what to do with it |
272 | + case $func_normal_abspath_tcomponent in |
273 | + "") |
274 | + # Trailing empty path component, ignore it. |
275 | + ;; |
276 | + ..) |
277 | + # Parent dir; strip last assembled component from result. |
278 | + func_dirname "$func_normal_abspath_result" |
279 | + func_normal_abspath_result=$func_dirname_result |
280 | + ;; |
281 | + *) |
282 | + # Actual path component, append it. |
283 | + func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent |
284 | + ;; |
285 | + esac |
286 | + done |
287 | + # Restore leading double-slash if one was found on entry. |
288 | + func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result |
289 | +} |
290 | + |
291 | +# func_relative_path SRCDIR DSTDIR |
292 | +# generates a relative path from SRCDIR to DSTDIR, with a trailing |
293 | +# slash if non-empty, suitable for immediately appending a filename |
294 | +# without needing to append a separator. |
295 | +# value returned in "$func_relative_path_result" |
296 | +func_relative_path () |
297 | +{ |
298 | + func_relative_path_result= |
299 | + func_normal_abspath "$1" |
300 | + func_relative_path_tlibdir=$func_normal_abspath_result |
301 | + func_normal_abspath "$2" |
302 | + func_relative_path_tbindir=$func_normal_abspath_result |
303 | + |
304 | + # Ascend the tree starting from libdir |
305 | + while :; do |
306 | + # check if we have found a prefix of bindir |
307 | + case $func_relative_path_tbindir in |
308 | + $func_relative_path_tlibdir) |
309 | + # found an exact match |
310 | + func_relative_path_tcancelled= |
311 | + break |
312 | + ;; |
313 | + $func_relative_path_tlibdir*) |
314 | + # found a matching prefix |
315 | + func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" |
316 | + func_relative_path_tcancelled=$func_stripname_result |
317 | + if test -z "$func_relative_path_result"; then |
318 | + func_relative_path_result=. |
319 | + fi |
320 | + break |
321 | + ;; |
322 | + *) |
323 | + func_dirname $func_relative_path_tlibdir |
324 | + func_relative_path_tlibdir=${func_dirname_result} |
325 | + if test "x$func_relative_path_tlibdir" = x ; then |
326 | + # Have to descend all the way to the root! |
327 | + func_relative_path_result=../$func_relative_path_result |
328 | + func_relative_path_tcancelled=$func_relative_path_tbindir |
329 | + break |
330 | + fi |
331 | + func_relative_path_result=../$func_relative_path_result |
332 | + ;; |
333 | + esac |
334 | + done |
335 | + |
336 | + # Now calculate path; take care to avoid doubling-up slashes. |
337 | + func_stripname '' '/' "$func_relative_path_result" |
338 | + func_relative_path_result=$func_stripname_result |
339 | + func_stripname '/' '/' "$func_relative_path_tcancelled" |
340 | + if test "x$func_stripname_result" != x ; then |
341 | + func_relative_path_result=${func_relative_path_result}/${func_stripname_result} |
342 | + fi |
343 | + |
344 | + # Normalisation. If bindir is libdir, return empty string, |
345 | + # else relative path ending with a slash; either way, target |
346 | + # file name can be directly appended. |
347 | + if test ! -z "$func_relative_path_result"; then |
348 | + func_stripname './' '' "$func_relative_path_result/" |
349 | + func_relative_path_result=$func_stripname_result |
350 | + fi |
351 | +} |
352 | + |
353 | +# The name of this program: |
354 | +func_dirname_and_basename "$progpath" |
355 | +progname=$func_basename_result |
356 | + |
357 | +# Make sure we have an absolute path for reexecution: |
358 | +case $progpath in |
359 | + [\\/]*|[A-Za-z]:\\*) ;; |
360 | + *[\\/]*) |
361 | + progdir=$func_dirname_result |
362 | + progdir=`cd "$progdir" && pwd` |
363 | + progpath="$progdir/$progname" |
364 | + ;; |
365 | + *) |
366 | + save_IFS="$IFS" |
367 | + IFS=: |
368 | + for progdir in $PATH; do |
369 | + IFS="$save_IFS" |
370 | + test -x "$progdir/$progname" && break |
371 | + done |
372 | + IFS="$save_IFS" |
373 | + test -n "$progdir" || progdir=`pwd` |
374 | + progpath="$progdir/$progname" |
375 | + ;; |
376 | +esac |
377 | + |
378 | +# Sed substitution that helps us do robust quoting. It backslashifies |
379 | +# metacharacters that are still active within double-quoted strings. |
380 | +Xsed="${SED}"' -e 1s/^X//' |
381 | +sed_quote_subst='s/\([`"$\\]\)/\\\1/g' |
382 | + |
383 | +# Same as above, but do not quote variable references. |
384 | +double_quote_subst='s/\(["`\\]\)/\\\1/g' |
385 | + |
386 | +# Re-`\' parameter expansions in output of double_quote_subst that were |
387 | +# `\'-ed in input to the same. If an odd number of `\' preceded a '$' |
388 | +# in input to double_quote_subst, that '$' was protected from expansion. |
389 | +# Since each input `\' is now two `\'s, look for any number of runs of |
390 | +# four `\'s followed by two `\'s and then a '$'. `\' that '$'. |
391 | +bs='\\' |
392 | +bs2='\\\\' |
393 | +bs4='\\\\\\\\' |
394 | +dollar='\$' |
395 | +sed_double_backslash="\ |
396 | + s/$bs4/&\\ |
397 | +/g |
398 | + s/^$bs2$dollar/$bs&/ |
399 | + s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g |
400 | + s/\n//g" |
401 | + |
402 | +# Standard options: |
403 | +opt_dry_run=false |
404 | +opt_help=false |
405 | +opt_quiet=false |
406 | +opt_verbose=false |
407 | +opt_warning=: |
408 | + |
409 | +# func_echo arg... |
410 | +# Echo program name prefixed message, along with the current mode |
411 | +# name if it has been set yet. |
412 | +func_echo () |
413 | +{ |
414 | + $ECHO "$progname${mode+: }$mode: $*" |
415 | +} |
416 | + |
417 | +# func_verbose arg... |
418 | +# Echo program name prefixed message in verbose mode only. |
419 | +func_verbose () |
420 | +{ |
421 | + $opt_verbose && func_echo ${1+"$@"} |
422 | + |
423 | + # A bug in bash halts the script if the last line of a function |
424 | + # fails when set -e is in force, so we need another command to |
425 | + # work around that: |
426 | + : |
427 | +} |
428 | + |
429 | +# func_echo_all arg... |
430 | +# Invoke $ECHO with all args, space-separated. |
431 | +func_echo_all () |
432 | +{ |
433 | + $ECHO "$*" |
434 | +} |
435 | + |
436 | +# func_error arg... |
437 | +# Echo program name prefixed message to standard error. |
438 | +func_error () |
439 | +{ |
440 | + $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2 |
441 | +} |
442 | + |
443 | +# func_warning arg... |
444 | +# Echo program name prefixed warning message to standard error. |
445 | +func_warning () |
446 | +{ |
447 | + $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2 |
448 | + |
449 | + # bash bug again: |
450 | + : |
451 | +} |
452 | + |
453 | +# func_fatal_error arg... |
454 | +# Echo program name prefixed message to standard error, and exit. |
455 | +func_fatal_error () |
456 | +{ |
457 | + func_error ${1+"$@"} |
458 | + exit $EXIT_FAILURE |
459 | +} |
460 | + |
461 | +# func_fatal_help arg... |
462 | +# Echo program name prefixed message to standard error, followed by |
463 | +# a help hint, and exit. |
464 | +func_fatal_help () |
465 | +{ |
466 | + func_error ${1+"$@"} |
467 | + func_fatal_error "$help" |
468 | +} |
469 | +help="Try \`$progname --help' for more information." ## default |
470 | + |
471 | + |
472 | +# func_grep expression filename |
473 | +# Check whether EXPRESSION matches any line of FILENAME, without output. |
474 | +func_grep () |
475 | +{ |
476 | + $GREP "$1" "$2" >/dev/null 2>&1 |
477 | +} |
478 | + |
479 | + |
480 | +# func_mkdir_p directory-path |
481 | +# Make sure the entire path to DIRECTORY-PATH is available. |
482 | +func_mkdir_p () |
483 | +{ |
484 | + my_directory_path="$1" |
485 | + my_dir_list= |
486 | + |
487 | + if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then |
488 | + |
489 | + # Protect directory names starting with `-' |
490 | + case $my_directory_path in |
491 | + -*) my_directory_path="./$my_directory_path" ;; |
492 | + esac |
493 | + |
494 | + # While some portion of DIR does not yet exist... |
495 | + while test ! -d "$my_directory_path"; do |
496 | + # ...make a list in topmost first order. Use a colon delimited |
497 | + # list incase some portion of path contains whitespace. |
498 | + my_dir_list="$my_directory_path:$my_dir_list" |
499 | + |
500 | + # If the last portion added has no slash in it, the list is done |
501 | + case $my_directory_path in */*) ;; *) break ;; esac |
502 | + |
503 | + # ...otherwise throw away the child directory and loop |
504 | + my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"` |
505 | + done |
506 | + my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'` |
507 | + |
508 | + save_mkdir_p_IFS="$IFS"; IFS=':' |
509 | + for my_dir in $my_dir_list; do |
510 | + IFS="$save_mkdir_p_IFS" |
511 | + # mkdir can fail with a `File exist' error if two processes |
512 | + # try to create one of the directories concurrently. Don't |
513 | + # stop in that case! |
514 | + $MKDIR "$my_dir" 2>/dev/null || : |
515 | + done |
516 | + IFS="$save_mkdir_p_IFS" |
517 | + |
518 | + # Bail out if we (or some other process) failed to create a directory. |
519 | + test -d "$my_directory_path" || \ |
520 | + func_fatal_error "Failed to create \`$1'" |
521 | + fi |
522 | +} |
523 | + |
524 | + |
525 | +# func_mktempdir [string] |
526 | +# Make a temporary directory that won't clash with other running |
527 | +# libtool processes, and avoids race conditions if possible. If |
528 | +# given, STRING is the basename for that directory. |
529 | +func_mktempdir () |
530 | +{ |
531 | + my_template="${TMPDIR-/tmp}/${1-$progname}" |
532 | + |
533 | + if test "$opt_dry_run" = ":"; then |
534 | + # Return a directory name, but don't create it in dry-run mode |
535 | + my_tmpdir="${my_template}-$$" |
536 | + else |
537 | + |
538 | + # If mktemp works, use that first and foremost |
539 | + my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` |
540 | + |
541 | + if test ! -d "$my_tmpdir"; then |
542 | + # Failing that, at least try and use $RANDOM to avoid a race |
543 | + my_tmpdir="${my_template}-${RANDOM-0}$$" |
544 | + |
545 | + save_mktempdir_umask=`umask` |
546 | + umask 0077 |
547 | + $MKDIR "$my_tmpdir" |
548 | + umask $save_mktempdir_umask |
549 | + fi |
550 | + |
551 | + # If we're not in dry-run mode, bomb out on failure |
552 | + test -d "$my_tmpdir" || \ |
553 | + func_fatal_error "cannot create temporary directory \`$my_tmpdir'" |
554 | + fi |
555 | + |
556 | + $ECHO "$my_tmpdir" |
557 | +} |
558 | + |
559 | + |
560 | +# func_quote_for_eval arg |
561 | +# Aesthetically quote ARG to be evaled later. |
562 | +# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT |
563 | +# is double-quoted, suitable for a subsequent eval, whereas |
564 | +# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters |
565 | +# which are still active within double quotes backslashified. |
566 | +func_quote_for_eval () |
567 | +{ |
568 | + case $1 in |
569 | + *[\\\`\"\$]*) |
570 | + func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;; |
571 | + *) |
572 | + func_quote_for_eval_unquoted_result="$1" ;; |
573 | + esac |
574 | + |
575 | + case $func_quote_for_eval_unquoted_result in |
576 | + # Double-quote args containing shell metacharacters to delay |
577 | + # word splitting, command substitution and and variable |
578 | + # expansion for a subsequent eval. |
579 | + # Many Bourne shells cannot handle close brackets correctly |
580 | + # in scan sets, so we specify it separately. |
581 | + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") |
582 | + func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" |
583 | + ;; |
584 | + *) |
585 | + func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" |
586 | + esac |
587 | +} |
588 | + |
589 | + |
590 | +# func_quote_for_expand arg |
591 | +# Aesthetically quote ARG to be evaled later; same as above, |
592 | +# but do not quote variable references. |
593 | +func_quote_for_expand () |
594 | +{ |
595 | + case $1 in |
596 | + *[\\\`\"]*) |
597 | + my_arg=`$ECHO "$1" | $SED \ |
598 | + -e "$double_quote_subst" -e "$sed_double_backslash"` ;; |
599 | + *) |
600 | + my_arg="$1" ;; |
601 | + esac |
602 | + |
603 | + case $my_arg in |
604 | + # Double-quote args containing shell metacharacters to delay |
605 | + # word splitting and command substitution for a subsequent eval. |
606 | + # Many Bourne shells cannot handle close brackets correctly |
607 | + # in scan sets, so we specify it separately. |
608 | + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") |
609 | + my_arg="\"$my_arg\"" |
610 | + ;; |
611 | + esac |
612 | + |
613 | + func_quote_for_expand_result="$my_arg" |
614 | +} |
615 | + |
616 | + |
617 | +# func_show_eval cmd [fail_exp] |
618 | +# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is |
619 | +# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP |
620 | +# is given, then evaluate it. |
621 | +func_show_eval () |
622 | +{ |
623 | + my_cmd="$1" |
624 | + my_fail_exp="${2-:}" |
625 | + |
626 | + ${opt_silent-false} || { |
627 | + func_quote_for_expand "$my_cmd" |
628 | + eval "func_echo $func_quote_for_expand_result" |
629 | + } |
630 | + |
631 | + if ${opt_dry_run-false}; then :; else |
632 | + eval "$my_cmd" |
633 | + my_status=$? |
634 | + if test "$my_status" -eq 0; then :; else |
635 | + eval "(exit $my_status); $my_fail_exp" |
636 | + fi |
637 | + fi |
638 | +} |
639 | + |
640 | + |
641 | +# func_show_eval_locale cmd [fail_exp] |
642 | +# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is |
643 | +# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP |
644 | +# is given, then evaluate it. Use the saved locale for evaluation. |
645 | +func_show_eval_locale () |
646 | +{ |
647 | + my_cmd="$1" |
648 | + my_fail_exp="${2-:}" |
649 | + |
650 | + ${opt_silent-false} || { |
651 | + func_quote_for_expand "$my_cmd" |
652 | + eval "func_echo $func_quote_for_expand_result" |
653 | + } |
654 | + |
655 | + if ${opt_dry_run-false}; then :; else |
656 | + eval "$lt_user_locale |
657 | + $my_cmd" |
658 | + my_status=$? |
659 | + eval "$lt_safe_locale" |
660 | + if test "$my_status" -eq 0; then :; else |
661 | + eval "(exit $my_status); $my_fail_exp" |
662 | + fi |
663 | + fi |
664 | +} |
665 | + |
666 | + |
667 | +# func_version |
668 | +# Echo version message to standard output and exit. |
669 | +func_version () |
670 | +{ |
671 | + $SED -n '/(C)/!b go |
672 | + :more |
673 | + /\./!{ |
674 | + N |
675 | + s/\n# / / |
676 | + b more |
677 | + } |
678 | + :go |
679 | + /^# '$PROGRAM' (GNU /,/# warranty; / { |
680 | + s/^# // |
681 | + s/^# *$// |
682 | + s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ |
683 | + p |
684 | + }' < "$progpath" |
685 | + exit $? |
686 | +} |
687 | + |
688 | +# func_usage |
689 | +# Echo short help message to standard output and exit. |
690 | +func_usage () |
691 | +{ |
692 | + $SED -n '/^# Usage:/,/^# *.*--help/ { |
693 | + s/^# // |
694 | + s/^# *$// |
695 | + s/\$progname/'$progname'/ |
696 | + p |
697 | + }' < "$progpath" |
698 | + echo |
699 | + $ECHO "run \`$progname --help | more' for full usage" |
700 | + exit $? |
701 | +} |
702 | + |
703 | +# func_help [NOEXIT] |
704 | +# Echo long help message to standard output and exit, |
705 | +# unless 'noexit' is passed as argument. |
706 | +func_help () |
707 | +{ |
708 | + $SED -n '/^# Usage:/,/# Report bugs to/ { |
709 | + s/^# // |
710 | + s/^# *$// |
711 | + s*\$progname*'$progname'* |
712 | + s*\$host*'"$host"'* |
713 | + s*\$SHELL*'"$SHELL"'* |
714 | + s*\$LTCC*'"$LTCC"'* |
715 | + s*\$LTCFLAGS*'"$LTCFLAGS"'* |
716 | + s*\$LD*'"$LD"'* |
717 | + s/\$with_gnu_ld/'"$with_gnu_ld"'/ |
718 | + s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/ |
719 | + s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/ |
720 | + p |
721 | + }' < "$progpath" |
722 | + ret=$? |
723 | + if test -z "$1"; then |
724 | + exit $ret |
725 | + fi |
726 | +} |
727 | + |
728 | +# func_missing_arg argname |
729 | +# Echo program name prefixed message to standard error and set global |
730 | +# exit_cmd. |
731 | +func_missing_arg () |
732 | +{ |
733 | + func_error "missing argument for $1." |
734 | + exit_cmd=exit |
735 | +} |
736 | + |
737 | +exit_cmd=: |
738 | + |
739 | + |
740 | + |
741 | + |
742 | + |
743 | + |
744 | +magic="%%%MAGIC variable%%%" |
745 | +magic_exe="%%%MAGIC EXE variable%%%" |
746 | + |
747 | +# Global variables. |
748 | +# $mode is unset |
749 | +nonopt= |
750 | +execute_dlfiles= |
751 | +preserve_args= |
752 | +lo2o="s/\\.lo\$/.${objext}/" |
753 | +o2lo="s/\\.${objext}\$/.lo/" |
754 | +extracted_archives= |
755 | +extracted_serial=0 |
756 | + |
757 | +opt_dry_run=false |
758 | +opt_duplicate_deps=false |
759 | +opt_silent=false |
760 | +opt_debug=: |
761 | + |
762 | +# If this variable is set in any of the actions, the command in it |
763 | +# will be execed at the end. This prevents here-documents from being |
764 | +# left over by shells. |
765 | +exec_cmd= |
766 | + |
767 | +# func_fatal_configuration arg... |
768 | +# Echo program name prefixed message to standard error, followed by |
769 | +# a configuration failure hint, and exit. |
770 | +func_fatal_configuration () |
771 | +{ |
772 | + func_error ${1+"$@"} |
773 | + func_error "See the $PACKAGE documentation for more information." |
774 | + func_fatal_error "Fatal configuration error." |
775 | +} |
776 | + |
777 | + |
778 | +# func_config |
779 | +# Display the configuration for all the tags in this script. |
780 | +func_config () |
781 | +{ |
782 | + re_begincf='^# ### BEGIN LIBTOOL' |
783 | + re_endcf='^# ### END LIBTOOL' |
784 | + |
785 | + # Default configuration. |
786 | + $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" |
787 | + |
788 | + # Now print the configurations for the tags. |
789 | + for tagname in $taglist; do |
790 | + $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" |
791 | + done |
792 | + |
793 | + exit $? |
794 | +} |
795 | + |
796 | +# func_features |
797 | +# Display the features supported by this script. |
798 | +func_features () |
799 | +{ |
800 | + echo "host: $host" |
801 | + if test "$build_libtool_libs" = yes; then |
802 | + echo "enable shared libraries" |
803 | + else |
804 | + echo "disable shared libraries" |
805 | + fi |
806 | + if test "$build_old_libs" = yes; then |
807 | + echo "enable static libraries" |
808 | + else |
809 | + echo "disable static libraries" |
810 | + fi |
811 | + |
812 | + exit $? |
813 | +} |
814 | + |
815 | +# func_enable_tag tagname |
816 | +# Verify that TAGNAME is valid, and either flag an error and exit, or |
817 | +# enable the TAGNAME tag. We also add TAGNAME to the global $taglist |
818 | +# variable here. |
819 | +func_enable_tag () |
820 | +{ |
821 | + # Global variable: |
822 | + tagname="$1" |
823 | + |
824 | + re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" |
825 | + re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" |
826 | + sed_extractcf="/$re_begincf/,/$re_endcf/p" |
827 | + |
828 | + # Validate tagname. |
829 | + case $tagname in |
830 | + *[!-_A-Za-z0-9,/]*) |
831 | + func_fatal_error "invalid tag name: $tagname" |
832 | + ;; |
833 | + esac |
834 | + |
835 | + # Don't test for the "default" C tag, as we know it's |
836 | + # there but not specially marked. |
837 | + case $tagname in |
838 | + CC) ;; |
839 | + *) |
840 | + if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then |
841 | + taglist="$taglist $tagname" |
842 | + |
843 | + # Evaluate the configuration. Be careful to quote the path |
844 | + # and the sed script, to avoid splitting on whitespace, but |
845 | + # also don't use non-portable quotes within backquotes within |
846 | + # quotes we have to do it in 2 steps: |
847 | + extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` |
848 | + eval "$extractedcf" |
849 | + else |
850 | + func_error "ignoring unknown tag $tagname" |
851 | + fi |
852 | + ;; |
853 | + esac |
854 | +} |
855 | + |
856 | +# Parse options once, thoroughly. This comes as soon as possible in |
857 | +# the script to make things like `libtool --version' happen quickly. |
858 | +{ |
859 | + |
860 | + # Shorthand for --mode=foo, only valid as the first argument |
861 | + case $1 in |
862 | + clean|clea|cle|cl) |
863 | + shift; set dummy --mode clean ${1+"$@"}; shift |
864 | + ;; |
865 | + compile|compil|compi|comp|com|co|c) |
866 | + shift; set dummy --mode compile ${1+"$@"}; shift |
867 | + ;; |
868 | + execute|execut|execu|exec|exe|ex|e) |
869 | + shift; set dummy --mode execute ${1+"$@"}; shift |
870 | + ;; |
871 | + finish|finis|fini|fin|fi|f) |
872 | + shift; set dummy --mode finish ${1+"$@"}; shift |
873 | + ;; |
874 | + install|instal|insta|inst|ins|in|i) |
875 | + shift; set dummy --mode install ${1+"$@"}; shift |
876 | + ;; |
877 | + link|lin|li|l) |
878 | + shift; set dummy --mode link ${1+"$@"}; shift |
879 | + ;; |
880 | + uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) |
881 | + shift; set dummy --mode uninstall ${1+"$@"}; shift |
882 | + ;; |
883 | + esac |
884 | + |
885 | + # Parse non-mode specific arguments: |
886 | + while test "$#" -gt 0; do |
887 | + opt="$1" |
888 | + shift |
889 | + |
890 | + case $opt in |
891 | + --config) func_config ;; |
892 | + |
893 | + --debug) preserve_args="$preserve_args $opt" |
894 | + func_echo "enabling shell trace mode" |
895 | + opt_debug='set -x' |
896 | + $opt_debug |
897 | + ;; |
898 | + |
899 | + -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break |
900 | + execute_dlfiles="$execute_dlfiles $1" |
901 | + shift |
902 | + ;; |
903 | + |
904 | + --dry-run | -n) opt_dry_run=: ;; |
905 | + --features) func_features ;; |
906 | + --finish) mode="finish" ;; |
907 | + |
908 | + --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break |
909 | + case $1 in |
910 | + # Valid mode arguments: |
911 | + clean) ;; |
912 | + compile) ;; |
913 | + execute) ;; |
914 | + finish) ;; |
915 | + install) ;; |
916 | + link) ;; |
917 | + relink) ;; |
918 | + uninstall) ;; |
919 | + |
920 | + # Catch anything else as an error |
921 | + *) func_error "invalid argument for $opt" |
922 | + exit_cmd=exit |
923 | + break |
924 | + ;; |
925 | + esac |
926 | + |
927 | + mode="$1" |
928 | + shift |
929 | + ;; |
930 | + |
931 | + --preserve-dup-deps) |
932 | + opt_duplicate_deps=: ;; |
933 | + |
934 | + --quiet|--silent) preserve_args="$preserve_args $opt" |
935 | + opt_silent=: |
936 | + opt_verbose=false |
937 | + ;; |
938 | + |
939 | + --no-quiet|--no-silent) |
940 | + preserve_args="$preserve_args $opt" |
941 | + opt_silent=false |
942 | + ;; |
943 | + |
944 | + --verbose| -v) preserve_args="$preserve_args $opt" |
945 | + opt_silent=false |
946 | + opt_verbose=: |
947 | + ;; |
948 | + |
949 | + --no-verbose) preserve_args="$preserve_args $opt" |
950 | + opt_verbose=false |
951 | + ;; |
952 | + |
953 | + --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break |
954 | + preserve_args="$preserve_args $opt $1" |
955 | + func_enable_tag "$1" # tagname is set here |
956 | + shift |
957 | + ;; |
958 | + |
959 | + # Separate optargs to long options: |
960 | + -dlopen=*|--mode=*|--tag=*) |
961 | + func_opt_split "$opt" |
962 | + set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"} |
963 | + shift |
964 | + ;; |
965 | + |
966 | + -\?|-h) func_usage ;; |
967 | + --help) opt_help=: ;; |
968 | + --help-all) opt_help=': help-all' ;; |
969 | + --version) func_version ;; |
970 | + |
971 | + -*) func_fatal_help "unrecognized option \`$opt'" ;; |
972 | + |
973 | + *) nonopt="$opt" |
974 | + break |
975 | + ;; |
976 | + esac |
977 | + done |
978 | + |
979 | + |
980 | + case $host in |
981 | + *cygwin* | *mingw* | *pw32* | *cegcc*) |
982 | + # don't eliminate duplications in $postdeps and $predeps |
983 | + opt_duplicate_compiler_generated_deps=: |
984 | + ;; |
985 | + *) |
986 | + opt_duplicate_compiler_generated_deps=$opt_duplicate_deps |
987 | + ;; |
988 | + esac |
989 | + |
990 | + # Having warned about all mis-specified options, bail out if |
991 | + # anything was wrong. |
992 | + $exit_cmd $EXIT_FAILURE |
993 | +} |
994 | + |
995 | +# func_check_version_match |
996 | +# Ensure that we are using m4 macros, and libtool script from the same |
997 | +# release of libtool. |
998 | +func_check_version_match () |
999 | +{ |
1000 | + if test "$package_revision" != "$macro_revision"; then |
1001 | + if test "$VERSION" != "$macro_version"; then |
1002 | + if test -z "$macro_version"; then |
1003 | + cat >&2 <<_LT_EOF |
1004 | +$progname: Version mismatch error. This is $PACKAGE $VERSION, but the |
1005 | +$progname: definition of this LT_INIT comes from an older release. |
1006 | +$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION |
1007 | +$progname: and run autoconf again. |
1008 | +_LT_EOF |
1009 | + else |
1010 | + cat >&2 <<_LT_EOF |
1011 | +$progname: Version mismatch error. This is $PACKAGE $VERSION, but the |
1012 | +$progname: definition of this LT_INIT comes from $PACKAGE $macro_version. |
1013 | +$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION |
1014 | +$progname: and run autoconf again. |
1015 | +_LT_EOF |
1016 | + fi |
1017 | + else |
1018 | + cat >&2 <<_LT_EOF |
1019 | +$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, |
1020 | +$progname: but the definition of this LT_INIT comes from revision $macro_revision. |
1021 | +$progname: You should recreate aclocal.m4 with macros from revision $package_revision |
1022 | +$progname: of $PACKAGE $VERSION and run autoconf again. |
1023 | +_LT_EOF |
1024 | + fi |
1025 | + |
1026 | + exit $EXIT_MISMATCH |
1027 | + fi |
1028 | +} |
1029 | + |
1030 | + |
1031 | +## ----------- ## |
1032 | +## Main. ## |
1033 | +## ----------- ## |
1034 | + |
1035 | +$opt_help || { |
1036 | + # Sanity checks first: |
1037 | + func_check_version_match |
1038 | + |
1039 | + if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then |
1040 | + func_fatal_configuration "not configured to build any kind of library" |
1041 | + fi |
1042 | + |
1043 | + test -z "$mode" && func_fatal_error "error: you must specify a MODE." |
1044 | + |
1045 | + |
1046 | + # Darwin sucks |
1047 | + eval std_shrext=\"$shrext_cmds\" |
1048 | + |
1049 | + |
1050 | + # Only execute mode is allowed to have -dlopen flags. |
1051 | + if test -n "$execute_dlfiles" && test "$mode" != execute; then |
1052 | + func_error "unrecognized option \`-dlopen'" |
1053 | + $ECHO "$help" 1>&2 |
1054 | + exit $EXIT_FAILURE |
1055 | + fi |
1056 | + |
1057 | + # Change the help message to a mode-specific one. |
1058 | + generic_help="$help" |
1059 | + help="Try \`$progname --help --mode=$mode' for more information." |
1060 | +} |
1061 | + |
1062 | + |
1063 | +# func_lalib_p file |
1064 | +# True iff FILE is a libtool `.la' library or `.lo' object file. |
1065 | +# This function is only a basic sanity check; it will hardly flush out |
1066 | +# determined imposters. |
1067 | +func_lalib_p () |
1068 | +{ |
1069 | + test -f "$1" && |
1070 | + $SED -e 4q "$1" 2>/dev/null \ |
1071 | + | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 |
1072 | +} |
1073 | + |
1074 | +# func_lalib_unsafe_p file |
1075 | +# True iff FILE is a libtool `.la' library or `.lo' object file. |
1076 | +# This function implements the same check as func_lalib_p without |
1077 | +# resorting to external programs. To this end, it redirects stdin and |
1078 | +# closes it afterwards, without saving the original file descriptor. |
1079 | +# As a safety measure, use it only where a negative result would be |
1080 | +# fatal anyway. Works if `file' does not exist. |
1081 | +func_lalib_unsafe_p () |
1082 | +{ |
1083 | + lalib_p=no |
1084 | + if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then |
1085 | + for lalib_p_l in 1 2 3 4 |
1086 | + do |
1087 | + read lalib_p_line |
1088 | + case "$lalib_p_line" in |
1089 | + \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; |
1090 | + esac |
1091 | + done |
1092 | + exec 0<&5 5<&- |
1093 | + fi |
1094 | + test "$lalib_p" = yes |
1095 | +} |
1096 | + |
1097 | +# func_ltwrapper_script_p file |
1098 | +# True iff FILE is a libtool wrapper script |
1099 | +# This function is only a basic sanity check; it will hardly flush out |
1100 | +# determined imposters. |
1101 | +func_ltwrapper_script_p () |
1102 | +{ |
1103 | + func_lalib_p "$1" |
1104 | +} |
1105 | + |
1106 | +# func_ltwrapper_executable_p file |
1107 | +# True iff FILE is a libtool wrapper executable |
1108 | +# This function is only a basic sanity check; it will hardly flush out |
1109 | +# determined imposters. |
1110 | +func_ltwrapper_executable_p () |
1111 | +{ |
1112 | + func_ltwrapper_exec_suffix= |
1113 | + case $1 in |
1114 | + *.exe) ;; |
1115 | + *) func_ltwrapper_exec_suffix=.exe ;; |
1116 | + esac |
1117 | + $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 |
1118 | +} |
1119 | + |
1120 | +# func_ltwrapper_scriptname file |
1121 | +# Assumes file is an ltwrapper_executable |
1122 | +# uses $file to determine the appropriate filename for a |
1123 | +# temporary ltwrapper_script. |
1124 | +func_ltwrapper_scriptname () |
1125 | +{ |
1126 | + func_ltwrapper_scriptname_result="" |
1127 | + if func_ltwrapper_executable_p "$1"; then |
1128 | + func_dirname_and_basename "$1" "" "." |
1129 | + func_stripname '' '.exe' "$func_basename_result" |
1130 | + func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" |
1131 | + fi |
1132 | +} |
1133 | + |
1134 | +# func_ltwrapper_p file |
1135 | +# True iff FILE is a libtool wrapper script or wrapper executable |
1136 | +# This function is only a basic sanity check; it will hardly flush out |
1137 | +# determined imposters. |
1138 | +func_ltwrapper_p () |
1139 | +{ |
1140 | + func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" |
1141 | +} |
1142 | + |
1143 | + |
1144 | +# func_execute_cmds commands fail_cmd |
1145 | +# Execute tilde-delimited COMMANDS. |
1146 | +# If FAIL_CMD is given, eval that upon failure. |
1147 | +# FAIL_CMD may read-access the current command in variable CMD! |
1148 | +func_execute_cmds () |
1149 | +{ |
1150 | + $opt_debug |
1151 | + save_ifs=$IFS; IFS='~' |
1152 | + for cmd in $1; do |
1153 | + IFS=$save_ifs |
1154 | + eval cmd=\"$cmd\" |
1155 | + func_show_eval "$cmd" "${2-:}" |
1156 | + done |
1157 | + IFS=$save_ifs |
1158 | +} |
1159 | + |
1160 | + |
1161 | +# func_source file |
1162 | +# Source FILE, adding directory component if necessary. |
1163 | +# Note that it is not necessary on cygwin/mingw to append a dot to |
1164 | +# FILE even if both FILE and FILE.exe exist: automatic-append-.exe |
1165 | +# behavior happens only for exec(3), not for open(2)! Also, sourcing |
1166 | +# `FILE.' does not work on cygwin managed mounts. |
1167 | +func_source () |
1168 | +{ |
1169 | + $opt_debug |
1170 | + case $1 in |
1171 | + */* | *\\*) . "$1" ;; |
1172 | + *) . "./$1" ;; |
1173 | + esac |
1174 | +} |
1175 | + |
1176 | + |
1177 | +# func_infer_tag arg |
1178 | +# Infer tagged configuration to use if any are available and |
1179 | +# if one wasn't chosen via the "--tag" command line option. |
1180 | +# Only attempt this if the compiler in the base compile |
1181 | +# command doesn't match the default compiler. |
1182 | +# arg is usually of the form 'gcc ...' |
1183 | +func_infer_tag () |
1184 | +{ |
1185 | + $opt_debug |
1186 | + if test -n "$available_tags" && test -z "$tagname"; then |
1187 | + CC_quoted= |
1188 | + for arg in $CC; do |
1189 | + func_quote_for_eval "$arg" |
1190 | + CC_quoted="$CC_quoted $func_quote_for_eval_result" |
1191 | + done |
1192 | + CC_expanded=`func_echo_all $CC` |
1193 | + CC_quoted_expanded=`func_echo_all $CC_quoted` |
1194 | + case $@ in |
1195 | + # Blanks in the command may have been stripped by the calling shell, |
1196 | + # but not from the CC environment variable when configure was run. |
1197 | + " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ |
1198 | + " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; |
1199 | + # Blanks at the start of $base_compile will cause this to fail |
1200 | + # if we don't check for them as well. |
1201 | + *) |
1202 | + for z in $available_tags; do |
1203 | + if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then |
1204 | + # Evaluate the configuration. |
1205 | + eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" |
1206 | + CC_quoted= |
1207 | + for arg in $CC; do |
1208 | + # Double-quote args containing other shell metacharacters. |
1209 | + func_quote_for_eval "$arg" |
1210 | + CC_quoted="$CC_quoted $func_quote_for_eval_result" |
1211 | + done |
1212 | + CC_expanded=`func_echo_all $CC` |
1213 | + CC_quoted_expanded=`func_echo_all $CC_quoted` |
1214 | + case "$@ " in |
1215 | + " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ |
1216 | + " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) |
1217 | + # The compiler in the base compile command matches |
1218 | + # the one in the tagged configuration. |
1219 | + # Assume this is the tagged configuration we want. |
1220 | + tagname=$z |
1221 | + break |
1222 | + ;; |
1223 | + esac |
1224 | + fi |
1225 | + done |
1226 | + # If $tagname still isn't set, then no tagged configuration |
1227 | + # was found and let the user know that the "--tag" command |
1228 | + # line option must be used. |
1229 | + if test -z "$tagname"; then |
1230 | + func_echo "unable to infer tagged configuration" |
1231 | + func_fatal_error "specify a tag with \`--tag'" |
1232 | +# else |
1233 | +# func_verbose "using $tagname tagged configuration" |
1234 | + fi |
1235 | + ;; |
1236 | + esac |
1237 | + fi |
1238 | +} |
1239 | + |
1240 | + |
1241 | + |
1242 | +# func_write_libtool_object output_name pic_name nonpic_name |
1243 | +# Create a libtool object file (analogous to a ".la" file), |
1244 | +# but don't create it if we're doing a dry run. |
1245 | +func_write_libtool_object () |
1246 | +{ |
1247 | + write_libobj=${1} |
1248 | + if test "$build_libtool_libs" = yes; then |
1249 | + write_lobj=\'${2}\' |
1250 | + else |
1251 | + write_lobj=none |
1252 | + fi |
1253 | + |
1254 | + if test "$build_old_libs" = yes; then |
1255 | + write_oldobj=\'${3}\' |
1256 | + else |
1257 | + write_oldobj=none |
1258 | + fi |
1259 | + |
1260 | + $opt_dry_run || { |
1261 | + cat >${write_libobj}T <<EOF |
1262 | +# $write_libobj - a libtool object file |
1263 | +# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION |
1264 | +# |
1265 | +# Please DO NOT delete this file! |
1266 | +# It is necessary for linking the library. |
1267 | + |
1268 | +# Name of the PIC object. |
1269 | +pic_object=$write_lobj |
1270 | + |
1271 | +# Name of the non-PIC object |
1272 | +non_pic_object=$write_oldobj |
1273 | + |
1274 | +EOF |
1275 | + $MV "${write_libobj}T" "${write_libobj}" |
1276 | + } |
1277 | +} |
1278 | + |
1279 | +# func_mode_compile arg... |
1280 | +func_mode_compile () |
1281 | +{ |
1282 | + $opt_debug |
1283 | + # Get the compilation command and the source file. |
1284 | + base_compile= |
1285 | + srcfile="$nonopt" # always keep a non-empty value in "srcfile" |
1286 | + suppress_opt=yes |
1287 | + suppress_output= |
1288 | + arg_mode=normal |
1289 | + libobj= |
1290 | + later= |
1291 | + pie_flag= |
1292 | + |
1293 | + for arg |
1294 | + do |
1295 | + case $arg_mode in |
1296 | + arg ) |
1297 | + # do not "continue". Instead, add this to base_compile |
1298 | + lastarg="$arg" |
1299 | + arg_mode=normal |
1300 | + ;; |
1301 | + |
1302 | + target ) |
1303 | + libobj="$arg" |
1304 | + arg_mode=normal |
1305 | + continue |
1306 | + ;; |
1307 | + |
1308 | + normal ) |
1309 | + # Accept any command-line options. |
1310 | + case $arg in |
1311 | + -o) |
1312 | + test -n "$libobj" && \ |
1313 | + func_fatal_error "you cannot specify \`-o' more than once" |
1314 | + arg_mode=target |
1315 | + continue |
1316 | + ;; |
1317 | + |
1318 | + -pie | -fpie | -fPIE) |
1319 | + pie_flag="$pie_flag $arg" |
1320 | + continue |
1321 | + ;; |
1322 | + |
1323 | + -shared | -static | -prefer-pic | -prefer-non-pic) |
1324 | + later="$later $arg" |
1325 | + continue |
1326 | + ;; |
1327 | + |
1328 | + -no-suppress) |
1329 | + suppress_opt=no |
1330 | + continue |
1331 | + ;; |
1332 | + |
1333 | + -Xcompiler) |
1334 | + arg_mode=arg # the next one goes into the "base_compile" arg list |
1335 | + continue # The current "srcfile" will either be retained or |
1336 | + ;; # replaced later. I would guess that would be a bug. |
1337 | + |
1338 | + -Wc,*) |
1339 | + func_stripname '-Wc,' '' "$arg" |
1340 | + args=$func_stripname_result |
1341 | + lastarg= |
1342 | + save_ifs="$IFS"; IFS=',' |
1343 | + for arg in $args; do |
1344 | + IFS="$save_ifs" |
1345 | + func_quote_for_eval "$arg" |
1346 | + lastarg="$lastarg $func_quote_for_eval_result" |
1347 | + done |
1348 | + IFS="$save_ifs" |
1349 | + func_stripname ' ' '' "$lastarg" |
1350 | + lastarg=$func_stripname_result |
1351 | + |
1352 | + # Add the arguments to base_compile. |
1353 | + base_compile="$base_compile $lastarg" |
1354 | + continue |
1355 | + ;; |
1356 | + |
1357 | + *) |
1358 | + # Accept the current argument as the source file. |
1359 | + # The previous "srcfile" becomes the current argument. |
1360 | + # |
1361 | + lastarg="$srcfile" |
1362 | + srcfile="$arg" |
1363 | + ;; |
1364 | + esac # case $arg |
1365 | + ;; |
1366 | + esac # case $arg_mode |
1367 | + |
1368 | + # Aesthetically quote the previous argument. |
1369 | + func_quote_for_eval "$lastarg" |
1370 | + base_compile="$base_compile $func_quote_for_eval_result" |
1371 | + done # for arg |
1372 | + |
1373 | + case $arg_mode in |
1374 | + arg) |
1375 | + func_fatal_error "you must specify an argument for -Xcompile" |
1376 | + ;; |
1377 | + target) |
1378 | + func_fatal_error "you must specify a target with \`-o'" |
1379 | + ;; |
1380 | + *) |
1381 | + # Get the name of the library object. |
1382 | + test -z "$libobj" && { |
1383 | + func_basename "$srcfile" |
1384 | + libobj="$func_basename_result" |
1385 | + } |
1386 | + ;; |
1387 | + esac |
1388 | + |
1389 | + # Recognize several different file suffixes. |
1390 | + # If the user specifies -o file.o, it is replaced with file.lo |
1391 | + case $libobj in |
1392 | + *.[cCFSifmso] | \ |
1393 | + *.ada | *.adb | *.ads | *.asm | \ |
1394 | + *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ |
1395 | + *.[fF][09]? | *.for | *.java | *.obj | *.sx | *.cu | *.cup) |
1396 | + func_xform "$libobj" |
1397 | + libobj=$func_xform_result |
1398 | + ;; |
1399 | + esac |
1400 | + |
1401 | + case $libobj in |
1402 | + *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; |
1403 | + *) |
1404 | + func_fatal_error "cannot determine name of library object from \`$libobj'" |
1405 | + ;; |
1406 | + esac |
1407 | + |
1408 | + func_infer_tag $base_compile |
1409 | + |
1410 | + for arg in $later; do |
1411 | + case $arg in |
1412 | + -shared) |
1413 | + test "$build_libtool_libs" != yes && \ |
1414 | + func_fatal_configuration "can not build a shared library" |
1415 | + build_old_libs=no |
1416 | + continue |
1417 | + ;; |
1418 | + |
1419 | + -static) |
1420 | + build_libtool_libs=no |
1421 | + build_old_libs=yes |
1422 | + continue |
1423 | + ;; |
1424 | + |
1425 | + -prefer-pic) |
1426 | + pic_mode=yes |
1427 | + continue |
1428 | + ;; |
1429 | + |
1430 | + -prefer-non-pic) |
1431 | + pic_mode=no |
1432 | + continue |
1433 | + ;; |
1434 | + esac |
1435 | + done |
1436 | + |
1437 | + func_quote_for_eval "$libobj" |
1438 | + test "X$libobj" != "X$func_quote_for_eval_result" \ |
1439 | + && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ |
1440 | + && func_warning "libobj name \`$libobj' may not contain shell special characters." |
1441 | + func_dirname_and_basename "$obj" "/" "" |
1442 | + objname="$func_basename_result" |
1443 | + xdir="$func_dirname_result" |
1444 | + lobj=${xdir}$objdir/$objname |
1445 | + |
1446 | + test -z "$base_compile" && \ |
1447 | + func_fatal_help "you must specify a compilation command" |
1448 | + |
1449 | + # Delete any leftover library objects. |
1450 | + if test "$build_old_libs" = yes; then |
1451 | + removelist="$obj $lobj $libobj ${libobj}T" |
1452 | + else |
1453 | + removelist="$lobj $libobj ${libobj}T" |
1454 | + fi |
1455 | + |
1456 | + # On Cygwin there's no "real" PIC flag so we must build both object types |
1457 | + case $host_os in |
1458 | + cygwin* | mingw* | pw32* | os2* | cegcc*) |
1459 | + pic_mode=default |
1460 | + ;; |
1461 | + esac |
1462 | + if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then |
1463 | + # non-PIC code in shared libraries is not supported |
1464 | + pic_mode=default |
1465 | + fi |
1466 | + |
1467 | + # Calculate the filename of the output object if compiler does |
1468 | + # not support -o with -c |
1469 | + if test "$compiler_c_o" = no; then |
1470 | + output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext} |
1471 | + lockfile="$output_obj.lock" |
1472 | + else |
1473 | + output_obj= |
1474 | + need_locks=no |
1475 | + lockfile= |
1476 | + fi |
1477 | + |
1478 | + # Lock this critical section if it is needed |
1479 | + # We use this script file to make the link, it avoids creating a new file |
1480 | + if test "$need_locks" = yes; then |
1481 | + until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do |
1482 | + func_echo "Waiting for $lockfile to be removed" |
1483 | + sleep 2 |
1484 | + done |
1485 | + elif test "$need_locks" = warn; then |
1486 | + if test -f "$lockfile"; then |
1487 | + $ECHO "\ |
1488 | +*** ERROR, $lockfile exists and contains: |
1489 | +`cat $lockfile 2>/dev/null` |
1490 | + |
1491 | +This indicates that another process is trying to use the same |
1492 | +temporary object file, and libtool could not work around it because |
1493 | +your compiler does not support \`-c' and \`-o' together. If you |
1494 | +repeat this compilation, it may succeed, by chance, but you had better |
1495 | +avoid parallel builds (make -j) in this platform, or get a better |
1496 | +compiler." |
1497 | + |
1498 | + $opt_dry_run || $RM $removelist |
1499 | + exit $EXIT_FAILURE |
1500 | + fi |
1501 | + removelist="$removelist $output_obj" |
1502 | + $ECHO "$srcfile" > "$lockfile" |
1503 | + fi |
1504 | + |
1505 | + $opt_dry_run || $RM $removelist |
1506 | + removelist="$removelist $lockfile" |
1507 | + trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 |
1508 | + |
1509 | + if test -n "$fix_srcfile_path"; then |
1510 | + eval srcfile=\"$fix_srcfile_path\" |
1511 | + fi |
1512 | + func_quote_for_eval "$srcfile" |
1513 | + qsrcfile=$func_quote_for_eval_result |
1514 | + |
1515 | + # Only build a PIC object if we are building libtool libraries. |
1516 | + if test "$build_libtool_libs" = yes; then |
1517 | + # Without this assignment, base_compile gets emptied. |
1518 | + fbsd_hideous_sh_bug=$base_compile |
1519 | + |
1520 | + if test "$pic_mode" != no; then |
1521 | + command="$base_compile $qsrcfile $pic_flag" |
1522 | + else |
1523 | + # Don't build PIC code |
1524 | + command="$base_compile $qsrcfile" |
1525 | + fi |
1526 | + |
1527 | + func_mkdir_p "$xdir$objdir" |
1528 | + |
1529 | + if test -z "$output_obj"; then |
1530 | + # Place PIC objects in $objdir |
1531 | + command="$command -o $lobj" |
1532 | + fi |
1533 | + |
1534 | + func_show_eval_locale "$command" \ |
1535 | + 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' |
1536 | + |
1537 | + if test "$need_locks" = warn && |
1538 | + test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then |
1539 | + $ECHO "\ |
1540 | +*** ERROR, $lockfile contains: |
1541 | +`cat $lockfile 2>/dev/null` |
1542 | + |
1543 | +but it should contain: |
1544 | +$srcfile |
1545 | + |
1546 | +This indicates that another process is trying to use the same |
1547 | +temporary object file, and libtool could not work around it because |
1548 | +your compiler does not support \`-c' and \`-o' together. If you |
1549 | +repeat this compilation, it may succeed, by chance, but you had better |
1550 | +avoid parallel builds (make -j) in this platform, or get a better |
1551 | +compiler." |
1552 | + |
1553 | + $opt_dry_run || $RM $removelist |
1554 | + exit $EXIT_FAILURE |
1555 | + fi |
1556 | + |
1557 | + # Just move the object if needed, then go on to compile the next one |
1558 | + if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then |
1559 | + func_show_eval '$MV "$output_obj" "$lobj"' \ |
1560 | + 'error=$?; $opt_dry_run || $RM $removelist; exit $error' |
1561 | + fi |
1562 | + |
1563 | + # Allow error messages only from the first compilation. |
1564 | + if test "$suppress_opt" = yes; then |
1565 | + suppress_output=' >/dev/null 2>&1' |
1566 | + fi |
1567 | + fi |
1568 | + |
1569 | + # Only build a position-dependent object if we build old libraries. |
1570 | + if test "$build_old_libs" = yes; then |
1571 | + if test "$pic_mode" != yes; then |
1572 | + # Don't build PIC code |
1573 | + command="$base_compile $qsrcfile$pie_flag" |
1574 | + else |
1575 | + command="$base_compile $qsrcfile $pic_flag" |
1576 | + fi |
1577 | + if test "$compiler_c_o" = yes; then |
1578 | + command="$command -o $obj" |
1579 | + fi |
1580 | + |
1581 | + # Suppress compiler output if we already did a PIC compilation. |
1582 | + command="$command$suppress_output" |
1583 | + func_show_eval_locale "$command" \ |
1584 | + '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' |
1585 | + |
1586 | + if test "$need_locks" = warn && |
1587 | + test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then |
1588 | + $ECHO "\ |
1589 | +*** ERROR, $lockfile contains: |
1590 | +`cat $lockfile 2>/dev/null` |
1591 | + |
1592 | +but it should contain: |
1593 | +$srcfile |
1594 | + |
1595 | +This indicates that another process is trying to use the same |
1596 | +temporary object file, and libtool could not work around it because |
1597 | +your compiler does not support \`-c' and \`-o' together. If you |
1598 | +repeat this compilation, it may succeed, by chance, but you had better |
1599 | +avoid parallel builds (make -j) in this platform, or get a better |
1600 | +compiler." |
1601 | + |
1602 | + $opt_dry_run || $RM $removelist |
1603 | + exit $EXIT_FAILURE |
1604 | + fi |
1605 | + |
1606 | + # Just move the object if needed |
1607 | + if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then |
1608 | + func_show_eval '$MV "$output_obj" "$obj"' \ |
1609 | + 'error=$?; $opt_dry_run || $RM $removelist; exit $error' |
1610 | + fi |
1611 | + fi |
1612 | + |
1613 | + $opt_dry_run || { |
1614 | + func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" |
1615 | + |
1616 | + # Unlock the critical section if it was locked |
1617 | + if test "$need_locks" != no; then |
1618 | + removelist=$lockfile |
1619 | + $RM "$lockfile" |
1620 | + fi |
1621 | + } |
1622 | + |
1623 | + exit $EXIT_SUCCESS |
1624 | +} |
1625 | + |
1626 | +$opt_help || { |
1627 | + test "$mode" = compile && func_mode_compile ${1+"$@"} |
1628 | +} |
1629 | + |
1630 | +func_mode_help () |
1631 | +{ |
1632 | + # We need to display help for each of the modes. |
1633 | + case $mode in |
1634 | + "") |
1635 | + # Generic help is extracted from the usage comments |
1636 | + # at the start of this file. |
1637 | + func_help |
1638 | + ;; |
1639 | + |
1640 | + clean) |
1641 | + $ECHO \ |
1642 | +"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... |
1643 | + |
1644 | +Remove files from the build directory. |
1645 | + |
1646 | +RM is the name of the program to use to delete files associated with each FILE |
1647 | +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed |
1648 | +to RM. |
1649 | + |
1650 | +If FILE is a libtool library, object or program, all the files associated |
1651 | +with it are deleted. Otherwise, only FILE itself is deleted using RM." |
1652 | + ;; |
1653 | + |
1654 | + compile) |
1655 | + $ECHO \ |
1656 | +"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE |
1657 | + |
1658 | +Compile a source file into a libtool library object. |
1659 | + |
1660 | +This mode accepts the following additional options: |
1661 | + |
1662 | + -o OUTPUT-FILE set the output file name to OUTPUT-FILE |
1663 | + -no-suppress do not suppress compiler output for multiple passes |
1664 | + -prefer-pic try to build PIC objects only |
1665 | + -prefer-non-pic try to build non-PIC objects only |
1666 | + -shared do not build a \`.o' file suitable for static linking |
1667 | + -static only build a \`.o' file suitable for static linking |
1668 | + -Wc,FLAG pass FLAG directly to the compiler |
1669 | + |
1670 | +COMPILE-COMMAND is a command to be used in creating a \`standard' object file |
1671 | +from the given SOURCEFILE. |
1672 | + |
1673 | +The output file name is determined by removing the directory component from |
1674 | +SOURCEFILE, then substituting the C source code suffix \`.c' with the |
1675 | +library object suffix, \`.lo'." |
1676 | + ;; |
1677 | + |
1678 | + execute) |
1679 | + $ECHO \ |
1680 | +"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... |
1681 | + |
1682 | +Automatically set library path, then run a program. |
1683 | + |
1684 | +This mode accepts the following additional options: |
1685 | + |
1686 | + -dlopen FILE add the directory containing FILE to the library path |
1687 | + |
1688 | +This mode sets the library path environment variable according to \`-dlopen' |
1689 | +flags. |
1690 | + |
1691 | +If any of the ARGS are libtool executable wrappers, then they are translated |
1692 | +into their corresponding uninstalled binary, and any of their required library |
1693 | +directories are added to the library path. |
1694 | + |
1695 | +Then, COMMAND is executed, with ARGS as arguments." |
1696 | + ;; |
1697 | + |
1698 | + finish) |
1699 | + $ECHO \ |
1700 | +"Usage: $progname [OPTION]... --mode=finish [LIBDIR]... |
1701 | + |
1702 | +Complete the installation of libtool libraries. |
1703 | + |
1704 | +Each LIBDIR is a directory that contains libtool libraries. |
1705 | + |
1706 | +The commands that this mode executes may require superuser privileges. Use |
1707 | +the \`--dry-run' option if you just want to see what would be executed." |
1708 | + ;; |
1709 | + |
1710 | + install) |
1711 | + $ECHO \ |
1712 | +"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... |
1713 | + |
1714 | +Install executables or libraries. |
1715 | + |
1716 | +INSTALL-COMMAND is the installation command. The first component should be |
1717 | +either the \`install' or \`cp' program. |
1718 | + |
1719 | +The following components of INSTALL-COMMAND are treated specially: |
1720 | + |
1721 | + -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation |
1722 | + |
1723 | +The rest of the components are interpreted as arguments to that command (only |
1724 | +BSD-compatible install options are recognized)." |
1725 | + ;; |
1726 | + |
1727 | + link) |
1728 | + $ECHO \ |
1729 | +"Usage: $progname [OPTION]... --mode=link LINK-COMMAND... |
1730 | + |
1731 | +Link object files or libraries together to form another library, or to |
1732 | +create an executable program. |
1733 | + |
1734 | +LINK-COMMAND is a command using the C compiler that you would use to create |
1735 | +a program from several object files. |
1736 | + |
1737 | +The following components of LINK-COMMAND are treated specially: |
1738 | + |
1739 | + -all-static do not do any dynamic linking at all |
1740 | + -avoid-version do not add a version suffix if possible |
1741 | + -bindir BINDIR specify path to binaries directory (for systems where |
1742 | + libraries must be found in the PATH setting at runtime) |
1743 | + -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime |
1744 | + -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols |
1745 | + -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) |
1746 | + -export-symbols SYMFILE |
1747 | + try to export only the symbols listed in SYMFILE |
1748 | + -export-symbols-regex REGEX |
1749 | + try to export only the symbols matching REGEX |
1750 | + -LLIBDIR search LIBDIR for required installed libraries |
1751 | + -lNAME OUTPUT-FILE requires the installed library libNAME |
1752 | + -module build a library that can dlopened |
1753 | + -no-fast-install disable the fast-install mode |
1754 | + -no-install link a not-installable executable |
1755 | + -no-undefined declare that a library does not refer to external symbols |
1756 | + -o OUTPUT-FILE create OUTPUT-FILE from the specified objects |
1757 | + -objectlist FILE Use a list of object files found in FILE to specify objects |
1758 | + -precious-files-regex REGEX |
1759 | + don't remove output files matching REGEX |
1760 | + -release RELEASE specify package release information |
1761 | + -rpath LIBDIR the created library will eventually be installed in LIBDIR |
1762 | + -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries |
1763 | + -shared only do dynamic linking of libtool libraries |
1764 | + -shrext SUFFIX override the standard shared library file extension |
1765 | + -static do not do any dynamic linking of uninstalled libtool libraries |
1766 | + -static-libtool-libs |
1767 | + do not do any dynamic linking of libtool libraries |
1768 | + -version-info CURRENT[:REVISION[:AGE]] |
1769 | + specify library version info [each variable defaults to 0] |
1770 | + -weak LIBNAME declare that the target provides the LIBNAME interface |
1771 | + -Wc,FLAG |
1772 | + -Xcompiler FLAG pass linker-specific FLAG directly to the compiler |
1773 | + -Wl,FLAG |
1774 | + -Xlinker FLAG pass linker-specific FLAG directly to the linker |
1775 | + -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) |
1776 | + |
1777 | +All other options (arguments beginning with \`-') are ignored. |
1778 | + |
1779 | +Every other argument is treated as a filename. Files ending in \`.la' are |
1780 | +treated as uninstalled libtool libraries, other files are standard or library |
1781 | +object files. |
1782 | + |
1783 | +If the OUTPUT-FILE ends in \`.la', then a libtool library is created, |
1784 | +only library objects (\`.lo' files) may be specified, and \`-rpath' is |
1785 | +required, except when creating a convenience library. |
1786 | + |
1787 | +If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created |
1788 | +using \`ar' and \`ranlib', or on Windows using \`lib'. |
1789 | + |
1790 | +If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file |
1791 | +is created, otherwise an executable program is created." |
1792 | + ;; |
1793 | + |
1794 | + uninstall) |
1795 | + $ECHO \ |
1796 | +"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... |
1797 | + |
1798 | +Remove libraries from an installation directory. |
1799 | + |
1800 | +RM is the name of the program to use to delete files associated with each FILE |
1801 | +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed |
1802 | +to RM. |
1803 | + |
1804 | +If FILE is a libtool library, all the files associated with it are deleted. |
1805 | +Otherwise, only FILE itself is deleted using RM." |
1806 | + ;; |
1807 | + |
1808 | + *) |
1809 | + func_fatal_help "invalid operation mode \`$mode'" |
1810 | + ;; |
1811 | + esac |
1812 | + |
1813 | + echo |
1814 | + $ECHO "Try \`$progname --help' for more information about other modes." |
1815 | +} |
1816 | + |
1817 | +# Now that we've collected a possible --mode arg, show help if necessary |
1818 | +if $opt_help; then |
1819 | + if test "$opt_help" = :; then |
1820 | + func_mode_help |
1821 | + else |
1822 | + { |
1823 | + func_help noexit |
1824 | + for mode in compile link execute install finish uninstall clean; do |
1825 | + func_mode_help |
1826 | + done |
1827 | + } | sed -n '1p; 2,$s/^Usage:/ or: /p' |
1828 | + { |
1829 | + func_help noexit |
1830 | + for mode in compile link execute install finish uninstall clean; do |
1831 | + echo |
1832 | + func_mode_help |
1833 | + done |
1834 | + } | |
1835 | + sed '1d |
1836 | + /^When reporting/,/^Report/{ |
1837 | + H |
1838 | + d |
1839 | + } |
1840 | + $x |
1841 | + /information about other modes/d |
1842 | + /more detailed .*MODE/d |
1843 | + s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' |
1844 | + fi |
1845 | + exit $? |
1846 | +fi |
1847 | + |
1848 | + |
1849 | +# func_mode_execute arg... |
1850 | +func_mode_execute () |
1851 | +{ |
1852 | + $opt_debug |
1853 | + # The first argument is the command name. |
1854 | + cmd="$nonopt" |
1855 | + test -z "$cmd" && \ |
1856 | + func_fatal_help "you must specify a COMMAND" |
1857 | + |
1858 | + # Handle -dlopen flags immediately. |
1859 | + for file in $execute_dlfiles; do |
1860 | + test -f "$file" \ |
1861 | + || func_fatal_help "\`$file' is not a file" |
1862 | + |
1863 | + dir= |
1864 | + case $file in |
1865 | + *.la) |
1866 | + # Check to see that this really is a libtool archive. |
1867 | + func_lalib_unsafe_p "$file" \ |
1868 | + || func_fatal_help "\`$lib' is not a valid libtool archive" |
1869 | + |
1870 | + # Read the libtool library. |
1871 | + dlname= |
1872 | + library_names= |
1873 | + func_source "$file" |
1874 | + |
1875 | + # Skip this library if it cannot be dlopened. |
1876 | + if test -z "$dlname"; then |
1877 | + # Warn if it was a shared library. |
1878 | + test -n "$library_names" && \ |
1879 | + func_warning "\`$file' was not linked with \`-export-dynamic'" |
1880 | + continue |
1881 | + fi |
1882 | + |
1883 | + func_dirname "$file" "" "." |
1884 | + dir="$func_dirname_result" |
1885 | + |
1886 | + if test -f "$dir/$objdir/$dlname"; then |
1887 | + dir="$dir/$objdir" |
1888 | + else |
1889 | + if test ! -f "$dir/$dlname"; then |
1890 | + func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" |
1891 | + fi |
1892 | + fi |
1893 | + ;; |
1894 | + |
1895 | + *.lo) |
1896 | + # Just add the directory containing the .lo file. |
1897 | + func_dirname "$file" "" "." |
1898 | + dir="$func_dirname_result" |
1899 | + ;; |
1900 | + |
1901 | + *) |
1902 | + func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" |
1903 | + continue |
1904 | + ;; |
1905 | + esac |
1906 | + |
1907 | + # Get the absolute pathname. |
1908 | + absdir=`cd "$dir" && pwd` |
1909 | + test -n "$absdir" && dir="$absdir" |
1910 | + |
1911 | + # Now add the directory to shlibpath_var. |
1912 | + if eval "test -z \"\$$shlibpath_var\""; then |
1913 | + eval "$shlibpath_var=\"\$dir\"" |
1914 | + else |
1915 | + eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" |
1916 | + fi |
1917 | + done |
1918 | + |
1919 | + # This variable tells wrapper scripts just to set shlibpath_var |
1920 | + # rather than running their programs. |
1921 | + libtool_execute_magic="$magic" |
1922 | + |
1923 | + # Check if any of the arguments is a wrapper script. |
1924 | + args= |
1925 | + for file |
1926 | + do |
1927 | + case $file in |
1928 | + -* | *.la | *.lo ) ;; |
1929 | + *) |
1930 | + # Do a test to see if this is really a libtool program. |
1931 | + if func_ltwrapper_script_p "$file"; then |
1932 | + func_source "$file" |
1933 | + # Transform arg to wrapped name. |
1934 | + file="$progdir/$program" |
1935 | + elif func_ltwrapper_executable_p "$file"; then |
1936 | + func_ltwrapper_scriptname "$file" |
1937 | + func_source "$func_ltwrapper_scriptname_result" |
1938 | + # Transform arg to wrapped name. |
1939 | + file="$progdir/$program" |
1940 | + fi |
1941 | + ;; |
1942 | + esac |
1943 | + # Quote arguments (to preserve shell metacharacters). |
1944 | + func_quote_for_eval "$file" |
1945 | + args="$args $func_quote_for_eval_result" |
1946 | + done |
1947 | + |
1948 | + if test "X$opt_dry_run" = Xfalse; then |
1949 | + if test -n "$shlibpath_var"; then |
1950 | + # Export the shlibpath_var. |
1951 | + eval "export $shlibpath_var" |
1952 | + fi |
1953 | + |
1954 | + # Restore saved environment variables |
1955 | + for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES |
1956 | + do |
1957 | + eval "if test \"\${save_$lt_var+set}\" = set; then |
1958 | + $lt_var=\$save_$lt_var; export $lt_var |
1959 | + else |
1960 | + $lt_unset $lt_var |
1961 | + fi" |
1962 | + done |
1963 | + |
1964 | + # Now prepare to actually exec the command. |
1965 | + exec_cmd="\$cmd$args" |
1966 | + else |
1967 | + # Display what would be done. |
1968 | + if test -n "$shlibpath_var"; then |
1969 | + eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" |
1970 | + echo "export $shlibpath_var" |
1971 | + fi |
1972 | + $ECHO "$cmd$args" |
1973 | + exit $EXIT_SUCCESS |
1974 | + fi |
1975 | +} |
1976 | + |
1977 | +test "$mode" = execute && func_mode_execute ${1+"$@"} |
1978 | + |
1979 | + |
1980 | +# func_mode_finish arg... |
1981 | +func_mode_finish () |
1982 | +{ |
1983 | + $opt_debug |
1984 | + libdirs="$nonopt" |
1985 | + admincmds= |
1986 | + |
1987 | + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then |
1988 | + for dir |
1989 | + do |
1990 | + libdirs="$libdirs $dir" |
1991 | + done |
1992 | + |
1993 | + for libdir in $libdirs; do |
1994 | + if test -n "$finish_cmds"; then |
1995 | + # Do each command in the finish commands. |
1996 | + func_execute_cmds "$finish_cmds" 'admincmds="$admincmds |
1997 | +'"$cmd"'"' |
1998 | + fi |
1999 | + if test -n "$finish_eval"; then |
2000 | + # Do the single finish_eval. |
2001 | + eval cmds=\"$finish_eval\" |
2002 | + $opt_dry_run || eval "$cmds" || admincmds="$admincmds |
2003 | + $cmds" |
2004 | + fi |
2005 | + done |
2006 | + fi |
2007 | + |
2008 | + # Exit here if they wanted silent mode. |
2009 | + $opt_silent && exit $EXIT_SUCCESS |
2010 | + |
2011 | + echo "----------------------------------------------------------------------" |
2012 | + echo "Libraries have been installed in:" |
2013 | + for libdir in $libdirs; do |
2014 | + $ECHO " $libdir" |
2015 | + done |
2016 | + echo |
2017 | + echo "If you ever happen to want to link against installed libraries" |
2018 | + echo "in a given directory, LIBDIR, you must either use libtool, and" |
2019 | + echo "specify the full pathname of the library, or use the \`-LLIBDIR'" |
2020 | + echo "flag during linking and do at least one of the following:" |
2021 | + if test -n "$shlibpath_var"; then |
2022 | + echo " - add LIBDIR to the \`$shlibpath_var' environment variable" |
2023 | + echo " during execution" |
2024 | + fi |
2025 | + if test -n "$runpath_var"; then |
2026 | + echo " - add LIBDIR to the \`$runpath_var' environment variable" |
2027 | + echo " during linking" |
2028 | + fi |
2029 | + if test -n "$hardcode_libdir_flag_spec"; then |
2030 | + libdir=LIBDIR |
2031 | + eval flag=\"$hardcode_libdir_flag_spec\" |
2032 | + |
2033 | + $ECHO " - use the \`$flag' linker flag" |
2034 | + fi |
2035 | + if test -n "$admincmds"; then |
2036 | + $ECHO " - have your system administrator run these commands:$admincmds" |
2037 | + fi |
2038 | + if test -f /etc/ld.so.conf; then |
2039 | + echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" |
2040 | + fi |
2041 | + echo |
2042 | + |
2043 | + echo "See any operating system documentation about shared libraries for" |
2044 | + case $host in |
2045 | + solaris2.[6789]|solaris2.1[0-9]) |
2046 | + echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" |
2047 | + echo "pages." |
2048 | + ;; |
2049 | + *) |
2050 | + echo "more information, such as the ld(1) and ld.so(8) manual pages." |
2051 | + ;; |
2052 | + esac |
2053 | + echo "----------------------------------------------------------------------" |
2054 | + exit $EXIT_SUCCESS |
2055 | +} |
2056 | + |
2057 | +test "$mode" = finish && func_mode_finish ${1+"$@"} |
2058 | + |
2059 | + |
2060 | +# func_mode_install arg... |
2061 | +func_mode_install () |
2062 | +{ |
2063 | + $opt_debug |
2064 | + # There may be an optional sh(1) argument at the beginning of |
2065 | + # install_prog (especially on Windows NT). |
2066 | + if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || |
2067 | + # Allow the use of GNU shtool's install command. |
2068 | + case $nonopt in *shtool*) :;; *) false;; esac; then |
2069 | + # Aesthetically quote it. |
2070 | + func_quote_for_eval "$nonopt" |
2071 | + install_prog="$func_quote_for_eval_result " |
2072 | + arg=$1 |
2073 | + shift |
2074 | + else |
2075 | + install_prog= |
2076 | + arg=$nonopt |
2077 | + fi |
2078 | + |
2079 | + # The real first argument should be the name of the installation program. |
2080 | + # Aesthetically quote it. |
2081 | + func_quote_for_eval "$arg" |
2082 | + install_prog="$install_prog$func_quote_for_eval_result" |
2083 | + install_shared_prog=$install_prog |
2084 | + case " $install_prog " in |
2085 | + *[\\\ /]cp\ *) install_cp=: ;; |
2086 | + *) install_cp=false ;; |
2087 | + esac |
2088 | + |
2089 | + # We need to accept at least all the BSD install flags. |
2090 | + dest= |
2091 | + files= |
2092 | + opts= |
2093 | + prev= |
2094 | + install_type= |
2095 | + isdir=no |
2096 | + stripme= |
2097 | + no_mode=: |
2098 | + for arg |
2099 | + do |
2100 | + arg2= |
2101 | + if test -n "$dest"; then |
2102 | + files="$files $dest" |
2103 | + dest=$arg |
2104 | + continue |
2105 | + fi |
2106 | + |
2107 | + case $arg in |
2108 | + -d) isdir=yes ;; |
2109 | + -f) |
2110 | + if $install_cp; then :; else |
2111 | + prev=$arg |
2112 | + fi |
2113 | + ;; |
2114 | + -g | -m | -o) |
2115 | + prev=$arg |
2116 | + ;; |
2117 | + -s) |
2118 | + stripme=" -s" |
2119 | + continue |
2120 | + ;; |
2121 | + -*) |
2122 | + ;; |
2123 | + *) |
2124 | + # If the previous option needed an argument, then skip it. |
2125 | + if test -n "$prev"; then |
2126 | + if test "x$prev" = x-m && test -n "$install_override_mode"; then |
2127 | + arg2=$install_override_mode |
2128 | + no_mode=false |
2129 | + fi |
2130 | + prev= |
2131 | + else |
2132 | + dest=$arg |
2133 | + continue |
2134 | + fi |
2135 | + ;; |
2136 | + esac |
2137 | + |
2138 | + # Aesthetically quote the argument. |
2139 | + func_quote_for_eval "$arg" |
2140 | + install_prog="$install_prog $func_quote_for_eval_result" |
2141 | + if test -n "$arg2"; then |
2142 | + func_quote_for_eval "$arg2" |
2143 | + fi |
2144 | + install_shared_prog="$install_shared_prog $func_quote_for_eval_result" |
2145 | + done |
2146 | + |
2147 | + test -z "$install_prog" && \ |
2148 | + func_fatal_help "you must specify an install program" |
2149 | + |
2150 | + test -n "$prev" && \ |
2151 | + func_fatal_help "the \`$prev' option requires an argument" |
2152 | + |
2153 | + if test -n "$install_override_mode" && $no_mode; then |
2154 | + if $install_cp; then :; else |
2155 | + func_quote_for_eval "$install_override_mode" |
2156 | + install_shared_prog="$install_shared_prog -m $func_quote_for_eval_result" |
2157 | + fi |
2158 | + fi |
2159 | + |
2160 | + if test -z "$files"; then |
2161 | + if test -z "$dest"; then |
2162 | + func_fatal_help "no file or destination specified" |
2163 | + else |
2164 | + func_fatal_help "you must specify a destination" |
2165 | + fi |
2166 | + fi |
2167 | + |
2168 | + # Strip any trailing slash from the destination. |
2169 | + func_stripname '' '/' "$dest" |
2170 | + dest=$func_stripname_result |
2171 | + |
2172 | + # Check to see that the destination is a directory. |
2173 | + test -d "$dest" && isdir=yes |
2174 | + if test "$isdir" = yes; then |
2175 | + destdir="$dest" |
2176 | + destname= |
2177 | + else |
2178 | + func_dirname_and_basename "$dest" "" "." |
2179 | + destdir="$func_dirname_result" |
2180 | + destname="$func_basename_result" |
2181 | + |
2182 | + # Not a directory, so check to see that there is only one file specified. |
2183 | + set dummy $files; shift |
2184 | + test "$#" -gt 1 && \ |
2185 | + func_fatal_help "\`$dest' is not a directory" |
2186 | + fi |
2187 | + case $destdir in |
2188 | + [\\/]* | [A-Za-z]:[\\/]*) ;; |
2189 | + *) |
2190 | + for file in $files; do |
2191 | + case $file in |
2192 | + *.lo) ;; |
2193 | + *) |
2194 | + func_fatal_help "\`$destdir' must be an absolute directory name" |
2195 | + ;; |
2196 | + esac |
2197 | + done |
2198 | + ;; |
2199 | + esac |
2200 | + |
2201 | + # This variable tells wrapper scripts just to set variables rather |
2202 | + # than running their programs. |
2203 | + libtool_install_magic="$magic" |
2204 | + |
2205 | + staticlibs= |
2206 | + future_libdirs= |
2207 | + current_libdirs= |
2208 | + for file in $files; do |
2209 | + |
2210 | + # Do each installation. |
2211 | + case $file in |
2212 | + *.$libext) |
2213 | + # Do the static libraries later. |
2214 | + staticlibs="$staticlibs $file" |
2215 | + ;; |
2216 | + |
2217 | + *.la) |
2218 | + # Check to see that this really is a libtool archive. |
2219 | + func_lalib_unsafe_p "$file" \ |
2220 | + || func_fatal_help "\`$file' is not a valid libtool archive" |
2221 | + |
2222 | + library_names= |
2223 | + old_library= |
2224 | + relink_command= |
2225 | + func_source "$file" |
2226 | + |
2227 | + # Add the libdir to current_libdirs if it is the destination. |
2228 | + if test "X$destdir" = "X$libdir"; then |
2229 | + case "$current_libdirs " in |
2230 | + *" $libdir "*) ;; |
2231 | + *) current_libdirs="$current_libdirs $libdir" ;; |
2232 | + esac |
2233 | + else |
2234 | + # Note the libdir as a future libdir. |
2235 | + case "$future_libdirs " in |
2236 | + *" $libdir "*) ;; |
2237 | + *) future_libdirs="$future_libdirs $libdir" ;; |
2238 | + esac |
2239 | + fi |
2240 | + |
2241 | + func_dirname "$file" "/" "" |
2242 | + dir="$func_dirname_result" |
2243 | + dir="$dir$objdir" |
2244 | + |
2245 | + if test -n "$relink_command"; then |
2246 | + # Determine the prefix the user has applied to our future dir. |
2247 | + inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` |
2248 | + |
2249 | + # Don't allow the user to place us outside of our expected |
2250 | + # location b/c this prevents finding dependent libraries that |
2251 | + # are installed to the same prefix. |
2252 | + # At present, this check doesn't affect windows .dll's that |
2253 | + # are installed into $libdir/../bin (currently, that works fine) |
2254 | + # but it's something to keep an eye on. |
2255 | + test "$inst_prefix_dir" = "$destdir" && \ |
2256 | + func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" |
2257 | + |
2258 | + if test -n "$inst_prefix_dir"; then |
2259 | + # Stick the inst_prefix_dir data into the link command. |
2260 | + relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` |
2261 | + else |
2262 | + relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` |
2263 | + fi |
2264 | + |
2265 | + func_warning "relinking \`$file'" |
2266 | + func_show_eval "$relink_command" \ |
2267 | + 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' |
2268 | + fi |
2269 | + |
2270 | + # See the names of the shared library. |
2271 | + set dummy $library_names; shift |
2272 | + if test -n "$1"; then |
2273 | + realname="$1" |
2274 | + shift |
2275 | + |
2276 | + srcname="$realname" |
2277 | + test -n "$relink_command" && srcname="$realname"T |
2278 | + |
2279 | + # Install the shared library and build the symlinks. |
2280 | + func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ |
2281 | + 'exit $?' |
2282 | + tstripme="$stripme" |
2283 | + case $host_os in |
2284 | + cygwin* | mingw* | pw32* | cegcc*) |
2285 | + case $realname in |
2286 | + *.dll.a) |
2287 | + tstripme="" |
2288 | + ;; |
2289 | + esac |
2290 | + ;; |
2291 | + esac |
2292 | + if test -n "$tstripme" && test -n "$striplib"; then |
2293 | + func_show_eval "$striplib $destdir/$realname" 'exit $?' |
2294 | + fi |
2295 | + |
2296 | + if test "$#" -gt 0; then |
2297 | + # Delete the old symlinks, and create new ones. |
2298 | + # Try `ln -sf' first, because the `ln' binary might depend on |
2299 | + # the symlink we replace! Solaris /bin/ln does not understand -f, |
2300 | + # so we also need to try rm && ln -s. |
2301 | + for linkname |
2302 | + do |
2303 | + test "$linkname" != "$realname" \ |
2304 | + && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" |
2305 | + done |
2306 | + fi |
2307 | + |
2308 | + # Do each command in the postinstall commands. |
2309 | + lib="$destdir/$realname" |
2310 | + func_execute_cmds "$postinstall_cmds" 'exit $?' |
2311 | + fi |
2312 | + |
2313 | + # Install the pseudo-library for information purposes. |
2314 | + func_basename "$file" |
2315 | + name="$func_basename_result" |
2316 | + instname="$dir/$name"i |
2317 | + func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' |
2318 | + |
2319 | + # Maybe install the static library, too. |
2320 | + test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" |
2321 | + ;; |
2322 | + |
2323 | + *.lo) |
2324 | + # Install (i.e. copy) a libtool object. |
2325 | + |
2326 | + # Figure out destination file name, if it wasn't already specified. |
2327 | + if test -n "$destname"; then |
2328 | + destfile="$destdir/$destname" |
2329 | + else |
2330 | + func_basename "$file" |
2331 | + destfile="$func_basename_result" |
2332 | + destfile="$destdir/$destfile" |
2333 | + fi |
2334 | + |
2335 | + # Deduce the name of the destination old-style object file. |
2336 | + case $destfile in |
2337 | + *.lo) |
2338 | + func_lo2o "$destfile" |
2339 | + staticdest=$func_lo2o_result |
2340 | + ;; |
2341 | + *.$objext) |
2342 | + staticdest="$destfile" |
2343 | + destfile= |
2344 | + ;; |
2345 | + *) |
2346 | + func_fatal_help "cannot copy a libtool object to \`$destfile'" |
2347 | + ;; |
2348 | + esac |
2349 | + |
2350 | + # Install the libtool object if requested. |
2351 | + test -n "$destfile" && \ |
2352 | + func_show_eval "$install_prog $file $destfile" 'exit $?' |
2353 | + |
2354 | + # Install the old object if enabled. |
2355 | + if test "$build_old_libs" = yes; then |
2356 | + # Deduce the name of the old-style object file. |
2357 | + func_lo2o "$file" |
2358 | + staticobj=$func_lo2o_result |
2359 | + func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' |
2360 | + fi |
2361 | + exit $EXIT_SUCCESS |
2362 | + ;; |
2363 | + |
2364 | + *) |
2365 | + # Figure out destination file name, if it wasn't already specified. |
2366 | + if test -n "$destname"; then |
2367 | + destfile="$destdir/$destname" |
2368 | + else |
2369 | + func_basename "$file" |
2370 | + destfile="$func_basename_result" |
2371 | + destfile="$destdir/$destfile" |
2372 | + fi |
2373 | + |
2374 | + # If the file is missing, and there is a .exe on the end, strip it |
2375 | + # because it is most likely a libtool script we actually want to |
2376 | + # install |
2377 | + stripped_ext="" |
2378 | + case $file in |
2379 | + *.exe) |
2380 | + if test ! -f "$file"; then |
2381 | + func_stripname '' '.exe' "$file" |
2382 | + file=$func_stripname_result |
2383 | + stripped_ext=".exe" |
2384 | + fi |
2385 | + ;; |
2386 | + esac |
2387 | + |
2388 | + # Do a test to see if this is really a libtool program. |
2389 | + case $host in |
2390 | + *cygwin* | *mingw*) |
2391 | + if func_ltwrapper_executable_p "$file"; then |
2392 | + func_ltwrapper_scriptname "$file" |
2393 | + wrapper=$func_ltwrapper_scriptname_result |
2394 | + else |
2395 | + func_stripname '' '.exe' "$file" |
2396 | + wrapper=$func_stripname_result |
2397 | + fi |
2398 | + ;; |
2399 | + *) |
2400 | + wrapper=$file |
2401 | + ;; |
2402 | + esac |
2403 | + if func_ltwrapper_script_p "$wrapper"; then |
2404 | + notinst_deplibs= |
2405 | + relink_command= |
2406 | + |
2407 | + func_source "$wrapper" |
2408 | + |
2409 | + # Check the variables that should have been set. |
2410 | + test -z "$generated_by_libtool_version" && \ |
2411 | + func_fatal_error "invalid libtool wrapper script \`$wrapper'" |
2412 | + |
2413 | + finalize=yes |
2414 | + for lib in $notinst_deplibs; do |
2415 | + # Check to see that each library is installed. |
2416 | + libdir= |
2417 | + if test -f "$lib"; then |
2418 | + func_source "$lib" |
2419 | + fi |
2420 | + libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test |
2421 | + if test -n "$libdir" && test ! -f "$libfile"; then |
2422 | + func_warning "\`$lib' has not been installed in \`$libdir'" |
2423 | + finalize=no |
2424 | + fi |
2425 | + done |
2426 | + |
2427 | + relink_command= |
2428 | + func_source "$wrapper" |
2429 | + |
2430 | + outputname= |
2431 | + if test "$fast_install" = no && test -n "$relink_command"; then |
2432 | + $opt_dry_run || { |
2433 | + if test "$finalize" = yes; then |
2434 | + tmpdir=`func_mktempdir` |
2435 | + func_basename "$file$stripped_ext" |
2436 | + file="$func_basename_result" |
2437 | + outputname="$tmpdir/$file" |
2438 | + # Replace the output file specification. |
2439 | + relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` |
2440 | + |
2441 | + $opt_silent || { |
2442 | + func_quote_for_expand "$relink_command" |
2443 | + eval "func_echo $func_quote_for_expand_result" |
2444 | + } |
2445 | + if eval "$relink_command"; then : |
2446 | + else |
2447 | + func_error "error: relink \`$file' with the above command before installing it" |
2448 | + $opt_dry_run || ${RM}r "$tmpdir" |
2449 | + continue |
2450 | + fi |
2451 | + file="$outputname" |
2452 | + else |
2453 | + func_warning "cannot relink \`$file'" |
2454 | + fi |
2455 | + } |
2456 | + else |
2457 | + # Install the binary that we compiled earlier. |
2458 | + file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` |
2459 | + fi |
2460 | + fi |
2461 | + |
2462 | + # remove .exe since cygwin /usr/bin/install will append another |
2463 | + # one anyway |
2464 | + case $install_prog,$host in |
2465 | + */usr/bin/install*,*cygwin*) |
2466 | + case $file:$destfile in |
2467 | + *.exe:*.exe) |
2468 | + # this is ok |
2469 | + ;; |
2470 | + *.exe:*) |
2471 | + destfile=$destfile.exe |
2472 | + ;; |
2473 | + *:*.exe) |
2474 | + func_stripname '' '.exe' "$destfile" |
2475 | + destfile=$func_stripname_result |
2476 | + ;; |
2477 | + esac |
2478 | + ;; |
2479 | + esac |
2480 | + func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' |
2481 | + $opt_dry_run || if test -n "$outputname"; then |
2482 | + ${RM}r "$tmpdir" |
2483 | + fi |
2484 | + ;; |
2485 | + esac |
2486 | + done |
2487 | + |
2488 | + for file in $staticlibs; do |
2489 | + func_basename "$file" |
2490 | + name="$func_basename_result" |
2491 | + |
2492 | + # Set up the ranlib parameters. |
2493 | + oldlib="$destdir/$name" |
2494 | + |
2495 | + func_show_eval "$install_prog \$file \$oldlib" 'exit $?' |
2496 | + |
2497 | + if test -n "$stripme" && test -n "$old_striplib"; then |
2498 | + func_show_eval "$old_striplib $oldlib" 'exit $?' |
2499 | + fi |
2500 | + |
2501 | + # Do each command in the postinstall commands. |
2502 | + func_execute_cmds "$old_postinstall_cmds" 'exit $?' |
2503 | + done |
2504 | + |
2505 | + test -n "$future_libdirs" && \ |
2506 | + func_warning "remember to run \`$progname --finish$future_libdirs'" |
2507 | + |
2508 | + if test -n "$current_libdirs"; then |
2509 | + # Maybe just do a dry run. |
2510 | + $opt_dry_run && current_libdirs=" -n$current_libdirs" |
2511 | + exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' |
2512 | + else |
2513 | + exit $EXIT_SUCCESS |
2514 | + fi |
2515 | +} |
2516 | + |
2517 | +test "$mode" = install && func_mode_install ${1+"$@"} |
2518 | + |
2519 | + |
2520 | +# func_generate_dlsyms outputname originator pic_p |
2521 | +# Extract symbols from dlprefiles and create ${outputname}S.o with |
2522 | +# a dlpreopen symbol table. |
2523 | +func_generate_dlsyms () |
2524 | +{ |
2525 | + $opt_debug |
2526 | + my_outputname="$1" |
2527 | + my_originator="$2" |
2528 | + my_pic_p="${3-no}" |
2529 | + my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` |
2530 | + my_dlsyms= |
2531 | + |
2532 | + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then |
2533 | + if test -n "$NM" && test -n "$global_symbol_pipe"; then |
2534 | + my_dlsyms="${my_outputname}S.c" |
2535 | + else |
2536 | + func_error "not configured to extract global symbols from dlpreopened files" |
2537 | + fi |
2538 | + fi |
2539 | + |
2540 | + if test -n "$my_dlsyms"; then |
2541 | + case $my_dlsyms in |
2542 | + "") ;; |
2543 | + *.c) |
2544 | + # Discover the nlist of each of the dlfiles. |
2545 | + nlist="$output_objdir/${my_outputname}.nm" |
2546 | + |
2547 | + func_show_eval "$RM $nlist ${nlist}S ${nlist}T" |
2548 | + |
2549 | + # Parse the name list into a source file. |
2550 | + func_verbose "creating $output_objdir/$my_dlsyms" |
2551 | + |
2552 | + $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ |
2553 | +/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ |
2554 | +/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ |
2555 | + |
2556 | +#ifdef __cplusplus |
2557 | +extern \"C\" { |
2558 | +#endif |
2559 | + |
2560 | +#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) |
2561 | +#pragma GCC diagnostic ignored \"-Wstrict-prototypes\" |
2562 | +#endif |
2563 | + |
2564 | +/* External symbol declarations for the compiler. */\ |
2565 | +" |
2566 | + |
2567 | + if test "$dlself" = yes; then |
2568 | + func_verbose "generating symbol list for \`$output'" |
2569 | + |
2570 | + $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" |
2571 | + |
2572 | + # Add our own program objects to the symbol list. |
2573 | + progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` |
2574 | + for progfile in $progfiles; do |
2575 | + func_verbose "extracting global C symbols from \`$progfile'" |
2576 | + $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'" |
2577 | + done |
2578 | + |
2579 | + if test -n "$exclude_expsyms"; then |
2580 | + $opt_dry_run || { |
2581 | + eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' |
2582 | + eval '$MV "$nlist"T "$nlist"' |
2583 | + } |
2584 | + fi |
2585 | + |
2586 | + if test -n "$export_symbols_regex"; then |
2587 | + $opt_dry_run || { |
2588 | + eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' |
2589 | + eval '$MV "$nlist"T "$nlist"' |
2590 | + } |
2591 | + fi |
2592 | + |
2593 | + # Prepare the list of exported symbols |
2594 | + if test -z "$export_symbols"; then |
2595 | + export_symbols="$output_objdir/$outputname.exp" |
2596 | + $opt_dry_run || { |
2597 | + $RM $export_symbols |
2598 | + eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' |
2599 | + case $host in |
2600 | + *cygwin* | *mingw* | *cegcc* ) |
2601 | + eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' |
2602 | + eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' |
2603 | + ;; |
2604 | + esac |
2605 | + } |
2606 | + else |
2607 | + $opt_dry_run || { |
2608 | + eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' |
2609 | + eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' |
2610 | + eval '$MV "$nlist"T "$nlist"' |
2611 | + case $host in |
2612 | + *cygwin* | *mingw* | *cegcc* ) |
2613 | + eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' |
2614 | + eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' |
2615 | + ;; |
2616 | + esac |
2617 | + } |
2618 | + fi |
2619 | + fi |
2620 | + |
2621 | + for dlprefile in $dlprefiles; do |
2622 | + func_verbose "extracting global C symbols from \`$dlprefile'" |
2623 | + func_basename "$dlprefile" |
2624 | + name="$func_basename_result" |
2625 | + $opt_dry_run || { |
2626 | + eval '$ECHO ": $name " >> "$nlist"' |
2627 | + eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'" |
2628 | + } |
2629 | + done |
2630 | + |
2631 | + $opt_dry_run || { |
2632 | + # Make sure we have at least an empty file. |
2633 | + test -f "$nlist" || : > "$nlist" |
2634 | + |
2635 | + if test -n "$exclude_expsyms"; then |
2636 | + $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T |
2637 | + $MV "$nlist"T "$nlist" |
2638 | + fi |
2639 | + |
2640 | + # Try sorting and uniquifying the output. |
2641 | + if $GREP -v "^: " < "$nlist" | |
2642 | + if sort -k 3 </dev/null >/dev/null 2>&1; then |
2643 | + sort -k 3 |
2644 | + else |
2645 | + sort +2 |
2646 | + fi | |
2647 | + uniq > "$nlist"S; then |
2648 | + : |
2649 | + else |
2650 | + $GREP -v "^: " < "$nlist" > "$nlist"S |
2651 | + fi |
2652 | + |
2653 | + if test -f "$nlist"S; then |
2654 | + eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' |
2655 | + else |
2656 | + echo '/* NONE */' >> "$output_objdir/$my_dlsyms" |
2657 | + fi |
2658 | + |
2659 | + echo >> "$output_objdir/$my_dlsyms" "\ |
2660 | + |
2661 | +/* The mapping between symbol names and symbols. */ |
2662 | +typedef struct { |
2663 | + const char *name; |
2664 | + void *address; |
2665 | +} lt_dlsymlist; |
2666 | +" |
2667 | + case $host in |
2668 | + *cygwin* | *mingw* | *cegcc* ) |
2669 | + echo >> "$output_objdir/$my_dlsyms" "\ |
2670 | +/* DATA imports from DLLs on WIN32 con't be const, because |
2671 | + runtime relocations are performed -- see ld's documentation |
2672 | + on pseudo-relocs. */" |
2673 | + lt_dlsym_const= ;; |
2674 | + *osf5*) |
2675 | + echo >> "$output_objdir/$my_dlsyms" "\ |
2676 | +/* This system does not cope well with relocations in const data */" |
2677 | + lt_dlsym_const= ;; |
2678 | + *) |
2679 | + lt_dlsym_const=const ;; |
2680 | + esac |
2681 | + |
2682 | + echo >> "$output_objdir/$my_dlsyms" "\ |
2683 | +extern $lt_dlsym_const lt_dlsymlist |
2684 | +lt_${my_prefix}_LTX_preloaded_symbols[]; |
2685 | +$lt_dlsym_const lt_dlsymlist |
2686 | +lt_${my_prefix}_LTX_preloaded_symbols[] = |
2687 | +{\ |
2688 | + { \"$my_originator\", (void *) 0 }," |
2689 | + |
2690 | + case $need_lib_prefix in |
2691 | + no) |
2692 | + eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" |
2693 | + ;; |
2694 | + *) |
2695 | + eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" |
2696 | + ;; |
2697 | + esac |
2698 | + echo >> "$output_objdir/$my_dlsyms" "\ |
2699 | + {0, (void *) 0} |
2700 | +}; |
2701 | + |
2702 | +/* This works around a problem in FreeBSD linker */ |
2703 | +#ifdef FREEBSD_WORKAROUND |
2704 | +static const void *lt_preloaded_setup() { |
2705 | + return lt_${my_prefix}_LTX_preloaded_symbols; |
2706 | +} |
2707 | +#endif |
2708 | + |
2709 | +#ifdef __cplusplus |
2710 | +} |
2711 | +#endif\ |
2712 | +" |
2713 | + } # !$opt_dry_run |
2714 | + |
2715 | + pic_flag_for_symtable= |
2716 | + case "$compile_command " in |
2717 | + *" -static "*) ;; |
2718 | + *) |
2719 | + case $host in |
2720 | + # compiling the symbol table file with pic_flag works around |
2721 | + # a FreeBSD bug that causes programs to crash when -lm is |
2722 | + # linked before any other PIC object. But we must not use |
2723 | + # pic_flag when linking with -static. The problem exists in |
2724 | + # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. |
2725 | + *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) |
2726 | + pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; |
2727 | + *-*-hpux*) |
2728 | + pic_flag_for_symtable=" $pic_flag" ;; |
2729 | + *) |
2730 | + if test "X$my_pic_p" != Xno; then |
2731 | + pic_flag_for_symtable=" $pic_flag" |
2732 | + fi |
2733 | + ;; |
2734 | + esac |
2735 | + ;; |
2736 | + esac |
2737 | + symtab_cflags= |
2738 | + for arg in $LTCFLAGS; do |
2739 | + case $arg in |
2740 | + -pie | -fpie | -fPIE) ;; |
2741 | + *) symtab_cflags="$symtab_cflags $arg" ;; |
2742 | + esac |
2743 | + done |
2744 | + |
2745 | + # Now compile the dynamic symbol file. |
2746 | + func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' |
2747 | + |
2748 | + # Clean up the generated files. |
2749 | + func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' |
2750 | + |
2751 | + # Transform the symbol file into the correct name. |
2752 | + symfileobj="$output_objdir/${my_outputname}S.$objext" |
2753 | + case $host in |
2754 | + *cygwin* | *mingw* | *cegcc* ) |
2755 | + if test -f "$output_objdir/$my_outputname.def"; then |
2756 | + compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` |
2757 | + finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` |
2758 | + else |
2759 | + compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` |
2760 | + finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` |
2761 | + fi |
2762 | + ;; |
2763 | + *) |
2764 | + compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` |
2765 | + finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` |
2766 | + ;; |
2767 | + esac |
2768 | + ;; |
2769 | + *) |
2770 | + func_fatal_error "unknown suffix for \`$my_dlsyms'" |
2771 | + ;; |
2772 | + esac |
2773 | + else |
2774 | + # We keep going just in case the user didn't refer to |
2775 | + # lt_preloaded_symbols. The linker will fail if global_symbol_pipe |
2776 | + # really was required. |
2777 | + |
2778 | + # Nullify the symbol file. |
2779 | + compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` |
2780 | + finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` |
2781 | + fi |
2782 | +} |
2783 | + |
2784 | +# func_win32_libid arg |
2785 | +# return the library type of file 'arg' |
2786 | +# |
2787 | +# Need a lot of goo to handle *both* DLLs and import libs |
2788 | +# Has to be a shell function in order to 'eat' the argument |
2789 | +# that is supplied when $file_magic_command is called. |
2790 | +# Despite the name, also deal with 64 bit binaries. |
2791 | +func_win32_libid () |
2792 | +{ |
2793 | + $opt_debug |
2794 | + win32_libid_type="unknown" |
2795 | + win32_fileres=`file -L $1 2>/dev/null` |
2796 | + case $win32_fileres in |
2797 | + *ar\ archive\ import\ library*) # definitely import |
2798 | + win32_libid_type="x86 archive import" |
2799 | + ;; |
2800 | + *ar\ archive*) # could be an import, or static |
2801 | + # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. |
2802 | + if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | |
2803 | + $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then |
2804 | + win32_nmres=`eval $NM -f posix -A $1 | |
2805 | + $SED -n -e ' |
2806 | + 1,100{ |
2807 | + / I /{ |
2808 | + s,.*,import, |
2809 | + p |
2810 | + q |
2811 | + } |
2812 | + }'` |
2813 | + case $win32_nmres in |
2814 | + import*) win32_libid_type="x86 archive import";; |
2815 | + *) win32_libid_type="x86 archive static";; |
2816 | + esac |
2817 | + fi |
2818 | + ;; |
2819 | + *DLL*) |
2820 | + win32_libid_type="x86 DLL" |
2821 | + ;; |
2822 | + *executable*) # but shell scripts are "executable" too... |
2823 | + case $win32_fileres in |
2824 | + *MS\ Windows\ PE\ Intel*) |
2825 | + win32_libid_type="x86 DLL" |
2826 | + ;; |
2827 | + esac |
2828 | + ;; |
2829 | + esac |
2830 | + $ECHO "$win32_libid_type" |
2831 | +} |
2832 | + |
2833 | + |
2834 | + |
2835 | +# func_extract_an_archive dir oldlib |
2836 | +func_extract_an_archive () |
2837 | +{ |
2838 | + $opt_debug |
2839 | + f_ex_an_ar_dir="$1"; shift |
2840 | + f_ex_an_ar_oldlib="$1" |
2841 | + if test "$lock_old_archive_extraction" = yes; then |
2842 | + lockfile=$f_ex_an_ar_oldlib.lock |
2843 | + until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do |
2844 | + func_echo "Waiting for $lockfile to be removed" |
2845 | + sleep 2 |
2846 | + done |
2847 | + fi |
2848 | + func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ |
2849 | + 'stat=$?; rm -f "$lockfile"; exit $stat' |
2850 | + if test "$lock_old_archive_extraction" = yes; then |
2851 | + $opt_dry_run || rm -f "$lockfile" |
2852 | + fi |
2853 | + if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then |
2854 | + : |
2855 | + else |
2856 | + func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" |
2857 | + fi |
2858 | +} |
2859 | + |
2860 | + |
2861 | +# func_extract_archives gentop oldlib ... |
2862 | +func_extract_archives () |
2863 | +{ |
2864 | + $opt_debug |
2865 | + my_gentop="$1"; shift |
2866 | + my_oldlibs=${1+"$@"} |
2867 | + my_oldobjs="" |
2868 | + my_xlib="" |
2869 | + my_xabs="" |
2870 | + my_xdir="" |
2871 | + |
2872 | + for my_xlib in $my_oldlibs; do |
2873 | + # Extract the objects. |
2874 | + case $my_xlib in |
2875 | + [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; |
2876 | + *) my_xabs=`pwd`"/$my_xlib" ;; |
2877 | + esac |
2878 | + func_basename "$my_xlib" |
2879 | + my_xlib="$func_basename_result" |
2880 | + my_xlib_u=$my_xlib |
2881 | + while :; do |
2882 | + case " $extracted_archives " in |
2883 | + *" $my_xlib_u "*) |
2884 | + func_arith $extracted_serial + 1 |
2885 | + extracted_serial=$func_arith_result |
2886 | + my_xlib_u=lt$extracted_serial-$my_xlib ;; |
2887 | + *) break ;; |
2888 | + esac |
2889 | + done |
2890 | + extracted_archives="$extracted_archives $my_xlib_u" |
2891 | + my_xdir="$my_gentop/$my_xlib_u" |
2892 | + |
2893 | + func_mkdir_p "$my_xdir" |
2894 | + |
2895 | + case $host in |
2896 | + *-darwin*) |
2897 | + func_verbose "Extracting $my_xabs" |
2898 | + # Do not bother doing anything if just a dry run |
2899 | + $opt_dry_run || { |
2900 | + darwin_orig_dir=`pwd` |
2901 | + cd $my_xdir || exit $? |
2902 | + darwin_archive=$my_xabs |
2903 | + darwin_curdir=`pwd` |
2904 | + darwin_base_archive=`basename "$darwin_archive"` |
2905 | + darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` |
2906 | + if test -n "$darwin_arches"; then |
2907 | + darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` |
2908 | + darwin_arch= |
2909 | + func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" |
2910 | + for darwin_arch in $darwin_arches ; do |
2911 | + func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" |
2912 | + $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" |
2913 | + cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" |
2914 | + func_extract_an_archive "`pwd`" "${darwin_base_archive}" |
2915 | + cd "$darwin_curdir" |
2916 | + $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" |
2917 | + done # $darwin_arches |
2918 | + ## Okay now we've a bunch of thin objects, gotta fatten them up :) |
2919 | + darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` |
2920 | + darwin_file= |
2921 | + darwin_files= |
2922 | + for darwin_file in $darwin_filelist; do |
2923 | + darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` |
2924 | + $LIPO -create -output "$darwin_file" $darwin_files |
2925 | + done # $darwin_filelist |
2926 | + $RM -rf unfat-$$ |
2927 | + cd "$darwin_orig_dir" |
2928 | + else |
2929 | + cd $darwin_orig_dir |
2930 | + func_extract_an_archive "$my_xdir" "$my_xabs" |
2931 | + fi # $darwin_arches |
2932 | + } # !$opt_dry_run |
2933 | + ;; |
2934 | + *) |
2935 | + func_extract_an_archive "$my_xdir" "$my_xabs" |
2936 | + ;; |
2937 | + esac |
2938 | + my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` |
2939 | + done |
2940 | + |
2941 | + func_extract_archives_result="$my_oldobjs" |
2942 | +} |
2943 | + |
2944 | + |
2945 | +# func_emit_wrapper [arg=no] |
2946 | +# |
2947 | +# Emit a libtool wrapper script on stdout. |
2948 | +# Don't directly open a file because we may want to |
2949 | +# incorporate the script contents within a cygwin/mingw |
2950 | +# wrapper executable. Must ONLY be called from within |
2951 | +# func_mode_link because it depends on a number of variables |
2952 | +# set therein. |
2953 | +# |
2954 | +# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR |
2955 | +# variable will take. If 'yes', then the emitted script |
2956 | +# will assume that the directory in which it is stored is |
2957 | +# the $objdir directory. This is a cygwin/mingw-specific |
2958 | +# behavior. |
2959 | +func_emit_wrapper () |
2960 | +{ |
2961 | + func_emit_wrapper_arg1=${1-no} |
2962 | + |
2963 | + $ECHO "\ |
2964 | +#! $SHELL |
2965 | + |
2966 | +# $output - temporary wrapper script for $objdir/$outputname |
2967 | +# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION |
2968 | +# |
2969 | +# The $output program cannot be directly executed until all the libtool |
2970 | +# libraries that it depends on are installed. |
2971 | +# |
2972 | +# This wrapper script should never be moved out of the build directory. |
2973 | +# If it is, it will not operate correctly. |
2974 | + |
2975 | +# Sed substitution that helps us do robust quoting. It backslashifies |
2976 | +# metacharacters that are still active within double-quoted strings. |
2977 | +sed_quote_subst='$sed_quote_subst' |
2978 | + |
2979 | +# Be Bourne compatible |
2980 | +if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then |
2981 | + emulate sh |
2982 | + NULLCMD=: |
2983 | + # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which |
2984 | + # is contrary to our usage. Disable this feature. |
2985 | + alias -g '\${1+\"\$@\"}'='\"\$@\"' |
2986 | + setopt NO_GLOB_SUBST |
2987 | +else |
2988 | + case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac |
2989 | +fi |
2990 | +BIN_SH=xpg4; export BIN_SH # for Tru64 |
2991 | +DUALCASE=1; export DUALCASE # for MKS sh |
2992 | + |
2993 | +# The HP-UX ksh and POSIX shell print the target directory to stdout |
2994 | +# if CDPATH is set. |
2995 | +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH |
2996 | + |
2997 | +relink_command=\"$relink_command\" |
2998 | + |
2999 | +# This environment variable determines our operation mode. |
3000 | +if test \"\$libtool_install_magic\" = \"$magic\"; then |
3001 | + # install mode needs the following variables: |
3002 | + generated_by_libtool_version='$macro_version' |
3003 | + notinst_deplibs='$notinst_deplibs' |
3004 | +else |
3005 | + # When we are sourced in execute mode, \$file and \$ECHO are already set. |
3006 | + if test \"\$libtool_execute_magic\" != \"$magic\"; then |
3007 | + file=\"\$0\"" |
3008 | + |
3009 | + qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` |
3010 | + $ECHO "\ |
3011 | + |
3012 | +# A function that is used when there is no print builtin or printf. |
3013 | +func_fallback_echo () |
3014 | +{ |
3015 | + eval 'cat <<_LTECHO_EOF |
3016 | +\$1 |
3017 | +_LTECHO_EOF' |
3018 | +} |
3019 | + ECHO=\"$qECHO\" |
3020 | + fi |
3021 | + |
3022 | +# Very basic option parsing. These options are (a) specific to |
3023 | +# the libtool wrapper, (b) are identical between the wrapper |
3024 | +# /script/ and the wrapper /executable/ which is used only on |
3025 | +# windows platforms, and (c) all begin with the string "--lt-" |
3026 | +# (application programs are unlikely to have options which match |
3027 | +# this pattern). |
3028 | +# |
3029 | +# There are only two supported options: --lt-debug and |
3030 | +# --lt-dump-script. There is, deliberately, no --lt-help. |
3031 | +# |
3032 | +# The first argument to this parsing function should be the |
3033 | +# script's $0 value, followed by "$@". |
3034 | +lt_option_debug= |
3035 | +func_parse_lt_options () |
3036 | +{ |
3037 | + lt_script_arg0=\$0 |
3038 | + shift |
3039 | + for lt_opt |
3040 | + do |
3041 | + case \"\$lt_opt\" in |
3042 | + --lt-debug) lt_option_debug=1 ;; |
3043 | + --lt-dump-script) |
3044 | + lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` |
3045 | + test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. |
3046 | + lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` |
3047 | + cat \"\$lt_dump_D/\$lt_dump_F\" |
3048 | + exit 0 |
3049 | + ;; |
3050 | + --lt-*) |
3051 | + \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 |
3052 | + exit 1 |
3053 | + ;; |
3054 | + esac |
3055 | + done |
3056 | + |
3057 | + # Print the debug banner immediately: |
3058 | + if test -n \"\$lt_option_debug\"; then |
3059 | + echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2 |
3060 | + fi |
3061 | +} |
3062 | + |
3063 | +# Used when --lt-debug. Prints its arguments to stdout |
3064 | +# (redirection is the responsibility of the caller) |
3065 | +func_lt_dump_args () |
3066 | +{ |
3067 | + lt_dump_args_N=1; |
3068 | + for lt_arg |
3069 | + do |
3070 | + \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\" |
3071 | + lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` |
3072 | + done |
3073 | +} |
3074 | + |
3075 | +# Core function for launching the target application |
3076 | +func_exec_program_core () |
3077 | +{ |
3078 | +" |
3079 | + case $host in |
3080 | + # Backslashes separate directories on plain windows |
3081 | + *-*-mingw | *-*-os2* | *-cegcc*) |
3082 | + $ECHO "\ |
3083 | + if test -n \"\$lt_option_debug\"; then |
3084 | + \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2 |
3085 | + func_lt_dump_args \${1+\"\$@\"} 1>&2 |
3086 | + fi |
3087 | + exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} |
3088 | +" |
3089 | + ;; |
3090 | + |
3091 | + *) |
3092 | + $ECHO "\ |
3093 | + if test -n \"\$lt_option_debug\"; then |
3094 | + \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2 |
3095 | + func_lt_dump_args \${1+\"\$@\"} 1>&2 |
3096 | + fi |
3097 | + exec \"\$progdir/\$program\" \${1+\"\$@\"} |
3098 | +" |
3099 | + ;; |
3100 | + esac |
3101 | + $ECHO "\ |
3102 | + \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 |
3103 | + exit 1 |
3104 | +} |
3105 | + |
3106 | +# A function to encapsulate launching the target application |
3107 | +# Strips options in the --lt-* namespace from \$@ and |
3108 | +# launches target application with the remaining arguments. |
3109 | +func_exec_program () |
3110 | +{ |
3111 | + for lt_wr_arg |
3112 | + do |
3113 | + case \$lt_wr_arg in |
3114 | + --lt-*) ;; |
3115 | + *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; |
3116 | + esac |
3117 | + shift |
3118 | + done |
3119 | + func_exec_program_core \${1+\"\$@\"} |
3120 | +} |
3121 | + |
3122 | + # Parse options |
3123 | + func_parse_lt_options \"\$0\" \${1+\"\$@\"} |
3124 | + |
3125 | + # Find the directory that this script lives in. |
3126 | + thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` |
3127 | + test \"x\$thisdir\" = \"x\$file\" && thisdir=. |
3128 | + |
3129 | + # Follow symbolic links until we get to the real thisdir. |
3130 | + file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` |
3131 | + while test -n \"\$file\"; do |
3132 | + destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` |
3133 | + |
3134 | + # If there was a directory component, then change thisdir. |
3135 | + if test \"x\$destdir\" != \"x\$file\"; then |
3136 | + case \"\$destdir\" in |
3137 | + [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; |
3138 | + *) thisdir=\"\$thisdir/\$destdir\" ;; |
3139 | + esac |
3140 | + fi |
3141 | + |
3142 | + file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` |
3143 | + file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` |
3144 | + done |
3145 | + |
3146 | + # Usually 'no', except on cygwin/mingw when embedded into |
3147 | + # the cwrapper. |
3148 | + WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 |
3149 | + if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then |
3150 | + # special case for '.' |
3151 | + if test \"\$thisdir\" = \".\"; then |
3152 | + thisdir=\`pwd\` |
3153 | + fi |
3154 | + # remove .libs from thisdir |
3155 | + case \"\$thisdir\" in |
3156 | + *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; |
3157 | + $objdir ) thisdir=. ;; |
3158 | + esac |
3159 | + fi |
3160 | + |
3161 | + # Try to get the absolute directory name. |
3162 | + absdir=\`cd \"\$thisdir\" && pwd\` |
3163 | + test -n \"\$absdir\" && thisdir=\"\$absdir\" |
3164 | +" |
3165 | + |
3166 | + if test "$fast_install" = yes; then |
3167 | + $ECHO "\ |
3168 | + program=lt-'$outputname'$exeext |
3169 | + progdir=\"\$thisdir/$objdir\" |
3170 | + |
3171 | + if test ! -f \"\$progdir/\$program\" || |
3172 | + { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ |
3173 | + test \"X\$file\" != \"X\$progdir/\$program\"; }; then |
3174 | + |
3175 | + file=\"\$\$-\$program\" |
3176 | + |
3177 | + if test ! -d \"\$progdir\"; then |
3178 | + $MKDIR \"\$progdir\" |
3179 | + else |
3180 | + $RM \"\$progdir/\$file\" |
3181 | + fi" |
3182 | + |
3183 | + $ECHO "\ |
3184 | + |
3185 | + # relink executable if necessary |
3186 | + if test -n \"\$relink_command\"; then |
3187 | + if relink_command_output=\`eval \$relink_command 2>&1\`; then : |
3188 | + else |
3189 | + $ECHO \"\$relink_command_output\" >&2 |
3190 | + $RM \"\$progdir/\$file\" |
3191 | + exit 1 |
3192 | + fi |
3193 | + fi |
3194 | + |
3195 | + $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || |
3196 | + { $RM \"\$progdir/\$program\"; |
3197 | + $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } |
3198 | + $RM \"\$progdir/\$file\" |
3199 | + fi" |
3200 | + else |
3201 | + $ECHO "\ |
3202 | + program='$outputname' |
3203 | + progdir=\"\$thisdir/$objdir\" |
3204 | +" |
3205 | + fi |
3206 | + |
3207 | + $ECHO "\ |
3208 | + |
3209 | + if test -f \"\$progdir/\$program\"; then" |
3210 | + |
3211 | + # Export our shlibpath_var if we have one. |
3212 | + if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then |
3213 | + $ECHO "\ |
3214 | + # Add our own library path to $shlibpath_var |
3215 | + $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" |
3216 | + |
3217 | + # Some systems cannot cope with colon-terminated $shlibpath_var |
3218 | + # The second colon is a workaround for a bug in BeOS R4 sed |
3219 | + $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` |
3220 | + |
3221 | + export $shlibpath_var |
3222 | +" |
3223 | + fi |
3224 | + |
3225 | + # fixup the dll searchpath if we need to. |
3226 | + if test -n "$dllsearchpath"; then |
3227 | + $ECHO "\ |
3228 | + # Add the dll search path components to the executable PATH |
3229 | + PATH=$dllsearchpath:\$PATH |
3230 | +" |
3231 | + fi |
3232 | + |
3233 | + $ECHO "\ |
3234 | + if test \"\$libtool_execute_magic\" != \"$magic\"; then |
3235 | + # Run the actual program with our arguments. |
3236 | + func_exec_program \${1+\"\$@\"} |
3237 | + fi |
3238 | + else |
3239 | + # The program doesn't exist. |
3240 | + \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 |
3241 | + \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 |
3242 | + \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 |
3243 | + exit 1 |
3244 | + fi |
3245 | +fi\ |
3246 | +" |
3247 | +} |
3248 | + |
3249 | + |
3250 | +# func_to_host_path arg |
3251 | +# |
3252 | +# Convert paths to host format when used with build tools. |
3253 | +# Intended for use with "native" mingw (where libtool itself |
3254 | +# is running under the msys shell), or in the following cross- |
3255 | +# build environments: |
3256 | +# $build $host |
3257 | +# mingw (msys) mingw [e.g. native] |
3258 | +# cygwin mingw |
3259 | +# *nix + wine mingw |
3260 | +# where wine is equipped with the `winepath' executable. |
3261 | +# In the native mingw case, the (msys) shell automatically |
3262 | +# converts paths for any non-msys applications it launches, |
3263 | +# but that facility isn't available from inside the cwrapper. |
3264 | +# Similar accommodations are necessary for $host mingw and |
3265 | +# $build cygwin. Calling this function does no harm for other |
3266 | +# $host/$build combinations not listed above. |
3267 | +# |
3268 | +# ARG is the path (on $build) that should be converted to |
3269 | +# the proper representation for $host. The result is stored |
3270 | +# in $func_to_host_path_result. |
3271 | +func_to_host_path () |
3272 | +{ |
3273 | + func_to_host_path_result="$1" |
3274 | + if test -n "$1"; then |
3275 | + case $host in |
3276 | + *mingw* ) |
3277 | + lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' |
3278 | + case $build in |
3279 | + *mingw* ) # actually, msys |
3280 | + # awkward: cmd appends spaces to result |
3281 | + func_to_host_path_result=`( cmd //c echo "$1" ) 2>/dev/null | |
3282 | + $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` |
3283 | + ;; |
3284 | + *cygwin* ) |
3285 | + func_to_host_path_result=`cygpath -w "$1" | |
3286 | + $SED -e "$lt_sed_naive_backslashify"` |
3287 | + ;; |
3288 | + * ) |
3289 | + # Unfortunately, winepath does not exit with a non-zero |
3290 | + # error code, so we are forced to check the contents of |
3291 | + # stdout. On the other hand, if the command is not |
3292 | + # found, the shell will set an exit code of 127 and print |
3293 | + # *an error message* to stdout. So we must check for both |
3294 | + # error code of zero AND non-empty stdout, which explains |
3295 | + # the odd construction: |
3296 | + func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null` |
3297 | + if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then |
3298 | + func_to_host_path_result=`$ECHO "$func_to_host_path_tmp1" | |
3299 | + $SED -e "$lt_sed_naive_backslashify"` |
3300 | + else |
3301 | + # Allow warning below. |
3302 | + func_to_host_path_result= |
3303 | + fi |
3304 | + ;; |
3305 | + esac |
3306 | + if test -z "$func_to_host_path_result" ; then |
3307 | + func_error "Could not determine host path corresponding to" |
3308 | + func_error " \`$1'" |
3309 | + func_error "Continuing, but uninstalled executables may not work." |
3310 | + # Fallback: |
3311 | + func_to_host_path_result="$1" |
3312 | + fi |
3313 | + ;; |
3314 | + esac |
3315 | + fi |
3316 | +} |
3317 | +# end: func_to_host_path |
3318 | + |
3319 | +# func_to_host_pathlist arg |
3320 | +# |
3321 | +# Convert pathlists to host format when used with build tools. |
3322 | +# See func_to_host_path(), above. This function supports the |
3323 | +# following $build/$host combinations (but does no harm for |
3324 | +# combinations not listed here): |
3325 | +# $build $host |
3326 | +# mingw (msys) mingw [e.g. native] |
3327 | +# cygwin mingw |
3328 | +# *nix + wine mingw |
3329 | +# |
3330 | +# Path separators are also converted from $build format to |
3331 | +# $host format. If ARG begins or ends with a path separator |
3332 | +# character, it is preserved (but converted to $host format) |
3333 | +# on output. |
3334 | +# |
3335 | +# ARG is a pathlist (on $build) that should be converted to |
3336 | +# the proper representation on $host. The result is stored |
3337 | +# in $func_to_host_pathlist_result. |
3338 | +func_to_host_pathlist () |
3339 | +{ |
3340 | + func_to_host_pathlist_result="$1" |
3341 | + if test -n "$1"; then |
3342 | + case $host in |
3343 | + *mingw* ) |
3344 | + lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' |
3345 | + # Remove leading and trailing path separator characters from |
3346 | + # ARG. msys behavior is inconsistent here, cygpath turns them |
3347 | + # into '.;' and ';.', and winepath ignores them completely. |
3348 | + func_stripname : : "$1" |
3349 | + func_to_host_pathlist_tmp1=$func_stripname_result |
3350 | + case $build in |
3351 | + *mingw* ) # Actually, msys. |
3352 | + # Awkward: cmd appends spaces to result. |
3353 | + func_to_host_pathlist_result=` |
3354 | + ( cmd //c echo "$func_to_host_pathlist_tmp1" ) 2>/dev/null | |
3355 | + $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` |
3356 | + ;; |
3357 | + *cygwin* ) |
3358 | + func_to_host_pathlist_result=`cygpath -w -p "$func_to_host_pathlist_tmp1" | |
3359 | + $SED -e "$lt_sed_naive_backslashify"` |
3360 | + ;; |
3361 | + * ) |
3362 | + # unfortunately, winepath doesn't convert pathlists |
3363 | + func_to_host_pathlist_result="" |
3364 | + func_to_host_pathlist_oldIFS=$IFS |
3365 | + IFS=: |
3366 | + for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do |
3367 | + IFS=$func_to_host_pathlist_oldIFS |
3368 | + if test -n "$func_to_host_pathlist_f" ; then |
3369 | + func_to_host_path "$func_to_host_pathlist_f" |
3370 | + if test -n "$func_to_host_path_result" ; then |
3371 | + if test -z "$func_to_host_pathlist_result" ; then |
3372 | + func_to_host_pathlist_result="$func_to_host_path_result" |
3373 | + else |
3374 | + func_append func_to_host_pathlist_result ";$func_to_host_path_result" |
3375 | + fi |
3376 | + fi |
3377 | + fi |
3378 | + done |
3379 | + IFS=$func_to_host_pathlist_oldIFS |
3380 | + ;; |
3381 | + esac |
3382 | + if test -z "$func_to_host_pathlist_result"; then |
3383 | + func_error "Could not determine the host path(s) corresponding to" |
3384 | + func_error " \`$1'" |
3385 | + func_error "Continuing, but uninstalled executables may not work." |
3386 | + # Fallback. This may break if $1 contains DOS-style drive |
3387 | + # specifications. The fix is not to complicate the expression |
3388 | + # below, but for the user to provide a working wine installation |
3389 | + # with winepath so that path translation in the cross-to-mingw |
3390 | + # case works properly. |
3391 | + lt_replace_pathsep_nix_to_dos="s|:|;|g" |
3392 | + func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\ |
3393 | + $SED -e "$lt_replace_pathsep_nix_to_dos"` |
3394 | + fi |
3395 | + # Now, add the leading and trailing path separators back |
3396 | + case "$1" in |
3397 | + :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result" |
3398 | + ;; |
3399 | + esac |
3400 | + case "$1" in |
3401 | + *: ) func_append func_to_host_pathlist_result ";" |
3402 | + ;; |
3403 | + esac |
3404 | + ;; |
3405 | + esac |
3406 | + fi |
3407 | +} |
3408 | +# end: func_to_host_pathlist |
3409 | + |
3410 | +# func_emit_cwrapperexe_src |
3411 | +# emit the source code for a wrapper executable on stdout |
3412 | +# Must ONLY be called from within func_mode_link because |
3413 | +# it depends on a number of variable set therein. |
3414 | +func_emit_cwrapperexe_src () |
3415 | +{ |
3416 | + cat <<EOF |
3417 | + |
3418 | +/* $cwrappersource - temporary wrapper executable for $objdir/$outputname |
3419 | + Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION |
3420 | + |
3421 | + The $output program cannot be directly executed until all the libtool |
3422 | + libraries that it depends on are installed. |
3423 | + |
3424 | + This wrapper executable should never be moved out of the build directory. |
3425 | + If it is, it will not operate correctly. |
3426 | +*/ |
3427 | +EOF |
3428 | + cat <<"EOF" |
3429 | +#ifdef _MSC_VER |
3430 | +# define _CRT_SECURE_NO_DEPRECATE 1 |
3431 | +#endif |
3432 | +#include <stdio.h> |
3433 | +#include <stdlib.h> |
3434 | +#ifdef _MSC_VER |
3435 | +# include <direct.h> |
3436 | +# include <process.h> |
3437 | +# include <io.h> |
3438 | +#else |
3439 | +# include <unistd.h> |
3440 | +# include <stdint.h> |
3441 | +# ifdef __CYGWIN__ |
3442 | +# include <io.h> |
3443 | +# endif |
3444 | +#endif |
3445 | +#include <malloc.h> |
3446 | +#include <stdarg.h> |
3447 | +#include <assert.h> |
3448 | +#include <string.h> |
3449 | +#include <ctype.h> |
3450 | +#include <errno.h> |
3451 | +#include <fcntl.h> |
3452 | +#include <sys/stat.h> |
3453 | + |
3454 | +/* declarations of non-ANSI functions */ |
3455 | +#if defined(__MINGW32__) |
3456 | +# ifdef __STRICT_ANSI__ |
3457 | +int _putenv (const char *); |
3458 | +# endif |
3459 | +#elif defined(__CYGWIN__) |
3460 | +# ifdef __STRICT_ANSI__ |
3461 | +char *realpath (const char *, char *); |
3462 | +int putenv (char *); |
3463 | +int setenv (const char *, const char *, int); |
3464 | +# endif |
3465 | +/* #elif defined (other platforms) ... */ |
3466 | +#endif |
3467 | + |
3468 | +/* portability defines, excluding path handling macros */ |
3469 | +#if defined(_MSC_VER) |
3470 | +# define setmode _setmode |
3471 | +# define stat _stat |
3472 | +# define chmod _chmod |
3473 | +# define getcwd _getcwd |
3474 | +# define putenv _putenv |
3475 | +# define S_IXUSR _S_IEXEC |
3476 | +# ifndef _INTPTR_T_DEFINED |
3477 | +# define _INTPTR_T_DEFINED |
3478 | +# define intptr_t int |
3479 | +# endif |
3480 | +#elif defined(__MINGW32__) |
3481 | +# define setmode _setmode |
3482 | +# define stat _stat |
3483 | +# define chmod _chmod |
3484 | +# define getcwd _getcwd |
3485 | +# define putenv _putenv |
3486 | +#elif defined(__CYGWIN__) |
3487 | +# define HAVE_SETENV |
3488 | +# define FOPEN_WB "wb" |
3489 | +/* #elif defined (other platforms) ... */ |
3490 | +#endif |
3491 | + |
3492 | +#if defined(PATH_MAX) |
3493 | +# define LT_PATHMAX PATH_MAX |
3494 | +#elif defined(MAXPATHLEN) |
3495 | +# define LT_PATHMAX MAXPATHLEN |
3496 | +#else |
3497 | +# define LT_PATHMAX 1024 |
3498 | +#endif |
3499 | + |
3500 | +#ifndef S_IXOTH |
3501 | +# define S_IXOTH 0 |
3502 | +#endif |
3503 | +#ifndef S_IXGRP |
3504 | +# define S_IXGRP 0 |
3505 | +#endif |
3506 | + |
3507 | +/* path handling portability macros */ |
3508 | +#ifndef DIR_SEPARATOR |
3509 | +# define DIR_SEPARATOR '/' |
3510 | +# define PATH_SEPARATOR ':' |
3511 | +#endif |
3512 | + |
3513 | +#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ |
3514 | + defined (__OS2__) |
3515 | +# define HAVE_DOS_BASED_FILE_SYSTEM |
3516 | +# define FOPEN_WB "wb" |
3517 | +# ifndef DIR_SEPARATOR_2 |
3518 | +# define DIR_SEPARATOR_2 '\\' |
3519 | +# endif |
3520 | +# ifndef PATH_SEPARATOR_2 |
3521 | +# define PATH_SEPARATOR_2 ';' |
3522 | +# endif |
3523 | +#endif |
3524 | + |
3525 | +#ifndef DIR_SEPARATOR_2 |
3526 | +# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) |
3527 | +#else /* DIR_SEPARATOR_2 */ |
3528 | +# define IS_DIR_SEPARATOR(ch) \ |
3529 | + (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) |
3530 | +#endif /* DIR_SEPARATOR_2 */ |
3531 | + |
3532 | +#ifndef PATH_SEPARATOR_2 |
3533 | +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) |
3534 | +#else /* PATH_SEPARATOR_2 */ |
3535 | +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) |
3536 | +#endif /* PATH_SEPARATOR_2 */ |
3537 | + |
3538 | +#ifndef FOPEN_WB |
3539 | +# define FOPEN_WB "w" |
3540 | +#endif |
3541 | +#ifndef _O_BINARY |
3542 | +# define _O_BINARY 0 |
3543 | +#endif |
3544 | + |
3545 | +#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) |
3546 | +#define XFREE(stale) do { \ |
3547 | + if (stale) { free ((void *) stale); stale = 0; } \ |
3548 | +} while (0) |
3549 | + |
3550 | +#if defined(LT_DEBUGWRAPPER) |
3551 | +static int lt_debug = 1; |
3552 | +#else |
3553 | +static int lt_debug = 0; |
3554 | +#endif |
3555 | + |
3556 | +const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ |
3557 | + |
3558 | +void *xmalloc (size_t num); |
3559 | +char *xstrdup (const char *string); |
3560 | +const char *base_name (const char *name); |
3561 | +char *find_executable (const char *wrapper); |
3562 | +char *chase_symlinks (const char *pathspec); |
3563 | +int make_executable (const char *path); |
3564 | +int check_executable (const char *path); |
3565 | +char *strendzap (char *str, const char *pat); |
3566 | +void lt_debugprintf (const char *file, int line, const char *fmt, ...); |
3567 | +void lt_fatal (const char *file, int line, const char *message, ...); |
3568 | +static const char *nonnull (const char *s); |
3569 | +static const char *nonempty (const char *s); |
3570 | +void lt_setenv (const char *name, const char *value); |
3571 | +char *lt_extend_str (const char *orig_value, const char *add, int to_end); |
3572 | +void lt_update_exe_path (const char *name, const char *value); |
3573 | +void lt_update_lib_path (const char *name, const char *value); |
3574 | +char **prepare_spawn (char **argv); |
3575 | +void lt_dump_script (FILE *f); |
3576 | +EOF |
3577 | + |
3578 | + cat <<EOF |
3579 | +const char * MAGIC_EXE = "$magic_exe"; |
3580 | +const char * LIB_PATH_VARNAME = "$shlibpath_var"; |
3581 | +EOF |
3582 | + |
3583 | + if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then |
3584 | + func_to_host_pathlist "$temp_rpath" |
3585 | + cat <<EOF |
3586 | +const char * LIB_PATH_VALUE = "$func_to_host_pathlist_result"; |
3587 | +EOF |
3588 | + else |
3589 | + cat <<"EOF" |
3590 | +const char * LIB_PATH_VALUE = ""; |
3591 | +EOF |
3592 | + fi |
3593 | + |
3594 | + if test -n "$dllsearchpath"; then |
3595 | + func_to_host_pathlist "$dllsearchpath:" |
3596 | + cat <<EOF |
3597 | +const char * EXE_PATH_VARNAME = "PATH"; |
3598 | +const char * EXE_PATH_VALUE = "$func_to_host_pathlist_result"; |
3599 | +EOF |
3600 | + else |
3601 | + cat <<"EOF" |
3602 | +const char * EXE_PATH_VARNAME = ""; |
3603 | +const char * EXE_PATH_VALUE = ""; |
3604 | +EOF |
3605 | + fi |
3606 | + |
3607 | + if test "$fast_install" = yes; then |
3608 | + cat <<EOF |
3609 | +const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */ |
3610 | +EOF |
3611 | + else |
3612 | + cat <<EOF |
3613 | +const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */ |
3614 | +EOF |
3615 | + fi |
3616 | + |
3617 | + |
3618 | + cat <<"EOF" |
3619 | + |
3620 | +#define LTWRAPPER_OPTION_PREFIX "--lt-" |
3621 | + |
3622 | +static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX; |
3623 | +static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script"; |
3624 | +static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug"; |
3625 | + |
3626 | +int |
3627 | +main (int argc, char *argv[]) |
3628 | +{ |
3629 | + char **newargz; |
3630 | + int newargc; |
3631 | + char *tmp_pathspec; |
3632 | + char *actual_cwrapper_path; |
3633 | + char *actual_cwrapper_name; |
3634 | + char *target_name; |
3635 | + char *lt_argv_zero; |
3636 | + intptr_t rval = 127; |
3637 | + |
3638 | + int i; |
3639 | + |
3640 | + program_name = (char *) xstrdup (base_name (argv[0])); |
3641 | + newargz = XMALLOC (char *, argc + 1); |
3642 | + |
3643 | + /* very simple arg parsing; don't want to rely on getopt |
3644 | + * also, copy all non cwrapper options to newargz, except |
3645 | + * argz[0], which is handled differently |
3646 | + */ |
3647 | + newargc=0; |
3648 | + for (i = 1; i < argc; i++) |
3649 | + { |
3650 | + if (strcmp (argv[i], dumpscript_opt) == 0) |
3651 | + { |
3652 | +EOF |
3653 | + case "$host" in |
3654 | + *mingw* | *cygwin* ) |
3655 | + # make stdout use "unix" line endings |
3656 | + echo " setmode(1,_O_BINARY);" |
3657 | + ;; |
3658 | + esac |
3659 | + |
3660 | + cat <<"EOF" |
3661 | + lt_dump_script (stdout); |
3662 | + return 0; |
3663 | + } |
3664 | + if (strcmp (argv[i], debug_opt) == 0) |
3665 | + { |
3666 | + lt_debug = 1; |
3667 | + continue; |
3668 | + } |
3669 | + if (strcmp (argv[i], ltwrapper_option_prefix) == 0) |
3670 | + { |
3671 | + /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX |
3672 | + namespace, but it is not one of the ones we know about and |
3673 | + have already dealt with, above (inluding dump-script), then |
3674 | + report an error. Otherwise, targets might begin to believe |
3675 | + they are allowed to use options in the LTWRAPPER_OPTION_PREFIX |
3676 | + namespace. The first time any user complains about this, we'll |
3677 | + need to make LTWRAPPER_OPTION_PREFIX a configure-time option |
3678 | + or a configure.ac-settable value. |
3679 | + */ |
3680 | + lt_fatal (__FILE__, __LINE__, |
3681 | + "unrecognized %s option: '%s'", |
3682 | + ltwrapper_option_prefix, argv[i]); |
3683 | + } |
3684 | + /* otherwise ... */ |
3685 | + newargz[++newargc] = xstrdup (argv[i]); |
3686 | + } |
3687 | + newargz[++newargc] = NULL; |
3688 | + |
3689 | +EOF |
3690 | + cat <<EOF |
3691 | + /* The GNU banner must be the first non-error debug message */ |
3692 | + lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n"); |
3693 | +EOF |
3694 | + cat <<"EOF" |
3695 | + lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]); |
3696 | + lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name); |
3697 | + |
3698 | + tmp_pathspec = find_executable (argv[0]); |
3699 | + if (tmp_pathspec == NULL) |
3700 | + lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]); |
3701 | + lt_debugprintf (__FILE__, __LINE__, |
3702 | + "(main) found exe (before symlink chase) at: %s\n", |
3703 | + tmp_pathspec); |
3704 | + |
3705 | + actual_cwrapper_path = chase_symlinks (tmp_pathspec); |
3706 | + lt_debugprintf (__FILE__, __LINE__, |
3707 | + "(main) found exe (after symlink chase) at: %s\n", |
3708 | + actual_cwrapper_path); |
3709 | + XFREE (tmp_pathspec); |
3710 | + |
3711 | + actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path)); |
3712 | + strendzap (actual_cwrapper_path, actual_cwrapper_name); |
3713 | + |
3714 | + /* wrapper name transforms */ |
3715 | + strendzap (actual_cwrapper_name, ".exe"); |
3716 | + tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1); |
3717 | + XFREE (actual_cwrapper_name); |
3718 | + actual_cwrapper_name = tmp_pathspec; |
3719 | + tmp_pathspec = 0; |
3720 | + |
3721 | + /* target_name transforms -- use actual target program name; might have lt- prefix */ |
3722 | + target_name = xstrdup (base_name (TARGET_PROGRAM_NAME)); |
3723 | + strendzap (target_name, ".exe"); |
3724 | + tmp_pathspec = lt_extend_str (target_name, ".exe", 1); |
3725 | + XFREE (target_name); |
3726 | + target_name = tmp_pathspec; |
3727 | + tmp_pathspec = 0; |
3728 | + |
3729 | + lt_debugprintf (__FILE__, __LINE__, |
3730 | + "(main) libtool target name: %s\n", |
3731 | + target_name); |
3732 | +EOF |
3733 | + |
3734 | + cat <<EOF |
3735 | + newargz[0] = |
3736 | + XMALLOC (char, (strlen (actual_cwrapper_path) + |
3737 | + strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1)); |
3738 | + strcpy (newargz[0], actual_cwrapper_path); |
3739 | + strcat (newargz[0], "$objdir"); |
3740 | + strcat (newargz[0], "/"); |
3741 | +EOF |
3742 | + |
3743 | + cat <<"EOF" |
3744 | + /* stop here, and copy so we don't have to do this twice */ |
3745 | + tmp_pathspec = xstrdup (newargz[0]); |
3746 | + |
3747 | + /* do NOT want the lt- prefix here, so use actual_cwrapper_name */ |
3748 | + strcat (newargz[0], actual_cwrapper_name); |
3749 | + |
3750 | + /* DO want the lt- prefix here if it exists, so use target_name */ |
3751 | + lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1); |
3752 | + XFREE (tmp_pathspec); |
3753 | + tmp_pathspec = NULL; |
3754 | +EOF |
3755 | + |
3756 | + case $host_os in |
3757 | + mingw*) |
3758 | + cat <<"EOF" |
3759 | + { |
3760 | + char* p; |
3761 | + while ((p = strchr (newargz[0], '\\')) != NULL) |
3762 | + { |
3763 | + *p = '/'; |
3764 | + } |
3765 | + while ((p = strchr (lt_argv_zero, '\\')) != NULL) |
3766 | + { |
3767 | + *p = '/'; |
3768 | + } |
3769 | + } |
3770 | +EOF |
3771 | + ;; |
3772 | + esac |
3773 | + |
3774 | + cat <<"EOF" |
3775 | + XFREE (target_name); |
3776 | + XFREE (actual_cwrapper_path); |
3777 | + XFREE (actual_cwrapper_name); |
3778 | + |
3779 | + lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */ |
3780 | + lt_setenv ("DUALCASE", "1"); /* for MSK sh */ |
3781 | + lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE); |
3782 | + lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE); |
3783 | + |
3784 | + lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n", |
3785 | + nonnull (lt_argv_zero)); |
3786 | + for (i = 0; i < newargc; i++) |
3787 | + { |
3788 | + lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n", |
3789 | + i, nonnull (newargz[i])); |
3790 | + } |
3791 | + |
3792 | +EOF |
3793 | + |
3794 | + case $host_os in |
3795 | + mingw*) |
3796 | + cat <<"EOF" |
3797 | + /* execv doesn't actually work on mingw as expected on unix */ |
3798 | + newargz = prepare_spawn (newargz); |
3799 | + rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz); |
3800 | + if (rval == -1) |
3801 | + { |
3802 | + /* failed to start process */ |
3803 | + lt_debugprintf (__FILE__, __LINE__, |
3804 | + "(main) failed to launch target \"%s\": %s\n", |
3805 | + lt_argv_zero, nonnull (strerror (errno))); |
3806 | + return 127; |
3807 | + } |
3808 | + return rval; |
3809 | +EOF |
3810 | + ;; |
3811 | + *) |
3812 | + cat <<"EOF" |
3813 | + execv (lt_argv_zero, newargz); |
3814 | + return rval; /* =127, but avoids unused variable warning */ |
3815 | +EOF |
3816 | + ;; |
3817 | + esac |
3818 | + |
3819 | + cat <<"EOF" |
3820 | +} |
3821 | + |
3822 | +void * |
3823 | +xmalloc (size_t num) |
3824 | +{ |
3825 | + void *p = (void *) malloc (num); |
3826 | + if (!p) |
3827 | + lt_fatal (__FILE__, __LINE__, "memory exhausted"); |
3828 | + |
3829 | + return p; |
3830 | +} |
3831 | + |
3832 | +char * |
3833 | +xstrdup (const char *string) |
3834 | +{ |
3835 | + return string ? strcpy ((char *) xmalloc (strlen (string) + 1), |
3836 | + string) : NULL; |
3837 | +} |
3838 | + |
3839 | +const char * |
3840 | +base_name (const char *name) |
3841 | +{ |
3842 | + const char *base; |
3843 | + |
3844 | +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) |
3845 | + /* Skip over the disk name in MSDOS pathnames. */ |
3846 | + if (isalpha ((unsigned char) name[0]) && name[1] == ':') |
3847 | + name += 2; |
3848 | +#endif |
3849 | + |
3850 | + for (base = name; *name; name++) |
3851 | + if (IS_DIR_SEPARATOR (*name)) |
3852 | + base = name + 1; |
3853 | + return base; |
3854 | +} |
3855 | + |
3856 | +int |
3857 | +check_executable (const char *path) |
3858 | +{ |
3859 | + struct stat st; |
3860 | + |
3861 | + lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n", |
3862 | + nonempty (path)); |
3863 | + if ((!path) || (!*path)) |
3864 | + return 0; |
3865 | + |
3866 | + if ((stat (path, &st) >= 0) |
3867 | + && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) |
3868 | + return 1; |
3869 | + else |
3870 | + return 0; |
3871 | +} |
3872 | + |
3873 | +int |
3874 | +make_executable (const char *path) |
3875 | +{ |
3876 | + int rval = 0; |
3877 | + struct stat st; |
3878 | + |
3879 | + lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", |
3880 | + nonempty (path)); |
3881 | + if ((!path) || (!*path)) |
3882 | + return 0; |
3883 | + |
3884 | + if (stat (path, &st) >= 0) |
3885 | + { |
3886 | + rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); |
3887 | + } |
3888 | + return rval; |
3889 | +} |
3890 | + |
3891 | +/* Searches for the full path of the wrapper. Returns |
3892 | + newly allocated full path name if found, NULL otherwise |
3893 | + Does not chase symlinks, even on platforms that support them. |
3894 | +*/ |
3895 | +char * |
3896 | +find_executable (const char *wrapper) |
3897 | +{ |
3898 | + int has_slash = 0; |
3899 | + const char *p; |
3900 | + const char *p_next; |
3901 | + /* static buffer for getcwd */ |
3902 | + char tmp[LT_PATHMAX + 1]; |
3903 | + int tmp_len; |
3904 | + char *concat_name; |
3905 | + |
3906 | + lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", |
3907 | + nonempty (wrapper)); |
3908 | + |
3909 | + if ((wrapper == NULL) || (*wrapper == '\0')) |
3910 | + return NULL; |
3911 | + |
3912 | + /* Absolute path? */ |
3913 | +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) |
3914 | + if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') |
3915 | + { |
3916 | + concat_name = xstrdup (wrapper); |
3917 | + if (check_executable (concat_name)) |
3918 | + return concat_name; |
3919 | + XFREE (concat_name); |
3920 | + } |
3921 | + else |
3922 | + { |
3923 | +#endif |
3924 | + if (IS_DIR_SEPARATOR (wrapper[0])) |
3925 | + { |
3926 | + concat_name = xstrdup (wrapper); |
3927 | + if (check_executable (concat_name)) |
3928 | + return concat_name; |
3929 | + XFREE (concat_name); |
3930 | + } |
3931 | +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) |
3932 | + } |
3933 | +#endif |
3934 | + |
3935 | + for (p = wrapper; *p; p++) |
3936 | + if (*p == '/') |
3937 | + { |
3938 | + has_slash = 1; |
3939 | + break; |
3940 | + } |
3941 | + if (!has_slash) |
3942 | + { |
3943 | + /* no slashes; search PATH */ |
3944 | + const char *path = getenv ("PATH"); |
3945 | + if (path != NULL) |
3946 | + { |
3947 | + for (p = path; *p; p = p_next) |
3948 | + { |
3949 | + const char *q; |
3950 | + size_t p_len; |
3951 | + for (q = p; *q; q++) |
3952 | + if (IS_PATH_SEPARATOR (*q)) |
3953 | + break; |
3954 | + p_len = q - p; |
3955 | + p_next = (*q == '\0' ? q : q + 1); |
3956 | + if (p_len == 0) |
3957 | + { |
3958 | + /* empty path: current directory */ |
3959 | + if (getcwd (tmp, LT_PATHMAX) == NULL) |
3960 | + lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", |
3961 | + nonnull (strerror (errno))); |
3962 | + tmp_len = strlen (tmp); |
3963 | + concat_name = |
3964 | + XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); |
3965 | + memcpy (concat_name, tmp, tmp_len); |
3966 | + concat_name[tmp_len] = '/'; |
3967 | + strcpy (concat_name + tmp_len + 1, wrapper); |
3968 | + } |
3969 | + else |
3970 | + { |
3971 | + concat_name = |
3972 | + XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); |
3973 | + memcpy (concat_name, p, p_len); |
3974 | + concat_name[p_len] = '/'; |
3975 | + strcpy (concat_name + p_len + 1, wrapper); |
3976 | + } |
3977 | + if (check_executable (concat_name)) |
3978 | + return concat_name; |
3979 | + XFREE (concat_name); |
3980 | + } |
3981 | + } |
3982 | + /* not found in PATH; assume curdir */ |
3983 | + } |
3984 | + /* Relative path | not found in path: prepend cwd */ |
3985 | + if (getcwd (tmp, LT_PATHMAX) == NULL) |
3986 | + lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", |
3987 | + nonnull (strerror (errno))); |
3988 | + tmp_len = strlen (tmp); |
3989 | + concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); |
3990 | + memcpy (concat_name, tmp, tmp_len); |
3991 | + concat_name[tmp_len] = '/'; |
3992 | + strcpy (concat_name + tmp_len + 1, wrapper); |
3993 | + |
3994 | + if (check_executable (concat_name)) |
3995 | + return concat_name; |
3996 | + XFREE (concat_name); |
3997 | + return NULL; |
3998 | +} |
3999 | + |
4000 | +char * |
4001 | +chase_symlinks (const char *pathspec) |
4002 | +{ |
4003 | +#ifndef S_ISLNK |
4004 | + return xstrdup (pathspec); |
4005 | +#else |
4006 | + char buf[LT_PATHMAX]; |
4007 | + struct stat s; |
4008 | + char *tmp_pathspec = xstrdup (pathspec); |
4009 | + char *p; |
4010 | + int has_symlinks = 0; |
4011 | + while (strlen (tmp_pathspec) && !has_symlinks) |
4012 | + { |
4013 | + lt_debugprintf (__FILE__, __LINE__, |
4014 | + "checking path component for symlinks: %s\n", |
4015 | + tmp_pathspec); |
4016 | + if (lstat (tmp_pathspec, &s) == 0) |
4017 | + { |
4018 | + if (S_ISLNK (s.st_mode) != 0) |
4019 | + { |
4020 | + has_symlinks = 1; |
4021 | + break; |
4022 | + } |
4023 | + |
4024 | + /* search backwards for last DIR_SEPARATOR */ |
4025 | + p = tmp_pathspec + strlen (tmp_pathspec) - 1; |
4026 | + while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) |
4027 | + p--; |
4028 | + if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) |
4029 | + { |
4030 | + /* no more DIR_SEPARATORS left */ |
4031 | + break; |
4032 | + } |
4033 | + *p = '\0'; |
4034 | + } |
4035 | + else |
4036 | + { |
4037 | + lt_fatal (__FILE__, __LINE__, |
4038 | + "error accessing file \"%s\": %s", |
4039 | + tmp_pathspec, nonnull (strerror (errno))); |
4040 | + } |
4041 | + } |
4042 | + XFREE (tmp_pathspec); |
4043 | + |
4044 | + if (!has_symlinks) |
4045 | + { |
4046 | + return xstrdup (pathspec); |
4047 | + } |
4048 | + |
4049 | + tmp_pathspec = realpath (pathspec, buf); |
4050 | + if (tmp_pathspec == 0) |
4051 | + { |
4052 | + lt_fatal (__FILE__, __LINE__, |
4053 | + "could not follow symlinks for %s", pathspec); |
4054 | + } |
4055 | + return xstrdup (tmp_pathspec); |
4056 | +#endif |
4057 | +} |
4058 | + |
4059 | +char * |
4060 | +strendzap (char *str, const char *pat) |
4061 | +{ |
4062 | + size_t len, patlen; |
4063 | + |
4064 | + assert (str != NULL); |
4065 | + assert (pat != NULL); |
4066 | + |
4067 | + len = strlen (str); |
4068 | + patlen = strlen (pat); |
4069 | + |
4070 | + if (patlen <= len) |
4071 | + { |
4072 | + str += len - patlen; |
4073 | + if (strcmp (str, pat) == 0) |
4074 | + *str = '\0'; |
4075 | + } |
4076 | + return str; |
4077 | +} |
4078 | + |
4079 | +void |
4080 | +lt_debugprintf (const char *file, int line, const char *fmt, ...) |
4081 | +{ |
4082 | + va_list args; |
4083 | + if (lt_debug) |
4084 | + { |
4085 | + (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); |
4086 | + va_start (args, fmt); |
4087 | + (void) vfprintf (stderr, fmt, args); |
4088 | + va_end (args); |
4089 | + } |
4090 | +} |
4091 | + |
4092 | +static void |
4093 | +lt_error_core (int exit_status, const char *file, |
4094 | + int line, const char *mode, |
4095 | + const char *message, va_list ap) |
4096 | +{ |
4097 | + fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); |
4098 | + vfprintf (stderr, message, ap); |
4099 | + fprintf (stderr, ".\n"); |
4100 | + |
4101 | + if (exit_status >= 0) |
4102 | + exit (exit_status); |
4103 | +} |
4104 | + |
4105 | +void |
4106 | +lt_fatal (const char *file, int line, const char *message, ...) |
4107 | +{ |
4108 | + va_list ap; |
4109 | + va_start (ap, message); |
4110 | + lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); |
4111 | + va_end (ap); |
4112 | +} |
4113 | + |
4114 | +static const char * |
4115 | +nonnull (const char *s) |
4116 | +{ |
4117 | + return s ? s : "(null)"; |
4118 | +} |
4119 | + |
4120 | +static const char * |
4121 | +nonempty (const char *s) |
4122 | +{ |
4123 | + return (s && !*s) ? "(empty)" : nonnull (s); |
4124 | +} |
4125 | + |
4126 | +void |
4127 | +lt_setenv (const char *name, const char *value) |
4128 | +{ |
4129 | + lt_debugprintf (__FILE__, __LINE__, |
4130 | + "(lt_setenv) setting '%s' to '%s'\n", |
4131 | + nonnull (name), nonnull (value)); |
4132 | + { |
4133 | +#ifdef HAVE_SETENV |
4134 | + /* always make a copy, for consistency with !HAVE_SETENV */ |
4135 | + char *str = xstrdup (value); |
4136 | + setenv (name, str, 1); |
4137 | +#else |
4138 | + int len = strlen (name) + 1 + strlen (value) + 1; |
4139 | + char *str = XMALLOC (char, len); |
4140 | + sprintf (str, "%s=%s", name, value); |
4141 | + if (putenv (str) != EXIT_SUCCESS) |
4142 | + { |
4143 | + XFREE (str); |
4144 | + } |
4145 | +#endif |
4146 | + } |
4147 | +} |
4148 | + |
4149 | +char * |
4150 | +lt_extend_str (const char *orig_value, const char *add, int to_end) |
4151 | +{ |
4152 | + char *new_value; |
4153 | + if (orig_value && *orig_value) |
4154 | + { |
4155 | + int orig_value_len = strlen (orig_value); |
4156 | + int add_len = strlen (add); |
4157 | + new_value = XMALLOC (char, add_len + orig_value_len + 1); |
4158 | + if (to_end) |
4159 | + { |
4160 | + strcpy (new_value, orig_value); |
4161 | + strcpy (new_value + orig_value_len, add); |
4162 | + } |
4163 | + else |
4164 | + { |
4165 | + strcpy (new_value, add); |
4166 | + strcpy (new_value + add_len, orig_value); |
4167 | + } |
4168 | + } |
4169 | + else |
4170 | + { |
4171 | + new_value = xstrdup (add); |
4172 | + } |
4173 | + return new_value; |
4174 | +} |
4175 | + |
4176 | +void |
4177 | +lt_update_exe_path (const char *name, const char *value) |
4178 | +{ |
4179 | + lt_debugprintf (__FILE__, __LINE__, |
4180 | + "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", |
4181 | + nonnull (name), nonnull (value)); |
4182 | + |
4183 | + if (name && *name && value && *value) |
4184 | + { |
4185 | + char *new_value = lt_extend_str (getenv (name), value, 0); |
4186 | + /* some systems can't cope with a ':'-terminated path #' */ |
4187 | + int len = strlen (new_value); |
4188 | + while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) |
4189 | + { |
4190 | + new_value[len-1] = '\0'; |
4191 | + } |
4192 | + lt_setenv (name, new_value); |
4193 | + XFREE (new_value); |
4194 | + } |
4195 | +} |
4196 | + |
4197 | +void |
4198 | +lt_update_lib_path (const char *name, const char *value) |
4199 | +{ |
4200 | + lt_debugprintf (__FILE__, __LINE__, |
4201 | + "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", |
4202 | + nonnull (name), nonnull (value)); |
4203 | + |
4204 | + if (name && *name && value && *value) |
4205 | + { |
4206 | + char *new_value = lt_extend_str (getenv (name), value, 0); |
4207 | + lt_setenv (name, new_value); |
4208 | + XFREE (new_value); |
4209 | + } |
4210 | +} |
4211 | + |
4212 | +EOF |
4213 | + case $host_os in |
4214 | + mingw*) |
4215 | + cat <<"EOF" |
4216 | + |
4217 | +/* Prepares an argument vector before calling spawn(). |
4218 | + Note that spawn() does not by itself call the command interpreter |
4219 | + (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : |
4220 | + ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); |
4221 | + GetVersionEx(&v); |
4222 | + v.dwPlatformId == VER_PLATFORM_WIN32_NT; |
4223 | + }) ? "cmd.exe" : "command.com"). |
4224 | + Instead it simply concatenates the arguments, separated by ' ', and calls |
4225 | + CreateProcess(). We must quote the arguments since Win32 CreateProcess() |
4226 | + interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a |
4227 | + special way: |
4228 | + - Space and tab are interpreted as delimiters. They are not treated as |
4229 | + delimiters if they are surrounded by double quotes: "...". |
4230 | + - Unescaped double quotes are removed from the input. Their only effect is |
4231 | + that within double quotes, space and tab are treated like normal |
4232 | + characters. |
4233 | + - Backslashes not followed by double quotes are not special. |
4234 | + - But 2*n+1 backslashes followed by a double quote become |
4235 | + n backslashes followed by a double quote (n >= 0): |
4236 | + \" -> " |
4237 | + \\\" -> \" |
4238 | + \\\\\" -> \\" |
4239 | + */ |
4240 | +#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" |
4241 | +#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" |
4242 | +char ** |
4243 | +prepare_spawn (char **argv) |
4244 | +{ |
4245 | + size_t argc; |
4246 | + char **new_argv; |
4247 | + size_t i; |
4248 | + |
4249 | + /* Count number of arguments. */ |
4250 | + for (argc = 0; argv[argc] != NULL; argc++) |
4251 | + ; |
4252 | + |
4253 | + /* Allocate new argument vector. */ |
4254 | + new_argv = XMALLOC (char *, argc + 1); |
4255 | + |
4256 | + /* Put quoted arguments into the new argument vector. */ |
4257 | + for (i = 0; i < argc; i++) |
4258 | + { |
4259 | + const char *string = argv[i]; |
4260 | + |
4261 | + if (string[0] == '\0') |
4262 | + new_argv[i] = xstrdup ("\"\""); |
4263 | + else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) |
4264 | + { |
4265 | + int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); |
4266 | + size_t length; |
4267 | + unsigned int backslashes; |
4268 | + const char *s; |
4269 | + char *quoted_string; |
4270 | + char *p; |
4271 | + |
4272 | + length = 0; |
4273 | + backslashes = 0; |
4274 | + if (quote_around) |
4275 | + length++; |
4276 | + for (s = string; *s != '\0'; s++) |
4277 | + { |
4278 | + char c = *s; |
4279 | + if (c == '"') |
4280 | + length += backslashes + 1; |
4281 | + length++; |
4282 | + if (c == '\\') |
4283 | + backslashes++; |
4284 | + else |
4285 | + backslashes = 0; |
4286 | + } |
4287 | + if (quote_around) |
4288 | + length += backslashes + 1; |
4289 | + |
4290 | + quoted_string = XMALLOC (char, length + 1); |
4291 | + |
4292 | + p = quoted_string; |
4293 | + backslashes = 0; |
4294 | + if (quote_around) |
4295 | + *p++ = '"'; |
4296 | + for (s = string; *s != '\0'; s++) |
4297 | + { |
4298 | + char c = *s; |
4299 | + if (c == '"') |
4300 | + { |
4301 | + unsigned int j; |
4302 | + for (j = backslashes + 1; j > 0; j--) |
4303 | + *p++ = '\\'; |
4304 | + } |
4305 | + *p++ = c; |
4306 | + if (c == '\\') |
4307 | + backslashes++; |
4308 | + else |
4309 | + backslashes = 0; |
4310 | + } |
4311 | + if (quote_around) |
4312 | + { |
4313 | + unsigned int j; |
4314 | + for (j = backslashes; j > 0; j--) |
4315 | + *p++ = '\\'; |
4316 | + *p++ = '"'; |
4317 | + } |
4318 | + *p = '\0'; |
4319 | + |
4320 | + new_argv[i] = quoted_string; |
4321 | + } |
4322 | + else |
4323 | + new_argv[i] = (char *) string; |
4324 | + } |
4325 | + new_argv[argc] = NULL; |
4326 | + |
4327 | + return new_argv; |
4328 | +} |
4329 | +EOF |
4330 | + ;; |
4331 | + esac |
4332 | + |
4333 | + cat <<"EOF" |
4334 | +void lt_dump_script (FILE* f) |
4335 | +{ |
4336 | +EOF |
4337 | + func_emit_wrapper yes | |
4338 | + $SED -e 's/\([\\"]\)/\\\1/g' \ |
4339 | + -e 's/^/ fputs ("/' -e 's/$/\\n", f);/' |
4340 | + |
4341 | + cat <<"EOF" |
4342 | +} |
4343 | +EOF |
4344 | +} |
4345 | +# end: func_emit_cwrapperexe_src |
4346 | + |
4347 | +# func_win32_import_lib_p ARG |
4348 | +# True if ARG is an import lib, as indicated by $file_magic_cmd |
4349 | +func_win32_import_lib_p () |
4350 | +{ |
4351 | + $opt_debug |
4352 | + case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in |
4353 | + *import*) : ;; |
4354 | + *) false ;; |
4355 | + esac |
4356 | +} |
4357 | + |
4358 | +# func_mode_link arg... |
4359 | +func_mode_link () |
4360 | +{ |
4361 | + $opt_debug |
4362 | + case $host in |
4363 | + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) |
4364 | + # It is impossible to link a dll without this setting, and |
4365 | + # we shouldn't force the makefile maintainer to figure out |
4366 | + # which system we are compiling for in order to pass an extra |
4367 | + # flag for every libtool invocation. |
4368 | + # allow_undefined=no |
4369 | + |
4370 | + # FIXME: Unfortunately, there are problems with the above when trying |
4371 | + # to make a dll which has undefined symbols, in which case not |
4372 | + # even a static library is built. For now, we need to specify |
4373 | + # -no-undefined on the libtool link line when we can be certain |
4374 | + # that all symbols are satisfied, otherwise we get a static library. |
4375 | + allow_undefined=yes |
4376 | + ;; |
4377 | + *) |
4378 | + allow_undefined=yes |
4379 | + ;; |
4380 | + esac |
4381 | + libtool_args=$nonopt |
4382 | + base_compile="$nonopt $@" |
4383 | + compile_command=$nonopt |
4384 | + finalize_command=$nonopt |
4385 | + |
4386 | + compile_rpath= |
4387 | + finalize_rpath= |
4388 | + compile_shlibpath= |
4389 | + finalize_shlibpath= |
4390 | + convenience= |
4391 | + old_convenience= |
4392 | + deplibs= |
4393 | + old_deplibs= |
4394 | + compiler_flags= |
4395 | + linker_flags= |
4396 | + dllsearchpath= |
4397 | + lib_search_path=`pwd` |
4398 | + inst_prefix_dir= |
4399 | + new_inherited_linker_flags= |
4400 | + |
4401 | + avoid_version=no |
4402 | + bindir= |
4403 | + dlfiles= |
4404 | + dlprefiles= |
4405 | + dlself=no |
4406 | + export_dynamic=no |
4407 | + export_symbols= |
4408 | + export_symbols_regex= |
4409 | + generated= |
4410 | + libobjs= |
4411 | + ltlibs= |
4412 | + module=no |
4413 | + no_install=no |
4414 | + objs= |
4415 | + non_pic_objects= |
4416 | + precious_files_regex= |
4417 | + prefer_static_libs=no |
4418 | + preload=no |
4419 | + prev= |
4420 | + prevarg= |
4421 | + release= |
4422 | + rpath= |
4423 | + xrpath= |
4424 | + perm_rpath= |
4425 | + temp_rpath= |
4426 | + thread_safe=no |
4427 | + vinfo= |
4428 | + vinfo_number=no |
4429 | + weak_libs= |
4430 | + single_module="${wl}-single_module" |
4431 | + func_infer_tag $base_compile |
4432 | + |
4433 | + # We need to know -static, to get the right output filenames. |
4434 | + for arg |
4435 | + do |
4436 | + case $arg in |
4437 | + -shared) |
4438 | + test "$build_libtool_libs" != yes && \ |
4439 | + func_fatal_configuration "can not build a shared library" |
4440 | + build_old_libs=no |
4441 | + break |
4442 | + ;; |
4443 | + -all-static | -static | -static-libtool-libs) |
4444 | + case $arg in |
4445 | + -all-static) |
4446 | + if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then |
4447 | + func_warning "complete static linking is impossible in this configuration" |
4448 | + fi |
4449 | + if test -n "$link_static_flag"; then |
4450 | + dlopen_self=$dlopen_self_static |
4451 | + fi |
4452 | + prefer_static_libs=yes |
4453 | + ;; |
4454 | + -static) |
4455 | + if test -z "$pic_flag" && test -n "$link_static_flag"; then |
4456 | + dlopen_self=$dlopen_self_static |
4457 | + fi |
4458 | + prefer_static_libs=built |
4459 | + ;; |
4460 | + -static-libtool-libs) |
4461 | + if test -z "$pic_flag" && test -n "$link_static_flag"; then |
4462 | + dlopen_self=$dlopen_self_static |
4463 | + fi |
4464 | + prefer_static_libs=yes |
4465 | + ;; |
4466 | + esac |
4467 | + build_libtool_libs=no |
4468 | + build_old_libs=yes |
4469 | + break |
4470 | + ;; |
4471 | + esac |
4472 | + done |
4473 | + |
4474 | + # See if our shared archives depend on static archives. |
4475 | + test -n "$old_archive_from_new_cmds" && build_old_libs=yes |
4476 | + |
4477 | + # Go through the arguments, transforming them on the way. |
4478 | + while test "$#" -gt 0; do |
4479 | + arg="$1" |
4480 | + shift |
4481 | + func_quote_for_eval "$arg" |
4482 | + qarg=$func_quote_for_eval_unquoted_result |
4483 | + func_append libtool_args " $func_quote_for_eval_result" |
4484 | + |
4485 | + # If the previous option needs an argument, assign it. |
4486 | + if test -n "$prev"; then |
4487 | + case $prev in |
4488 | + output) |
4489 | + func_append compile_command " @OUTPUT@" |
4490 | + func_append finalize_command " @OUTPUT@" |
4491 | + ;; |
4492 | + esac |
4493 | + |
4494 | + case $prev in |
4495 | + bindir) |
4496 | + bindir="$arg" |
4497 | + prev= |
4498 | + continue |
4499 | + ;; |
4500 | + dlfiles|dlprefiles) |
4501 | + if test "$preload" = no; then |
4502 | + # Add the symbol object into the linking commands. |
4503 | + func_append compile_command " @SYMFILE@" |
4504 | + func_append finalize_command " @SYMFILE@" |
4505 | + preload=yes |
4506 | + fi |
4507 | + case $arg in |
4508 | + *.la | *.lo) ;; # We handle these cases below. |
4509 | + force) |
4510 | + if test "$dlself" = no; then |
4511 | + dlself=needless |
4512 | + export_dynamic=yes |
4513 | + fi |
4514 | + prev= |
4515 | + continue |
4516 | + ;; |
4517 | + self) |
4518 | + if test "$prev" = dlprefiles; then |
4519 | + dlself=yes |
4520 | + elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then |
4521 | + dlself=yes |
4522 | + else |
4523 | + dlself=needless |
4524 | + export_dynamic=yes |
4525 | + fi |
4526 | + prev= |
4527 | + continue |
4528 | + ;; |
4529 | + *) |
4530 | + if test "$prev" = dlfiles; then |
4531 | + dlfiles="$dlfiles $arg" |
4532 | + else |
4533 | + dlprefiles="$dlprefiles $arg" |
4534 | + fi |
4535 | + prev= |
4536 | + continue |
4537 | + ;; |
4538 | + esac |
4539 | + ;; |
4540 | + expsyms) |
4541 | + export_symbols="$arg" |
4542 | + test -f "$arg" \ |
4543 | + || func_fatal_error "symbol file \`$arg' does not exist" |
4544 | + prev= |
4545 | + continue |
4546 | + ;; |
4547 | + expsyms_regex) |
4548 | + export_symbols_regex="$arg" |
4549 | + prev= |
4550 | + continue |
4551 | + ;; |
4552 | + framework) |
4553 | + case $host in |
4554 | + *-*-darwin*) |
4555 | + case "$deplibs " in |
4556 | + *" $qarg.ltframework "*) ;; |
4557 | + *) deplibs="$deplibs $qarg.ltframework" # this is fixed later |
4558 | + ;; |
4559 | + esac |
4560 | + ;; |
4561 | + esac |
4562 | + prev= |
4563 | + continue |
4564 | + ;; |
4565 | + inst_prefix) |
4566 | + inst_prefix_dir="$arg" |
4567 | + prev= |
4568 | + continue |
4569 | + ;; |
4570 | + objectlist) |
4571 | + if test -f "$arg"; then |
4572 | + save_arg=$arg |
4573 | + moreargs= |
4574 | + for fil in `cat "$save_arg"` |
4575 | + do |
4576 | +# moreargs="$moreargs $fil" |
4577 | + arg=$fil |
4578 | + # A libtool-controlled object. |
4579 | + |
4580 | + # Check to see that this really is a libtool object. |
4581 | + if func_lalib_unsafe_p "$arg"; then |
4582 | + pic_object= |
4583 | + non_pic_object= |
4584 | + |
4585 | + # Read the .lo file |
4586 | + func_source "$arg" |
4587 | + |
4588 | + if test -z "$pic_object" || |
4589 | + test -z "$non_pic_object" || |
4590 | + test "$pic_object" = none && |
4591 | + test "$non_pic_object" = none; then |
4592 | + func_fatal_error "cannot find name of object for \`$arg'" |
4593 | + fi |
4594 | + |
4595 | + # Extract subdirectory from the argument. |
4596 | + func_dirname "$arg" "/" "" |
4597 | + xdir="$func_dirname_result" |
4598 | + |
4599 | + if test "$pic_object" != none; then |
4600 | + # Prepend the subdirectory the object is found in. |
4601 | + pic_object="$xdir$pic_object" |
4602 | + |
4603 | + if test "$prev" = dlfiles; then |
4604 | + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then |
4605 | + dlfiles="$dlfiles $pic_object" |
4606 | + prev= |
4607 | + continue |
4608 | + else |
4609 | + # If libtool objects are unsupported, then we need to preload. |
4610 | + prev=dlprefiles |
4611 | + fi |
4612 | + fi |
4613 | + |
4614 | + # CHECK ME: I think I busted this. -Ossama |
4615 | + if test "$prev" = dlprefiles; then |
4616 | + # Preload the old-style object. |
4617 | + dlprefiles="$dlprefiles $pic_object" |
4618 | + prev= |
4619 | + fi |
4620 | + |
4621 | + # A PIC object. |
4622 | + func_append libobjs " $pic_object" |
4623 | + arg="$pic_object" |
4624 | + fi |
4625 | + |
4626 | + # Non-PIC object. |
4627 | + if test "$non_pic_object" != none; then |
4628 | + # Prepend the subdirectory the object is found in. |
4629 | + non_pic_object="$xdir$non_pic_object" |
4630 | + |
4631 | + # A standard non-PIC object |
4632 | + func_append non_pic_objects " $non_pic_object" |
4633 | + if test -z "$pic_object" || test "$pic_object" = none ; then |
4634 | + arg="$non_pic_object" |
4635 | + fi |
4636 | + else |
4637 | + # If the PIC object exists, use it instead. |
4638 | + # $xdir was prepended to $pic_object above. |
4639 | + non_pic_object="$pic_object" |
4640 | + func_append non_pic_objects " $non_pic_object" |
4641 | + fi |
4642 | + else |
4643 | + # Only an error if not doing a dry-run. |
4644 | + if $opt_dry_run; then |
4645 | + # Extract subdirectory from the argument. |
4646 | + func_dirname "$arg" "/" "" |
4647 | + xdir="$func_dirname_result" |
4648 | + |
4649 | + func_lo2o "$arg" |
4650 | + pic_object=$xdir$objdir/$func_lo2o_result |
4651 | + non_pic_object=$xdir$func_lo2o_result |
4652 | + func_append libobjs " $pic_object" |
4653 | + func_append non_pic_objects " $non_pic_object" |
4654 | + else |
4655 | + func_fatal_error "\`$arg' is not a valid libtool object" |
4656 | + fi |
4657 | + fi |
4658 | + done |
4659 | + else |
4660 | + func_fatal_error "link input file \`$arg' does not exist" |
4661 | + fi |
4662 | + arg=$save_arg |
4663 | + prev= |
4664 | + continue |
4665 | + ;; |
4666 | + precious_regex) |
4667 | + precious_files_regex="$arg" |
4668 | + prev= |
4669 | + continue |
4670 | + ;; |
4671 | + release) |
4672 | + release="-$arg" |
4673 | + prev= |
4674 | + continue |
4675 | + ;; |
4676 | + rpath | xrpath) |
4677 | + # We need an absolute path. |
4678 | + case $arg in |
4679 | + [\\/]* | [A-Za-z]:[\\/]*) ;; |
4680 | + *) |
4681 | + func_fatal_error "only absolute run-paths are allowed" |
4682 | + ;; |
4683 | + esac |
4684 | + if test "$prev" = rpath; then |
4685 | + case "$rpath " in |
4686 | + *" $arg "*) ;; |
4687 | + *) rpath="$rpath $arg" ;; |
4688 | + esac |
4689 | + else |
4690 | + case "$xrpath " in |
4691 | + *" $arg "*) ;; |
4692 | + *) xrpath="$xrpath $arg" ;; |
4693 | + esac |
4694 | + fi |
4695 | + prev= |
4696 | + continue |
4697 | + ;; |
4698 | + shrext) |
4699 | + shrext_cmds="$arg" |
4700 | + prev= |
4701 | + continue |
4702 | + ;; |
4703 | + weak) |
4704 | + weak_libs="$weak_libs $arg" |
4705 | + prev= |
4706 | + continue |
4707 | + ;; |
4708 | + xcclinker) |
4709 | + linker_flags="$linker_flags $qarg" |
4710 | + compiler_flags="$compiler_flags $qarg" |
4711 | + prev= |
4712 | + func_append compile_command " $qarg" |
4713 | + func_append finalize_command " $qarg" |
4714 | + continue |
4715 | + ;; |
4716 | + xcompiler) |
4717 | + compiler_flags="$compiler_flags $qarg" |
4718 | + prev= |
4719 | + func_append compile_command " $qarg" |
4720 | + func_append finalize_command " $qarg" |
4721 | + continue |
4722 | + ;; |
4723 | + xlinker) |
4724 | + linker_flags="$linker_flags $qarg" |
4725 | + compiler_flags="$compiler_flags $wl$qarg" |
4726 | + prev= |
4727 | + func_append compile_command " $wl$qarg" |
4728 | + func_append finalize_command " $wl$qarg" |
4729 | + continue |
4730 | + ;; |
4731 | + *) |
4732 | + eval "$prev=\"\$arg\"" |
4733 | + prev= |
4734 | + continue |
4735 | + ;; |
4736 | + esac |
4737 | + fi # test -n "$prev" |
4738 | + |
4739 | + prevarg="$arg" |
4740 | + |
4741 | + case $arg in |
4742 | + -all-static) |
4743 | + if test -n "$link_static_flag"; then |
4744 | + # See comment for -static flag below, for more details. |
4745 | + func_append compile_command " $link_static_flag" |
4746 | + func_append finalize_command " $link_static_flag" |
4747 | + fi |
4748 | + continue |
4749 | + ;; |
4750 | + |
4751 | + -allow-undefined) |
4752 | + # FIXME: remove this flag sometime in the future. |
4753 | + func_fatal_error "\`-allow-undefined' must not be used because it is the default" |
4754 | + ;; |
4755 | + |
4756 | + -avoid-version) |
4757 | + avoid_version=yes |
4758 | + continue |
4759 | + ;; |
4760 | + |
4761 | + -bindir) |
4762 | + prev=bindir |
4763 | + continue |
4764 | + ;; |
4765 | + |
4766 | + -dlopen) |
4767 | + prev=dlfiles |
4768 | + continue |
4769 | + ;; |
4770 | + |
4771 | + -dlpreopen) |
4772 | + prev=dlprefiles |
4773 | + continue |
4774 | + ;; |
4775 | + |
4776 | + -export-dynamic) |
4777 | + export_dynamic=yes |
4778 | + continue |
4779 | + ;; |
4780 | + |
4781 | + -export-symbols | -export-symbols-regex) |
4782 | + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then |
4783 | + func_fatal_error "more than one -exported-symbols argument is not allowed" |
4784 | + fi |
4785 | + if test "X$arg" = "X-export-symbols"; then |
4786 | + prev=expsyms |
4787 | + else |
4788 | + prev=expsyms_regex |
4789 | + fi |
4790 | + continue |
4791 | + ;; |
4792 | + |
4793 | + -framework) |
4794 | + prev=framework |
4795 | + continue |
4796 | + ;; |
4797 | + |
4798 | + -inst-prefix-dir) |
4799 | + prev=inst_prefix |
4800 | + continue |
4801 | + ;; |
4802 | + |
4803 | + # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* |
4804 | + # so, if we see these flags be careful not to treat them like -L |
4805 | + -L[A-Z][A-Z]*:*) |
4806 | + case $with_gcc/$host in |
4807 | + no/*-*-irix* | /*-*-irix*) |
4808 | + func_append compile_command " $arg" |
4809 | + func_append finalize_command " $arg" |
4810 | + ;; |
4811 | + esac |
4812 | + continue |
4813 | + ;; |
4814 | + |
4815 | + -L*) |
4816 | + func_stripname '-L' '' "$arg" |
4817 | + dir=$func_stripname_result |
4818 | + if test -z "$dir"; then |
4819 | + if test "$#" -gt 0; then |
4820 | + func_fatal_error "require no space between \`-L' and \`$1'" |
4821 | + else |
4822 | + func_fatal_error "need path for \`-L' option" |
4823 | + fi |
4824 | + fi |
4825 | + # We need an absolute path. |
4826 | + case $dir in |
4827 | + [\\/]* | [A-Za-z]:[\\/]*) ;; |
4828 | + *) |
4829 | + absdir=`cd "$dir" && pwd` |
4830 | + test -z "$absdir" && \ |
4831 | + func_fatal_error "cannot determine absolute directory name of \`$dir'" |
4832 | + dir="$absdir" |
4833 | + ;; |
4834 | + esac |
4835 | + case "$deplibs " in |
4836 | + *" -L$dir "*) ;; |
4837 | + *) |
4838 | + deplibs="$deplibs -L$dir" |
4839 | + lib_search_path="$lib_search_path $dir" |
4840 | + ;; |
4841 | + esac |
4842 | + case $host in |
4843 | + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) |
4844 | + testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` |
4845 | + case :$dllsearchpath: in |
4846 | + *":$dir:"*) ;; |
4847 | + ::) dllsearchpath=$dir;; |
4848 | + *) dllsearchpath="$dllsearchpath:$dir";; |
4849 | + esac |
4850 | + case :$dllsearchpath: in |
4851 | + *":$testbindir:"*) ;; |
4852 | + ::) dllsearchpath=$testbindir;; |
4853 | + *) dllsearchpath="$dllsearchpath:$testbindir";; |
4854 | + esac |
4855 | + ;; |
4856 | + esac |
4857 | + continue |
4858 | + ;; |
4859 | + |
4860 | + -l*) |
4861 | + if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then |
4862 | + case $host in |
4863 | + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) |
4864 | + # These systems don't actually have a C or math library (as such) |
4865 | + continue |
4866 | + ;; |
4867 | + *-*-os2*) |
4868 | + # These systems don't actually have a C library (as such) |
4869 | + test "X$arg" = "X-lc" && continue |
4870 | + ;; |
4871 | + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) |
4872 | + # Do not include libc due to us having libc/libc_r. |
4873 | + test "X$arg" = "X-lc" && continue |
4874 | + ;; |
4875 | + *-*-rhapsody* | *-*-darwin1.[012]) |
4876 | + # Rhapsody C and math libraries are in the System framework |
4877 | + deplibs="$deplibs System.ltframework" |
4878 | + continue |
4879 | + ;; |
4880 | + *-*-sco3.2v5* | *-*-sco5v6*) |
4881 | + # Causes problems with __ctype |
4882 | + test "X$arg" = "X-lc" && continue |
4883 | + ;; |
4884 | + *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) |
4885 | + # Compiler inserts libc in the correct place for threads to work |
4886 | + test "X$arg" = "X-lc" && continue |
4887 | + ;; |
4888 | + esac |
4889 | + elif test "X$arg" = "X-lc_r"; then |
4890 | + case $host in |
4891 | + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) |
4892 | + # Do not include libc_r directly, use -pthread flag. |
4893 | + continue |
4894 | + ;; |
4895 | + esac |
4896 | + fi |
4897 | + deplibs="$deplibs $arg" |
4898 | + continue |
4899 | + ;; |
4900 | + |
4901 | + -module) |
4902 | + module=yes |
4903 | + continue |
4904 | + ;; |
4905 | + |
4906 | + # Tru64 UNIX uses -model [arg] to determine the layout of C++ |
4907 | + # classes, name mangling, and exception handling. |
4908 | + # Darwin uses the -arch flag to determine output architecture. |
4909 | + -model|-arch|-isysroot) |
4910 | + compiler_flags="$compiler_flags $arg" |
4911 | + func_append compile_command " $arg" |
4912 | + func_append finalize_command " $arg" |
4913 | + prev=xcompiler |
4914 | + continue |
4915 | + ;; |
4916 | + |
4917 | + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) |
4918 | + compiler_flags="$compiler_flags $arg" |
4919 | + func_append compile_command " $arg" |
4920 | + func_append finalize_command " $arg" |
4921 | + case "$new_inherited_linker_flags " in |
4922 | + *" $arg "*) ;; |
4923 | + * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;; |
4924 | + esac |
4925 | + continue |
4926 | + ;; |
4927 | + |
4928 | + -multi_module) |
4929 | + single_module="${wl}-multi_module" |
4930 | + continue |
4931 | + ;; |
4932 | + |
4933 | + -no-fast-install) |
4934 | + fast_install=no |
4935 | + continue |
4936 | + ;; |
4937 | + |
4938 | + -no-install) |
4939 | + case $host in |
4940 | + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) |
4941 | + # The PATH hackery in wrapper scripts is required on Windows |
4942 | + # and Darwin in order for the loader to find any dlls it needs. |
4943 | + func_warning "\`-no-install' is ignored for $host" |
4944 | + func_warning "assuming \`-no-fast-install' instead" |
4945 | + fast_install=no |
4946 | + ;; |
4947 | + *) no_install=yes ;; |
4948 | + esac |
4949 | + continue |
4950 | + ;; |
4951 | + |
4952 | + -no-undefined) |
4953 | + allow_undefined=no |
4954 | + continue |
4955 | + ;; |
4956 | + |
4957 | + -objectlist) |
4958 | + prev=objectlist |
4959 | + continue |
4960 | + ;; |
4961 | + |
4962 | + -o) prev=output ;; |
4963 | + |
4964 | + -precious-files-regex) |
4965 | + prev=precious_regex |
4966 | + continue |
4967 | + ;; |
4968 | + |
4969 | + -release) |
4970 | + prev=release |
4971 | + continue |
4972 | + ;; |
4973 | + |
4974 | + -rpath) |
4975 | + prev=rpath |
4976 | + continue |
4977 | + ;; |
4978 | + |
4979 | + -R) |
4980 | + prev=xrpath |
4981 | + continue |
4982 | + ;; |
4983 | + |
4984 | + -R*) |
4985 | + func_stripname '-R' '' "$arg" |
4986 | + dir=$func_stripname_result |
4987 | + # We need an absolute path. |
4988 | + case $dir in |
4989 | + [\\/]* | [A-Za-z]:[\\/]*) ;; |
4990 | + *) |
4991 | + func_fatal_error "only absolute run-paths are allowed" |
4992 | + ;; |
4993 | + esac |
4994 | + case "$xrpath " in |
4995 | + *" $dir "*) ;; |
4996 | + *) xrpath="$xrpath $dir" ;; |
4997 | + esac |
4998 | + continue |
4999 | + ;; |
5000 | + |
The diff has been truncated for viewing.