1 | #! /bin/sh |
---|
2 | ## DO NOT EDIT - This file generated from ./build-aux/ltmain.in |
---|
3 | ##Â Â Â Â Â Â Â Â by inline-source v2014-01-03.01 |
---|
4 | |
---|
5 | # libtool (GNU libtool) 2.4.6 |
---|
6 | # Provide generalized library-building support services. |
---|
7 | # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 |
---|
8 | |
---|
9 | # Copyright (C) 1996-2015 Free Software Foundation, Inc. |
---|
10 | # This is free software; see the source for copying conditions. There is NO |
---|
11 | # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
---|
12 | |
---|
13 | # GNU Libtool is free software; you can redistribute it and/or modify |
---|
14 | # it under the terms of the GNU General Public License as published by |
---|
15 | # the Free Software Foundation; either version 2 of the License, or |
---|
16 | # (at your option) any later version. |
---|
17 | # |
---|
18 | # As a special exception to the GNU General Public License, |
---|
19 | # if you distribute this file as part of a program or library that |
---|
20 | # is built using GNU Libtool, you may include this file under the |
---|
21 | # same distribution terms that you use for the rest of that program. |
---|
22 | # |
---|
23 | # GNU Libtool is distributed in the hope that it will be useful, but |
---|
24 | # WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
25 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
26 | # General Public License for more details. |
---|
27 | # |
---|
28 | # You should have received a copy of the GNU General Public License |
---|
29 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
---|
30 | |
---|
31 | |
---|
32 | PROGRAM=libtool |
---|
33 | PACKAGE=libtool |
---|
34 | VERSION=2.4.6 |
---|
35 | package_revision=2.4.6 |
---|
36 | |
---|
37 | |
---|
38 | ## ------ ## |
---|
39 | ## Usage. ## |
---|
40 | ## ------ ## |
---|
41 | |
---|
42 | # Run './libtool --help' for help with using this script from the |
---|
43 | # command line. |
---|
44 | |
---|
45 | |
---|
46 | ## ------------------------------- ## |
---|
47 | ## User overridable command paths. ## |
---|
48 | ## ------------------------------- ## |
---|
49 | |
---|
50 | # After configure completes, it has a better idea of some of the |
---|
51 | # shell tools we need than the defaults used by the functions shared |
---|
52 | # with bootstrap, so set those here where they can still be over- |
---|
53 | # ridden by the user, but otherwise take precedence. |
---|
54 | |
---|
55 | : ${AUTOCONF="autoconf"} |
---|
56 | : ${AUTOMAKE="automake"} |
---|
57 | |
---|
58 | |
---|
59 | ## -------------------------- ## |
---|
60 | ## Source external libraries. ## |
---|
61 | ## -------------------------- ## |
---|
62 | |
---|
63 | # Much of our low-level functionality needs to be sourced from external |
---|
64 | # libraries, which are installed to $pkgauxdir. |
---|
65 | |
---|
66 | # Set a version string for this script. |
---|
67 | scriptversion=2015-01-20.17; # UTC |
---|
68 | |
---|
69 | # General shell script boiler plate, and helper functions. |
---|
70 | # Written by Gary V. Vaughan, 2004 |
---|
71 | |
---|
72 | # Copyright (C) 2004-2015 Free Software Foundation, Inc. |
---|
73 | # This is free software; see the source for copying conditions. There is NO |
---|
74 | # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
---|
75 | |
---|
76 | # This program is free software; you can redistribute it and/or modify |
---|
77 | # it under the terms of the GNU General Public License as published by |
---|
78 | # the Free Software Foundation; either version 3 of the License, or |
---|
79 | # (at your option) any later version. |
---|
80 | |
---|
81 | # As a special exception to the GNU General Public License, if you distribute |
---|
82 | # this file as part of a program or library that is built using GNU Libtool, |
---|
83 | # you may include this file under the same distribution terms that you use |
---|
84 | # for the rest of that program. |
---|
85 | |
---|
86 | # This program is distributed in the hope that it will be useful, |
---|
87 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
88 | # MERCHANTABILITY or FITNES FOR A PARTICULAR PURPOSE. See the GNU |
---|
89 | # General Public License for more details. |
---|
90 | |
---|
91 | # You should have received a copy of the GNU General Public License |
---|
92 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
---|
93 | |
---|
94 | # Please report bugs or propose patches to gary@gnu.org. |
---|
95 | |
---|
96 | |
---|
97 | ## ------ ## |
---|
98 | ## Usage. ## |
---|
99 | ## ------ ## |
---|
100 | |
---|
101 | # Evaluate this file near the top of your script to gain access to |
---|
102 | # the functions and variables defined here: |
---|
103 | # |
---|
104 | #Â Â . `echo "$0" | ${SED-sed} 's|[^/]*$||'`/build-aux/funclib.sh |
---|
105 | # |
---|
106 | # If you need to override any of the default environment variable |
---|
107 | # settings, do that before evaluating this file. |
---|
108 | |
---|
109 | |
---|
110 | ## -------------------- ## |
---|
111 | ## Shell normalisation. ## |
---|
112 | ## -------------------- ## |
---|
113 | |
---|
114 | # Some shells need a little help to be as Bourne compatible as possible. |
---|
115 | # Before doing anything else, make sure all that help has been provided! |
---|
116 | |
---|
117 | DUALCASE=1; export DUALCASE # for MKS sh |
---|
118 | if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : |
---|
119 | Â emulate sh |
---|
120 | Â NULLCMD=: |
---|
121 | Â # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which |
---|
122 |  # is contrary to our usage. Disable this feature. |
---|
123 |  alias -g '${1+"$@"}'='"$@"' |
---|
124 | Â setopt NO_GLOB_SUBST |
---|
125 | else |
---|
126 |  case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac |
---|
127 | fi |
---|
128 | |
---|
129 | # NLS nuisances: We save the old values in case they are required later. |
---|
130 | _G_user_locale= |
---|
131 | _G_safe_locale= |
---|
132 | for _G_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES |
---|
133 | do |
---|
134 |  eval "if test set = \"\${$_G_var+set}\"; then |
---|
135 | Â Â Â Â Â save_$_G_var=\$$_G_var |
---|
136 | Â Â Â Â Â $_G_var=C |
---|
137 | Â Â Â Â Â export $_G_var |
---|
138 | Â Â Â Â Â _G_user_locale=\"$_G_var=\\\$save_\$_G_var; \$_G_user_locale\" |
---|
139 | Â Â Â Â Â _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\" |
---|
140 | Â Â Â Â fi" |
---|
141 | done |
---|
142 | |
---|
143 | # CDPATH. |
---|
144 | (unset CDPATH)Â >/dev/null 2>&1 &&Â unset CDPATH |
---|
145 | |
---|
146 | # Make sure IFS has a sensible default |
---|
147 | sp=' ' |
---|
148 | nl=' |
---|
149 | ' |
---|
150 | IFS="$sp    $nl" |
---|
151 | |
---|
152 | # There are apparently some retarded systems that use ';' as a PATH separator! |
---|
153 | if test "${PATH_SEPARATOR+set}" != set; then |
---|
154 | Â PATH_SEPARATOR=: |
---|
155 | Â (PATH='/bin;/bin'; FPATH=$PATH; sh -c :)Â >/dev/null 2>&1 &&Â { |
---|
156 | Â Â (PATH='/bin:/bin'; FPATH=$PATH; sh -c :)Â >/dev/null 2>&1 || |
---|
157 | Â Â Â PATH_SEPARATOR=';' |
---|
158 | Â } |
---|
159 | fi |
---|
160 | |
---|
161 | |
---|
162 | |
---|
163 | ## ------------------------- ## |
---|
164 | ## Locate command utilities. ## |
---|
165 | ## ------------------------- ## |
---|
166 | |
---|
167 | |
---|
168 | # func_executable_p FILE |
---|
169 | # ---------------------- |
---|
170 | # Check that FILE is an executable regular file. |
---|
171 | func_executable_p () |
---|
172 | { |
---|
173 |   test -f "$1" && test -x "$1" |
---|
174 | } |
---|
175 | |
---|
176 | |
---|
177 | # func_path_progs PROGS_LIST CHECK_FUNC [PATH] |
---|
178 | # -------------------------------------------- |
---|
179 | # Search for either a program that responds to --version with output |
---|
180 | # containing "GNU", or else returned by CHECK_FUNC otherwise, by |
---|
181 | # trying all the directories in PATH with each of the elements of |
---|
182 | # PROGS_LIST. |
---|
183 | # |
---|
184 | # CHECK_FUNC should accept the path to a candidate program, and |
---|
185 | # set $func_check_prog_result if it truncates its output less than |
---|
186 | # $_G_path_prog_max characters. |
---|
187 | func_path_progs () |
---|
188 | { |
---|
189 | Â Â _G_progs_list=$1 |
---|
190 | Â Â _G_check_func=$2 |
---|
191 | Â Â _G_PATH=${3-"$PATH"} |
---|
192 | |
---|
193 | Â Â _G_path_prog_max=0 |
---|
194 | Â Â _G_path_prog_found=false |
---|
195 | Â Â _G_save_IFS=$IFS; IFS=${PATH_SEPARATOR-:} |
---|
196 | Â Â for _G_dir in $_G_PATH; do |
---|
197 | Â Â Â IFS=$_G_save_IFS |
---|
198 |    test -z "$_G_dir" && _G_dir=. |
---|
199 | Â Â Â for _G_prog_name in $_G_progs_list; do |
---|
200 | Â Â Â Â for _exeext in ''Â .EXE; do |
---|
201 | Â Â Â Â Â _G_path_prog=$_G_dir/$_G_prog_name$_exeext |
---|
202 | Â Â Â Â Â func_executable_p "$_G_path_prog"Â ||Â continue |
---|
203 |      case `"$_G_path_prog" --version 2>&1` in |
---|
204 |       *GNU*) func_path_progs_result=$_G_path_prog _G_path_prog_found=: ;; |
---|
205 |       *)   $_G_check_func $_G_path_prog |
---|
206 | Â Â Â Â Â Â Â Â Â Â func_path_progs_result=$func_check_prog_result |
---|
207 | Â Â Â Â Â Â Â Â Â Â ;; |
---|
208 | Â Â Â Â Â esac |
---|
209 |      $_G_path_prog_found && break 3 |
---|
210 | Â Â Â Â done |
---|
211 | Â Â Â done |
---|
212 | Â Â done |
---|
213 | Â Â IFS=$_G_save_IFS |
---|
214 |   test -z "$func_path_progs_result" && { |
---|
215 |    echo "no acceptable sed could be found in \$PATH" >&2 |
---|
216 | Â Â Â exit 1 |
---|
217 | Â Â } |
---|
218 | } |
---|
219 | |
---|
220 | |
---|
221 | # We want to be able to use the functions in this file before configure |
---|
222 | # has figured out where the best binaries are kept, which means we have |
---|
223 | # to search for them ourselves - except when the results are already set |
---|
224 | # where we skip the searches. |
---|
225 | |
---|
226 | # Unless the user overrides by setting SED, search the path for either GNU |
---|
227 | # sed, or the sed that truncates its output the least. |
---|
228 | test -z "$SED" && { |
---|
229 | Â _G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ |
---|
230 | Â for _G_i in 1 2 3 4 5 6 7; do |
---|
231 | Â Â _G_sed_script=$_G_sed_script$nl$_G_sed_script |
---|
232 | Â done |
---|
233 |  echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed |
---|
234 | Â _G_sed_script= |
---|
235 | |
---|
236 | Â func_check_prog_sed () |
---|
237 | Â { |
---|
238 | Â Â _G_path_prog=$1 |
---|
239 | |
---|
240 | Â Â _G_count=0 |
---|
241 | Â Â printf 0123456789 >conftest.in |
---|
242 |   while : |
---|
243 | Â Â do |
---|
244 | Â Â Â cat conftest.in conftest.in >conftest.tmp |
---|
245 | Â Â Â mv conftest.tmp conftest.in |
---|
246 | Â Â Â cp conftest.in conftest.nl |
---|
247 |    echo '' >> conftest.nl |
---|
248 | Â Â Â "$_G_path_prog"Â -f conftest.sed <conftest.nl >conftest.out 2>/dev/null ||Â break |
---|
249 | Â Â Â diff conftest.out conftest.nl >/dev/null 2>&1 ||Â break |
---|
250 |    _G_count=`expr $_G_count + 1` |
---|
251 |    if test "$_G_count" -gt "$_G_path_prog_max"; then |
---|
252 | Â Â Â Â # Best one so far, save it but keep looking for a better one |
---|
253 | Â Â Â Â func_check_prog_result=$_G_path_prog |
---|
254 | Â Â Â Â _G_path_prog_max=$_G_count |
---|
255 | Â Â Â fi |
---|
256 | Â Â Â # 10*(2^10) chars as input seems more than enough |
---|
257 | Â Â Â test 10 -lt "$_G_count"Â &&Â break |
---|
258 | Â Â done |
---|
259 | Â Â rm -f conftest.in conftest.tmp conftest.nl conftest.out |
---|
260 | Â } |
---|
261 | |
---|
262 | Â func_path_progs "sed gsed"Â func_check_prog_sed $PATH:/usr/xpg4/bin |
---|
263 | Â rm -f conftest.sed |
---|
264 | Â SED=$func_path_progs_result |
---|
265 | } |
---|
266 | |
---|
267 | |
---|
268 | # Unless the user overrides by setting GREP, search the path for either GNU |
---|
269 | # grep, or the grep that truncates its output the least. |
---|
270 | test -z "$GREP" && { |
---|
271 | Â func_check_prog_grep () |
---|
272 | Â { |
---|
273 | Â Â _G_path_prog=$1 |
---|
274 | |
---|
275 | Â Â _G_count=0 |
---|
276 | Â Â _G_path_prog_max=0 |
---|
277 | Â Â printf 0123456789 >conftest.in |
---|
278 |   while : |
---|
279 | Â Â do |
---|
280 | Â Â Â cat conftest.in conftest.in >conftest.tmp |
---|
281 | Â Â Â mv conftest.tmp conftest.in |
---|
282 | Â Â Â cp conftest.in conftest.nl |
---|
283 |    echo 'GREP' >> conftest.nl |
---|
284 | Â Â Â "$_G_path_prog"Â -e 'GREP$'Â -e '-(cannot match)-'Â <conftest.nl >conftest.out 2>/dev/null ||Â break |
---|
285 | Â Â Â diff conftest.out conftest.nl >/dev/null 2>&1 ||Â break |
---|
286 |    _G_count=`expr $_G_count + 1` |
---|
287 |    if test "$_G_count" -gt "$_G_path_prog_max"; then |
---|
288 | Â Â Â Â # Best one so far, save it but keep looking for a better one |
---|
289 | Â Â Â Â func_check_prog_result=$_G_path_prog |
---|
290 | Â Â Â Â _G_path_prog_max=$_G_count |
---|
291 | Â Â Â fi |
---|
292 | Â Â Â # 10*(2^10) chars as input seems more than enough |
---|
293 | Â Â Â test 10 -lt "$_G_count"Â &&Â break |
---|
294 | Â Â done |
---|
295 | Â Â rm -f conftest.in conftest.tmp conftest.nl conftest.out |
---|
296 | Â } |
---|
297 | |
---|
298 | Â func_path_progs "grep ggrep"Â func_check_prog_grep $PATH:/usr/xpg4/bin |
---|
299 | Â GREP=$func_path_progs_result |
---|
300 | } |
---|
301 | |
---|
302 | |
---|
303 | ## ------------------------------- ## |
---|
304 | ## User overridable command paths. ## |
---|
305 | ## ------------------------------- ## |
---|
306 | |
---|
307 | # All uppercase variable names are used for environment variables. These |
---|
308 | # variables can be overridden by the user before calling a script that |
---|
309 | # uses them if a suitable command of that name is not already available |
---|
310 | # in the command search PATH. |
---|
311 | |
---|
312 | : ${CP="cp -f"} |
---|
313 | : ${ECHO="printf %s\n"} |
---|
314 | : ${EGREP="$GREP -E"} |
---|
315 | : ${FGREP="$GREP -F"} |
---|
316 | : ${LN_S="ln -s"} |
---|
317 | : ${MAKE="make"} |
---|
318 | : ${MKDIR="mkdir"} |
---|
319 | : ${MV="mv -f"} |
---|
320 | : ${RM="rm -f"} |
---|
321 | : ${SHELL="${CONFIG_SHELL-/bin/sh}"} |
---|
322 | |
---|
323 | |
---|
324 | ## -------------------- ## |
---|
325 | ## Useful sed snippets. ## |
---|
326 | ## -------------------- ## |
---|
327 | |
---|
328 | sed_dirname='s|/[^/]*$||' |
---|
329 | sed_basename='s|^.*/||' |
---|
330 | |
---|
331 | # Sed substitution that helps us do robust quoting. It backslashifies |
---|
332 | # metacharacters that are still active within double-quoted strings. |
---|
333 | sed_quote_subst='s|\([`"$\\]\)|\\\1|g' |
---|
334 | |
---|
335 | # Same as above, but do not quote variable references. |
---|
336 | sed_double_quote_subst='s/\(["`\\]\)/\\\1/g' |
---|
337 | |
---|
338 | # Sed substitution that turns a string into a regex matching for the |
---|
339 | # string literally. |
---|
340 | sed_make_literal_regex='s|[].[^$\\*\/]|\\&|g' |
---|
341 | |
---|
342 | # Sed substitution that converts a w32 file name or path |
---|
343 | # that contains forward slashes, into one that contains |
---|
344 | # (escaped) backslashes. A very naive implementation. |
---|
345 | sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' |
---|
346 | |
---|
347 | # Re-'\' parameter expansions in output of sed_double_quote_subst that |
---|
348 | # were '\'-ed in input to the same. If an odd number of '\' preceded a |
---|
349 | # '$' in input to sed_double_quote_subst, that '$' was protected from |
---|
350 | # expansion. Since each input '\' is now two '\'s, look for any number |
---|
351 | # of runs of four '\'s followed by two '\'s and then a '$'. '\' that '$'. |
---|
352 | _G_bs='\\' |
---|
353 | _G_bs2='\\\\' |
---|
354 | _G_bs4='\\\\\\\\' |
---|
355 | _G_dollar='\$' |
---|
356 | sed_double_backslash="\ |
---|
357 | Â s/$_G_bs4/&\\ |
---|
358 | /g |
---|
359 | Â s/^$_G_bs2$_G_dollar/$_G_bs&/ |
---|
360 | Â s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g |
---|
361 | Â s/\n//g" |
---|
362 | |
---|
363 | |
---|
364 | ## ----------------- ## |
---|
365 | ## Global variables. ## |
---|
366 | ## ----------------- ## |
---|
367 | |
---|
368 | # Except for the global variables explicitly listed below, the following |
---|
369 | # functions in the '^func_' namespace, and the '^require_' namespace |
---|
370 | # variables initialised in the 'Resource management' section, sourcing |
---|
371 | # this file will not pollute your global namespace with anything |
---|
372 | # else. There's no portable way to scope variables in Bourne shell |
---|
373 | # though, so actually running these functions will sometimes place |
---|
374 | # results into a variable named after the function, and often use |
---|
375 | # temporary variables in the '^_G_' namespace. If you are careful to |
---|
376 | # avoid using those namespaces casually in your sourcing script, things |
---|
377 | # should continue to work as you expect. And, of course, you can freely |
---|
378 | # overwrite any of the functions or variables defined here before |
---|
379 | # calling anything to customize them. |
---|
380 | |
---|
381 | EXIT_SUCCESS=0 |
---|
382 | EXIT_FAILURE=1 |
---|
383 | EXIT_MISMATCH=63Â # $? = 63 is used to indicate version mismatch to missing. |
---|
384 | EXIT_SKIP=77Â Â Â # $? = 77 is used to indicate a skipped test to automake. |
---|
385 | |
---|
386 | # Allow overriding, eg assuming that you follow the convention of |
---|
387 | # putting '$debug_cmd' at the start of all your functions, you can get |
---|
388 | # bash to show function call trace with: |
---|
389 | # |
---|
390 | #Â Â debug_cmd='eval echo "${FUNCNAME[0]} $*" >&2' bash your-script-name |
---|
391 | debug_cmd=${debug_cmd-":"} |
---|
392 | exit_cmd=: |
---|
393 | |
---|
394 | # By convention, finish your script with: |
---|
395 | # |
---|
396 | #Â Â exit $exit_status |
---|
397 | # |
---|
398 | # so that you can set exit_status to non-zero if you want to indicate |
---|
399 | # something went wrong during execution without actually bailing out at |
---|
400 | # the point of failure. |
---|
401 | exit_status=$EXIT_SUCCESS |
---|
402 | |
---|
403 | # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh |
---|
404 | # is ksh but when the shell is invoked as "sh" and the current value of |
---|
405 | # the _XPG environment variable is not equal to 1 (one), the special |
---|
406 | # positional parameter $0, within a function call, is the name of the |
---|
407 | # function. |
---|
408 | progpath=$0 |
---|
409 | |
---|
410 | # The name of this program. |
---|
411 | progname=`$ECHOÂ "$progpath"Â |$SEDÂ "$sed_basename"` |
---|
412 | |
---|
413 | # Make sure we have an absolute progpath for reexecution: |
---|
414 | case $progpath in |
---|
415 | Â [\\/]*|[A-Za-z]:\\*)Â ;; |
---|
416 | Â *[\\/]*) |
---|
417 | Â Â Â progdir=`$ECHOÂ "$progpath"Â |$SEDÂ "$sed_dirname"` |
---|
418 |    progdir=`cd "$progdir" && pwd` |
---|
419 | Â Â Â progpath=$progdir/$progname |
---|
420 | Â Â Â ;; |
---|
421 | Â *) |
---|
422 | Â Â Â _G_IFS=$IFS |
---|
423 | Â Â Â IFS=${PATH_SEPARATOR-:} |
---|
424 | Â Â Â for progdir in $PATH; do |
---|
425 | Â Â Â Â IFS=$_G_IFS |
---|
426 |     test -x "$progdir/$progname" && break |
---|
427 | Â Â Â done |
---|
428 | Â Â Â IFS=$_G_IFS |
---|
429 |    test -n "$progdir" || progdir=`pwd` |
---|
430 | Â Â Â progpath=$progdir/$progname |
---|
431 | Â Â Â ;; |
---|
432 | esac |
---|
433 | |
---|
434 | |
---|
435 | ## ----------------- ## |
---|
436 | ## Standard options. ## |
---|
437 | ## ----------------- ## |
---|
438 | |
---|
439 | # The following options affect the operation of the functions defined |
---|
440 | # below, and should be set appropriately depending on run-time para- |
---|
441 | # meters passed on the command line. |
---|
442 | |
---|
443 | opt_dry_run=false |
---|
444 | opt_quiet=false |
---|
445 | opt_verbose=false |
---|
446 | |
---|
447 | # Categories 'all' and 'none' are always available. Append any others |
---|
448 | # you will pass as the first argument to func_warning from your own |
---|
449 | # code. |
---|
450 | warning_categories= |
---|
451 | |
---|
452 | # By default, display warnings according to 'opt_warning_types'. Set |
---|
453 | # 'warning_func'Â to ':' to elide all warnings, or func_fatal_error to |
---|
454 | # treat the next displayed warning as a fatal error. |
---|
455 | warning_func=func_warn_and_continue |
---|
456 | |
---|
457 | # Set to 'all' to display all warnings, 'none' to suppress all |
---|
458 | # warnings, or a space delimited list of some subset of |
---|
459 | # 'warning_categories' to display only the listed warnings. |
---|
460 | opt_warning_types=all |
---|
461 | |
---|
462 | |
---|
463 | ## -------------------- ## |
---|
464 | ## Resource management. ## |
---|
465 | ## -------------------- ## |
---|
466 | |
---|
467 | # This section contains definitions for functions that each ensure a |
---|
468 | # particular resource (a file, or a non-empty configuration variable for |
---|
469 | # example) is available, and if appropriate to extract default values |
---|
470 | # from pertinent package files. Call them using their associated |
---|
471 | # 'require_*' variable to ensure that they are executed, at most, once. |
---|
472 | # |
---|
473 | # It's entirely deliberate that calling these functions can set |
---|
474 | # variables that don't obey the namespace limitations obeyed by the rest |
---|
475 | # of this file, in order that that they be as useful as possible to |
---|
476 | # callers. |
---|
477 | |
---|
478 | |
---|
479 | # require_term_colors |
---|
480 | # ------------------- |
---|
481 | # Allow display of bold text on terminals that support it. |
---|
482 | require_term_colors=func_require_term_colors |
---|
483 | func_require_term_colors () |
---|
484 | { |
---|
485 | Â Â $debug_cmd |
---|
486 | |
---|
487 |   test -t 1 && { |
---|
488 | Â Â Â # COLORTERM and USE_ANSI_COLORS environment variables take |
---|
489 | Â Â Â # precedence, because most terminfo databases neglect to describe |
---|
490 | Â Â Â # whether color sequences are supported. |
---|
491 |    test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"} |
---|
492 | |
---|
493 | Â Â Â if test 1Â =Â "$USE_ANSI_COLORS"; then |
---|
494 | Â Â Â Â # Standard ANSI escape sequences |
---|
495 | Â Â Â Â tc_reset='[0m' |
---|
496 | Â Â Â Â tc_bold='[1m';Â Â tc_standout='[7m' |
---|
497 | Â Â Â Â tc_red='[31m';Â Â tc_green='[32m' |
---|
498 | Â Â Â Â tc_blue='[34m';Â tc_cyan='[36m' |
---|
499 | Â Â Â else |
---|
500 | Â Â Â Â # Otherwise trust the terminfo database after all. |
---|
501 |     test -n "`tput sgr0 2>/dev/null`" && { |
---|
502 | Â Â Â Â Â tc_reset=`tput sgr0` |
---|
503 |      test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold` |
---|
504 | Â Â Â Â Â tc_standout=$tc_bold |
---|
505 |      test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso` |
---|
506 |      test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1` |
---|
507 |      test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2` |
---|
508 |      test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4` |
---|
509 |      test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5` |
---|
510 | Â Â Â Â } |
---|
511 | Â Â Â fi |
---|
512 | Â Â } |
---|
513 | |
---|
514 | Â Â require_term_colors=: |
---|
515 | } |
---|
516 | |
---|
517 | |
---|
518 | ## ----------------- ## |
---|
519 | ## Function library. ## |
---|
520 | ## ----------------- ## |
---|
521 | |
---|
522 | # This section contains a variety of useful functions to call in your |
---|
523 | # scripts. Take note of the portable wrappers for features provided by |
---|
524 | # some modern shells, which will fall back to slower equivalents on |
---|
525 | # less featureful shells. |
---|
526 | |
---|
527 | |
---|
528 | # func_append VAR VALUE |
---|
529 | # --------------------- |
---|
530 | # Append VALUE onto the existing contents of VAR. |
---|
531 | |
---|
532 | Â # We should try to minimise forks, especially on Windows where they are |
---|
533 | Â # unreasonably slow, so skip the feature probes when bash or zsh are |
---|
534 | Â # being used: |
---|
535 |  if test set = "${BASH_VERSION+set}${ZSH_VERSION+set}"; then |
---|
536 | Â Â : ${_G_HAVE_ARITH_OP="yes"} |
---|
537 | Â Â : ${_G_HAVE_XSI_OPS="yes"} |
---|
538 | Â Â # The += operator was introduced in bash 3.1 |
---|
539 |   case $BASH_VERSION in |
---|
540 | Â Â Â [12].* | 3.0 | 3.0*)Â ;; |
---|
541 | Â Â Â *) |
---|
542 | Â Â Â Â : ${_G_HAVE_PLUSEQ_OP="yes"} |
---|
543 | Â Â Â Â ;; |
---|
544 | Â Â esac |
---|
545 | Â fi |
---|
546 | |
---|
547 | Â # _G_HAVE_PLUSEQ_OP |
---|
548 | Â # Can be empty, in which case the shell is probed, "yes" if += is |
---|
549 | Â # useable or anything else if it does not work. |
---|
550 |  test -z "$_G_HAVE_PLUSEQ_OP" \ |
---|
551 |   && (eval 'x=a; x+=" b"; test "a b" = "$x"') 2>/dev/null \ |
---|
552 | Â Â &&Â _G_HAVE_PLUSEQ_OP=yes |
---|
553 | |
---|
554 | if test yes = "$_G_HAVE_PLUSEQ_OP" |
---|
555 | then |
---|
556 | Â # This is an XSI compatible shell, allowing a faster implementation... |
---|
557 |  eval 'func_append () |
---|
558 | Â { |
---|
559 | Â Â $debug_cmd |
---|
560 | |
---|
561 | Â Â eval "$1+=\$2" |
---|
562 | Â }' |
---|
563 | else |
---|
564 | Â # ...otherwise fall back to using expr, which is often a shell builtin. |
---|
565 | Â func_append () |
---|
566 | Â { |
---|
567 | Â Â $debug_cmd |
---|
568 | |
---|
569 |   eval "$1=\$$1\$2" |
---|
570 | Â } |
---|
571 | fi |
---|
572 | |
---|
573 | |
---|
574 | # func_append_quoted VAR VALUE |
---|
575 | # ---------------------------- |
---|
576 | # Quote VALUE and append to the end of shell variable VAR, separated |
---|
577 | # by a space. |
---|
578 | if test yes = "$_G_HAVE_PLUSEQ_OP"; then |
---|
579 |  eval 'func_append_quoted () |
---|
580 | Â { |
---|
581 | Â Â $debug_cmd |
---|
582 | |
---|
583 | Â Â func_quote_for_eval "$2" |
---|
584 | Â Â eval "$1+=\\ \$func_quote_for_eval_result" |
---|
585 | Â }' |
---|
586 | else |
---|
587 | Â func_append_quoted () |
---|
588 | Â { |
---|
589 | Â Â $debug_cmd |
---|
590 | |
---|
591 | Â Â func_quote_for_eval "$2" |
---|
592 |   eval "$1=\$$1\\ \$func_quote_for_eval_result" |
---|
593 | Â } |
---|
594 | fi |
---|
595 | |
---|
596 | |
---|
597 | # func_append_uniq VAR VALUE |
---|
598 | # -------------------------- |
---|
599 | # Append unique VALUE onto the existing contents of VAR, assuming |
---|
600 | # entries are delimited by the first character of VALUE. For example: |
---|
601 | # |
---|
602 | #Â Â func_append_uniq options " --another-option option-argument" |
---|
603 | # |
---|
604 | # will only append to $options if " --another-option option-argument " |
---|
605 | # is not already present somewhere in $options already (note spaces at |
---|
606 | # each end implied by leading space in second argument). |
---|
607 | func_append_uniq () |
---|
608 | { |
---|
609 | Â Â $debug_cmd |
---|
610 | |
---|
611 | Â Â eval _G_current_value='`$ECHO $'$1'`' |
---|
612 | Â Â _G_delim=`expr "$2"Â : '\(.\)'` |
---|
613 | |
---|
614 |   case $_G_delim$_G_current_value$_G_delim in |
---|
615 | Â Â Â *"$2$_G_delim"*)Â ;; |
---|
616 | Â Â Â *)Â func_append "$@"Â ;; |
---|
617 | Â Â esac |
---|
618 | } |
---|
619 | |
---|
620 | |
---|
621 | # func_arith TERM... |
---|
622 | # ------------------ |
---|
623 | # Set func_arith_result to the result of evaluating TERMs. |
---|
624 |  test -z "$_G_HAVE_ARITH_OP" \ |
---|
625 |   && (eval 'test 2 = $(( 1 + 1 ))') 2>/dev/null \ |
---|
626 | Â Â &&Â _G_HAVE_ARITH_OP=yes |
---|
627 | |
---|
628 | if test yes = "$_G_HAVE_ARITH_OP"; then |
---|
629 |  eval 'func_arith () |
---|
630 | Â { |
---|
631 | Â Â $debug_cmd |
---|
632 | |
---|
633 | Â Â func_arith_result=$(( $* )) |
---|
634 | Â }' |
---|
635 | else |
---|
636 | Â func_arith () |
---|
637 | Â { |
---|
638 | Â Â $debug_cmd |
---|
639 | |
---|
640 | Â Â func_arith_result=`expr "$@"` |
---|
641 | Â } |
---|
642 | fi |
---|
643 | |
---|
644 | |
---|
645 | # func_basename FILE |
---|
646 | # ------------------ |
---|
647 | # Set func_basename_result to FILE with everything up to and including |
---|
648 | # the last / stripped. |
---|
649 | if test yes = "$_G_HAVE_XSI_OPS"; then |
---|
650 | Â # If this shell supports suffix pattern removal, then use it to avoid |
---|
651 | Â # forking. Hide the definitions single quotes in case the shell chokes |
---|
652 | Â # on unsupported syntax... |
---|
653 | Â _b='func_basename_result=${1##*/}' |
---|
654 | Â _d='case $1 in |
---|
655 | Â Â Â Â */*) func_dirname_result=${1%/*}$2 ;; |
---|
656 | Â Â Â Â *Â ) func_dirname_result=$3Â Â Â Â ;; |
---|
657 | Â Â Â esac' |
---|
658 | |
---|
659 | else |
---|
660 | Â # ...otherwise fall back to using sed. |
---|
661 | Â _b='func_basename_result=`$ECHO "$1" |$SED "$sed_basename"`' |
---|
662 | Â _d='func_dirname_result=`$ECHO "$1"Â |$SED "$sed_dirname"` |
---|
663 | Â Â Â if test "X$func_dirname_result" = "X$1"; then |
---|
664 | Â Â Â Â func_dirname_result=$3 |
---|
665 | Â Â Â else |
---|
666 | Â Â Â Â func_append func_dirname_result "$2" |
---|
667 | Â Â Â fi' |
---|
668 | fi |
---|
669 | |
---|
670 | eval 'func_basename () |
---|
671 | { |
---|
672 | Â Â $debug_cmd |
---|
673 | |
---|
674 | Â Â '"$_b"' |
---|
675 | }' |
---|
676 | |
---|
677 | |
---|
678 | # func_dirname FILE APPEND NONDIR_REPLACEMENT |
---|
679 | # ------------------------------------------- |
---|
680 | # Compute the dirname of FILE. If nonempty, add APPEND to the result, |
---|
681 | # otherwise set result to NONDIR_REPLACEMENT. |
---|
682 | eval 'func_dirname () |
---|
683 | { |
---|
684 | Â Â $debug_cmd |
---|
685 | |
---|
686 | Â Â '"$_d"' |
---|
687 | }' |
---|
688 | |
---|
689 | |
---|
690 | # func_dirname_and_basename FILE APPEND NONDIR_REPLACEMENT |
---|
691 | # -------------------------------------------------------- |
---|
692 | # Perform func_basename and func_dirname in a single function |
---|
693 | # call: |
---|
694 | #  dirname: Compute the dirname of FILE. If nonempty, |
---|
695 | #Â Â Â Â Â Â Â add APPEND to the result, otherwise set result |
---|
696 | #Â Â Â Â Â Â Â to NONDIR_REPLACEMENT. |
---|
697 | #Â Â Â Â Â Â Â value returned in "$func_dirname_result" |
---|
698 | #Â Â basename: Compute filename of FILE. |
---|
699 | #Â Â Â Â Â Â Â value retuned in "$func_basename_result" |
---|
700 | # For efficiency, we do not delegate to the functions above but instead |
---|
701 | # duplicate the functionality here. |
---|
702 | eval 'func_dirname_and_basename () |
---|
703 | { |
---|
704 | Â Â $debug_cmd |
---|
705 | |
---|
706 | Â Â '"$_b"' |
---|
707 | Â Â '"$_d"' |
---|
708 | }' |
---|
709 | |
---|
710 | |
---|
711 | # func_echo ARG... |
---|
712 | # ---------------- |
---|
713 | # Echo program name prefixed message. |
---|
714 | func_echo () |
---|
715 | { |
---|
716 | Â Â $debug_cmd |
---|
717 | |
---|
718 | Â Â _G_message=$* |
---|
719 | |
---|
720 | Â Â func_echo_IFS=$IFS |
---|
721 | Â Â IFS=$nl |
---|
722 | Â Â for _G_line in $_G_message; do |
---|
723 | Â Â Â IFS=$func_echo_IFS |
---|
724 | Â Â Â $ECHOÂ "$progname: $_G_line" |
---|
725 | Â Â done |
---|
726 | Â Â IFS=$func_echo_IFS |
---|
727 | } |
---|
728 | |
---|
729 | |
---|
730 | # func_echo_all ARG... |
---|
731 | # -------------------- |
---|
732 | # Invoke $ECHO with all args, space-separated. |
---|
733 | func_echo_all () |
---|
734 | { |
---|
735 | Â Â $ECHOÂ "$*" |
---|
736 | } |
---|
737 | |
---|
738 | |
---|
739 | # func_echo_infix_1 INFIX ARG... |
---|
740 | # ------------------------------ |
---|
741 | # Echo program name, followed by INFIX on the first line, with any |
---|
742 | # additional lines not showing INFIX. |
---|
743 | func_echo_infix_1 () |
---|
744 | { |
---|
745 | Â Â $debug_cmd |
---|
746 | |
---|
747 | Â Â $require_term_colors |
---|
748 | |
---|
749 | Â Â _G_infix=$1; shift |
---|
750 | Â Â _G_indent=$_G_infix |
---|
751 | Â Â _G_prefix="$progname: $_G_infix: " |
---|
752 | Â Â _G_message=$* |
---|
753 | |
---|
754 | Â Â # Strip color escape sequences before counting printable length |
---|
755 | Â Â for _G_tc in "$tc_reset"Â "$tc_bold"Â "$tc_standout"Â "$tc_red"Â "$tc_green"Â "$tc_blue"Â "$tc_cyan" |
---|
756 | Â Â do |
---|
757 |    test -n "$_G_tc" && { |
---|
758 | Â Â Â Â _G_esc_tc=`$ECHOÂ "$_G_tc"Â | $SEDÂ "$sed_make_literal_regex"` |
---|
759 | Â Â Â Â _G_indent=`$ECHOÂ "$_G_indent"Â | $SEDÂ "s|$_G_esc_tc||g"` |
---|
760 | Â Â Â } |
---|
761 | Â Â done |
---|
762 |   _G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`" " ## exclude from sc_prohibit_nested_quotes |
---|
763 | |
---|
764 | Â Â func_echo_infix_1_IFS=$IFS |
---|
765 | Â Â IFS=$nl |
---|
766 | Â Â for _G_line in $_G_message; do |
---|
767 | Â Â Â IFS=$func_echo_infix_1_IFS |
---|
768 | Â Â Â $ECHOÂ "$_G_prefix$tc_bold$_G_line$tc_reset"Â >&2 |
---|
769 | Â Â Â _G_prefix=$_G_indent |
---|
770 | Â Â done |
---|
771 | Â Â IFS=$func_echo_infix_1_IFS |
---|
772 | } |
---|
773 | |
---|
774 | |
---|
775 | # func_error ARG... |
---|
776 | # ----------------- |
---|
777 | # Echo program name prefixed message to standard error. |
---|
778 | func_error () |
---|
779 | { |
---|
780 | Â Â $debug_cmd |
---|
781 | |
---|
782 | Â Â $require_term_colors |
---|
783 | |
---|
784 | Â Â func_echo_infix_1 "Â $tc_standout${tc_red}error$tc_reset"Â "$*"Â >&2 |
---|
785 | } |
---|
786 | |
---|
787 | |
---|
788 | # func_fatal_error ARG... |
---|
789 | # ----------------------- |
---|
790 | # Echo program name prefixed message to standard error, and exit. |
---|
791 | func_fatal_error () |
---|
792 | { |
---|
793 | Â Â $debug_cmd |
---|
794 | |
---|
795 | Â Â func_error "$*" |
---|
796 |   exit $EXIT_FAILURE |
---|
797 | } |
---|
798 | |
---|
799 | |
---|
800 | # func_grep EXPRESSION FILENAME |
---|
801 | # ----------------------------- |
---|
802 | # Check whether EXPRESSION matches any line of FILENAME, without output. |
---|
803 | func_grep () |
---|
804 | { |
---|
805 | Â Â $debug_cmd |
---|
806 | |
---|
807 | Â Â $GREPÂ "$1"Â "$2"Â >/dev/null 2>&1 |
---|
808 | } |
---|
809 | |
---|
810 | |
---|
811 | # func_len STRING |
---|
812 | # --------------- |
---|
813 | # Set func_len_result to the length of STRING. STRING may not |
---|
814 | # start with a hyphen. |
---|
815 |  test -z "$_G_HAVE_XSI_OPS" \ |
---|
816 |   && (eval 'x=a/b/c; |
---|
817 | Â Â Â test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"')Â 2>/dev/null \ |
---|
818 | Â Â &&Â _G_HAVE_XSI_OPS=yes |
---|
819 | |
---|
820 | if test yes = "$_G_HAVE_XSI_OPS"; then |
---|
821 |  eval 'func_len () |
---|
822 | Â { |
---|
823 | Â Â $debug_cmd |
---|
824 | |
---|
825 | Â Â func_len_result=${#1} |
---|
826 | Â }' |
---|
827 | else |
---|
828 | Â func_len () |
---|
829 | Â { |
---|
830 | Â Â $debug_cmd |
---|
831 | |
---|
832 |   func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len` |
---|
833 | Â } |
---|
834 | fi |
---|
835 | |
---|
836 | |
---|
837 | # func_mkdir_p DIRECTORY-PATH |
---|
838 | # --------------------------- |
---|
839 | # Make sure the entire path to DIRECTORY-PATH is available. |
---|
840 | func_mkdir_p () |
---|
841 | { |
---|
842 | Â Â $debug_cmd |
---|
843 | |
---|
844 | Â Â _G_directory_path=$1 |
---|
845 | Â Â _G_dir_list= |
---|
846 | |
---|
847 |   if test -n "$_G_directory_path" && test : != "$opt_dry_run"; then |
---|
848 | |
---|
849 | Â Â Â # Protect directory names starting with '-' |
---|
850 |    case $_G_directory_path in |
---|
851 |     -*) _G_directory_path=./$_G_directory_path ;; |
---|
852 | Â Â Â esac |
---|
853 | |
---|
854 | Â Â Â # While some portion of DIR does not yet exist... |
---|
855 |    while test ! -d "$_G_directory_path"; do |
---|
856 |     # ...make a list in topmost first order. Use a colon delimited |
---|
857 | Â Â Â Â # list incase some portion of path contains whitespace. |
---|
858 | Â Â Â Â _G_dir_list=$_G_directory_path:$_G_dir_list |
---|
859 | |
---|
860 | Â Â Â Â # If the last portion added has no slash in it, the list is done |
---|
861 |     case $_G_directory_path in */*) ;; *) break ;; esac |
---|
862 | |
---|
863 | Â Â Â Â # ...otherwise throw away the child directory and loop |
---|
864 | Â Â Â Â _G_directory_path=`$ECHOÂ "$_G_directory_path"Â | $SEDÂ -e "$sed_dirname"` |
---|
865 | Â Â Â done |
---|
866 | Â Â Â _G_dir_list=`$ECHOÂ "$_G_dir_list"Â | $SEDÂ 's|:*$||'` |
---|
867 | |
---|
868 | Â Â Â func_mkdir_p_IFS=$IFS; IFS=: |
---|
869 | Â Â Â for _G_dir in $_G_dir_list; do |
---|
870 | Â Â Â Â IFS=$func_mkdir_p_IFS |
---|
871 | Â Â Â Â # mkdir can fail with a 'File exist' error if two processes |
---|
872 |     # try to create one of the directories concurrently. Don't |
---|
873 | Â Â Â Â # stop in that case! |
---|
874 | Â Â Â Â $MKDIRÂ "$_G_dir"Â 2>/dev/null ||Â : |
---|
875 | Â Â Â done |
---|
876 | Â Â Â IFS=$func_mkdir_p_IFS |
---|
877 | |
---|
878 | Â Â Â # Bail out if we (or some other process) failed to create a directory. |
---|
879 |    test -d "$_G_directory_path" || \ |
---|
880 | Â Â Â Â func_fatal_error "Failed to create '$1'" |
---|
881 | Â Â fi |
---|
882 | } |
---|
883 | |
---|
884 | |
---|
885 | # func_mktempdir [BASENAME] |
---|
886 | # ------------------------- |
---|
887 | # Make a temporary directory that won't clash with other running |
---|
888 | # libtool processes, and avoids race conditions if possible. If |
---|
889 | # given, BASENAME is the basename for that directory. |
---|
890 | func_mktempdir () |
---|
891 | { |
---|
892 | Â Â $debug_cmd |
---|
893 | |
---|
894 | Â Â _G_template=${TMPDIR-/tmp}/${1-$progname} |
---|
895 | |
---|
896 |   if test : = "$opt_dry_run"; then |
---|
897 | Â Â Â # Return a directory name, but don't create it in dry-run mode |
---|
898 | Â Â Â _G_tmpdir=$_G_template-$$ |
---|
899 | Â Â else |
---|
900 | |
---|
901 | Â Â Â # If mktemp works, use that first and foremost |
---|
902 | Â Â Â _G_tmpdir=`mktemp -d "$_G_template-XXXXXXXX"Â 2>/dev/null` |
---|
903 | |
---|
904 |    if test ! -d "$_G_tmpdir"; then |
---|
905 | Â Â Â Â # Failing that, at least try and use $RANDOM to avoid a race |
---|
906 | Â Â Â Â _G_tmpdir=$_G_template-${RANDOM-0}$$ |
---|
907 | |
---|
908 | Â Â Â Â func_mktempdir_umask=`umask` |
---|
909 | Â Â Â Â umask 0077 |
---|
910 | Â Â Â Â $MKDIRÂ "$_G_tmpdir" |
---|
911 |     umask $func_mktempdir_umask |
---|
912 | Â Â Â fi |
---|
913 | |
---|
914 | Â Â Â # If we're not in dry-run mode, bomb out on failure |
---|
915 |    test -d "$_G_tmpdir" || \ |
---|
916 | Â Â Â Â func_fatal_error "cannot create temporary directory '$_G_tmpdir'" |
---|
917 | Â Â fi |
---|
918 | |
---|
919 | Â Â $ECHOÂ "$_G_tmpdir" |
---|
920 | } |
---|
921 | |
---|
922 | |
---|
923 | # func_normal_abspath PATH |
---|
924 | # ------------------------ |
---|
925 | # Remove doubled-up and trailing slashes, "." path components, |
---|
926 | # and cancel out any ".." path components in PATH after making |
---|
927 | # it an absolute path. |
---|
928 | func_normal_abspath () |
---|
929 | { |
---|
930 | Â Â $debug_cmd |
---|
931 | |
---|
932 | Â Â # These SED scripts presuppose an absolute path with a trailing slash. |
---|
933 | Â Â _G_pathcar='s|^/\([^/]*\).*$|\1|' |
---|
934 | Â Â _G_pathcdr='s|^/[^/]*||' |
---|
935 | Â Â _G_removedotparts=':dotsl |
---|
936 | Â Â Â Â Â Â Â Â s|/\./|/|g |
---|
937 | Â Â Â Â Â Â Â Â t dotsl |
---|
938 | Â Â Â Â Â Â Â Â s|/\.$|/|' |
---|
939 | Â Â _G_collapseslashes='s|/\{1,\}|/|g' |
---|
940 | Â Â _G_finalslash='s|/*$|/|' |
---|
941 | |
---|
942 | Â Â # Start from root dir and reassemble the path. |
---|
943 | Â Â func_normal_abspath_result= |
---|
944 | Â Â func_normal_abspath_tpath=$1 |
---|
945 | Â Â func_normal_abspath_altnamespace= |
---|
946 |   case $func_normal_abspath_tpath in |
---|
947 | Â Â Â "") |
---|
948 | Â Â Â Â # Empty path, that just means $cwd. |
---|
949 | Â Â Â Â func_stripname ''Â '/'Â "`pwd`" |
---|
950 | Â Â Â Â func_normal_abspath_result=$func_stripname_result |
---|
951 | Â Â Â Â return |
---|
952 | Â Â Â Â ;; |
---|
953 | Â Â Â # The next three entries are used to spot a run of precisely |
---|
954 | Â Â Â # two leading slashes without using negated character classes; |
---|
955 | Â Â Â # we take advantage of case's first-match behaviour. |
---|
956 | Â Â Â ///*) |
---|
957 | Â Â Â Â # Unusual form of absolute path, do nothing. |
---|
958 | Â Â Â Â ;; |
---|
959 | Â Â Â //*) |
---|
960 | Â Â Â Â # Not necessarily an ordinary path; POSIX reserves leading '//' |
---|
961 | Â Â Â Â # and for example Cygwin uses it to access remote file shares |
---|
962 | Â Â Â Â # over CIFS/SMB, so we conserve a leading double slash if found. |
---|
963 | Â Â Â Â func_normal_abspath_altnamespace=/ |
---|
964 | Â Â Â Â ;; |
---|
965 | Â Â Â /*) |
---|
966 | Â Â Â Â # Absolute path, do nothing. |
---|
967 | Â Â Â Â ;; |
---|
968 | Â Â Â *) |
---|
969 | Â Â Â Â # Relative path, prepend $cwd. |
---|
970 | Â Â Â Â func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath |
---|
971 | Â Â Â Â ;; |
---|
972 | Â Â esac |
---|
973 | |
---|
974 |   # Cancel out all the simple stuff to save iterations. We also want |
---|
975 | Â Â # the path to end with a slash for ease of parsing, so make sure |
---|
976 | Â Â # there is one (and only one) here. |
---|
977 | Â Â func_normal_abspath_tpath=`$ECHOÂ "$func_normal_abspath_tpath"Â | $SEDÂ \ |
---|
978 | Â Â Â Â Â -e "$_G_removedotparts"Â -e "$_G_collapseslashes"Â -e "$_G_finalslash"` |
---|
979 |   while :; do |
---|
980 | Â Â Â # Processed it all yet? |
---|
981 |    if test / = "$func_normal_abspath_tpath"; then |
---|
982 | Â Â Â Â # If we ascended to the root using ".." the result may be empty now. |
---|
983 |     if test -z "$func_normal_abspath_result"; then |
---|
984 | Â Â Â Â Â func_normal_abspath_result=/ |
---|
985 | Â Â Â Â fi |
---|
986 | Â Â Â Â break |
---|
987 | Â Â Â fi |
---|
988 | Â Â Â func_normal_abspath_tcomponent=`$ECHOÂ "$func_normal_abspath_tpath"Â | $SEDÂ \ |
---|
989 | Â Â Â Â Â -e "$_G_pathcar"` |
---|
990 | Â Â Â func_normal_abspath_tpath=`$ECHOÂ "$func_normal_abspath_tpath"Â | $SEDÂ \ |
---|
991 | Â Â Â Â Â -e "$_G_pathcdr"` |
---|
992 | Â Â Â # Figure out what to do with it |
---|
993 |    case $func_normal_abspath_tcomponent in |
---|
994 | Â Â Â Â "") |
---|
995 | Â Â Â Â Â # Trailing empty path component, ignore it. |
---|
996 | Â Â Â Â Â ;; |
---|
997 | Â Â Â Â ..) |
---|
998 | Â Â Â Â Â # Parent dir; strip last assembled component from result. |
---|
999 | Â Â Â Â Â func_dirname "$func_normal_abspath_result" |
---|
1000 | Â Â Â Â Â func_normal_abspath_result=$func_dirname_result |
---|
1001 | Â Â Â Â Â ;; |
---|
1002 | Â Â Â Â *) |
---|
1003 | Â Â Â Â Â # Actual path component, append it. |
---|
1004 | Â Â Â Â Â func_append func_normal_abspath_result "/$func_normal_abspath_tcomponent" |
---|
1005 | Â Â Â Â Â ;; |
---|
1006 | Â Â Â esac |
---|
1007 | Â Â done |
---|
1008 | Â Â # Restore leading double-slash if one was found on entry. |
---|
1009 | Â Â func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result |
---|
1010 | } |
---|
1011 | |
---|
1012 | |
---|
1013 | # func_notquiet ARG... |
---|
1014 | # -------------------- |
---|
1015 | # Echo program name prefixed message only when not in quiet mode. |
---|
1016 | func_notquiet () |
---|
1017 | { |
---|
1018 | Â Â $debug_cmd |
---|
1019 | |
---|
1020 |   $opt_quiet || func_echo ${1+"$@"} |
---|
1021 | |
---|
1022 | Â Â # A bug in bash halts the script if the last line of a function |
---|
1023 | Â Â # fails when set -e is in force, so we need another command to |
---|
1024 | Â Â # work around that: |
---|
1025 | Â Â : |
---|
1026 | } |
---|
1027 | |
---|
1028 | |
---|
1029 | # func_relative_path SRCDIR DSTDIR |
---|
1030 | # -------------------------------- |
---|
1031 | # Set func_relative_path_result to the relative path from SRCDIR to DSTDIR. |
---|
1032 | func_relative_path () |
---|
1033 | { |
---|
1034 | Â Â $debug_cmd |
---|
1035 | |
---|
1036 | Â Â func_relative_path_result= |
---|
1037 | Â Â func_normal_abspath "$1" |
---|
1038 | Â Â func_relative_path_tlibdir=$func_normal_abspath_result |
---|
1039 | Â Â func_normal_abspath "$2" |
---|
1040 | Â Â func_relative_path_tbindir=$func_normal_abspath_result |
---|
1041 | |
---|
1042 | Â Â # Ascend the tree starting from libdir |
---|
1043 |   while :; do |
---|
1044 | Â Â Â # check if we have found a prefix of bindir |
---|
1045 |    case $func_relative_path_tbindir in |
---|
1046 | Â Â Â Â $func_relative_path_tlibdir) |
---|
1047 | Â Â Â Â Â # found an exact match |
---|
1048 | Â Â Â Â Â func_relative_path_tcancelled= |
---|
1049 | Â Â Â Â Â break |
---|
1050 | Â Â Â Â Â ;; |
---|
1051 | Â Â Â Â $func_relative_path_tlibdir*) |
---|
1052 | Â Â Â Â Â # found a matching prefix |
---|
1053 | Â Â Â Â Â func_stripname "$func_relative_path_tlibdir"Â ''Â "$func_relative_path_tbindir" |
---|
1054 | Â Â Â Â Â func_relative_path_tcancelled=$func_stripname_result |
---|
1055 |      if test -z "$func_relative_path_result"; then |
---|
1056 | Â Â Â Â Â Â func_relative_path_result=. |
---|
1057 | Â Â Â Â Â fi |
---|
1058 | Â Â Â Â Â break |
---|
1059 | Â Â Â Â Â ;; |
---|
1060 | Â Â Â Â *) |
---|
1061 | Â Â Â Â Â func_dirname $func_relative_path_tlibdir |
---|
1062 | Â Â Â Â Â func_relative_path_tlibdir=$func_dirname_result |
---|
1063 |      if test -z "$func_relative_path_tlibdir"; then |
---|
1064 | Â Â Â Â Â Â # Have to descend all the way to the root! |
---|
1065 | Â Â Â Â Â Â func_relative_path_result=../$func_relative_path_result |
---|
1066 | Â Â Â Â Â Â func_relative_path_tcancelled=$func_relative_path_tbindir |
---|
1067 | Â Â Â Â Â Â break |
---|
1068 | Â Â Â Â Â fi |
---|
1069 | Â Â Â Â Â func_relative_path_result=../$func_relative_path_result |
---|
1070 | Â Â Â Â Â ;; |
---|
1071 | Â Â Â esac |
---|
1072 | Â Â done |
---|
1073 | |
---|
1074 | Â Â # Now calculate path; take care to avoid doubling-up slashes. |
---|
1075 | Â Â func_stripname ''Â '/'Â "$func_relative_path_result" |
---|
1076 | Â Â func_relative_path_result=$func_stripname_result |
---|
1077 | Â Â func_stripname '/'Â '/'Â "$func_relative_path_tcancelled" |
---|
1078 |   if test -n "$func_stripname_result"; then |
---|
1079 | Â Â Â func_append func_relative_path_result "/$func_stripname_result" |
---|
1080 | Â Â fi |
---|
1081 | |
---|
1082 | Â Â # Normalisation. If bindir is libdir, return '.' else relative path. |
---|
1083 |   if test -n "$func_relative_path_result"; then |
---|
1084 | Â Â Â func_stripname './'Â ''Â "$func_relative_path_result" |
---|
1085 | Â Â Â func_relative_path_result=$func_stripname_result |
---|
1086 | Â Â fi |
---|
1087 | |
---|
1088 |   test -n "$func_relative_path_result" || func_relative_path_result=. |
---|
1089 | |
---|
1090 | Â Â : |
---|
1091 | } |
---|
1092 | |
---|
1093 | |
---|
1094 | # func_quote_for_eval ARG... |
---|
1095 | # -------------------------- |
---|
1096 | # Aesthetically quote ARGs to be evaled later. |
---|
1097 | # This function returns two values: |
---|
1098 | #Â Â i) func_quote_for_eval_result |
---|
1099 | #Â Â Â double-quoted, suitable for a subsequent eval |
---|
1100 | #Â ii) func_quote_for_eval_unquoted_result |
---|
1101 | #Â Â Â has all characters that are still active within double |
---|
1102 | #Â Â Â quotes backslashified. |
---|
1103 | func_quote_for_eval () |
---|
1104 | { |
---|
1105 | Â Â $debug_cmd |
---|
1106 | |
---|
1107 | Â Â func_quote_for_eval_unquoted_result= |
---|
1108 | Â Â func_quote_for_eval_result= |
---|
1109 | Â Â while test 0 -lt $#;Â do |
---|
1110 |    case $1 in |
---|
1111 | Â Â Â Â *[\\\`\"\$]*) |
---|
1112 |      _G_unquoted_arg=`printf '%s\n' "$1" |$SED "$sed_quote_subst"` ;; |
---|
1113 | Â Â Â Â *) |
---|
1114 | Â Â Â Â Â _G_unquoted_arg=$1Â ;; |
---|
1115 | Â Â Â esac |
---|
1116 |    if test -n "$func_quote_for_eval_unquoted_result"; then |
---|
1117 | Â Â Â Â func_append func_quote_for_eval_unquoted_result " $_G_unquoted_arg" |
---|
1118 | Â Â Â else |
---|
1119 | Â Â Â Â func_append func_quote_for_eval_unquoted_result "$_G_unquoted_arg" |
---|
1120 | Â Â Â fi |
---|
1121 | |
---|
1122 |    case $_G_unquoted_arg in |
---|
1123 | Â Â Â Â # Double-quote args containing shell metacharacters to delay |
---|
1124 | Â Â Â Â # word splitting, command substitution and variable expansion |
---|
1125 | Â Â Â Â # for a subsequent eval. |
---|
1126 | Â Â Â Â # Many Bourne shells cannot handle close brackets correctly |
---|
1127 | Â Â Â Â # in scan sets, so we specify it separately. |
---|
1128 | Â Â Â Â *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ Â ]*|*]*|"") |
---|
1129 | Â Â Â Â Â _G_quoted_arg=\"$_G_unquoted_arg\" |
---|
1130 | Â Â Â Â Â ;; |
---|
1131 | Â Â Â Â *) |
---|
1132 | Â Â Â Â Â _G_quoted_arg=$_G_unquoted_arg |
---|
1133 | Â Â Â Â Â ;; |
---|
1134 | Â Â Â esac |
---|
1135 | |
---|
1136 |    if test -n "$func_quote_for_eval_result"; then |
---|
1137 | Â Â Â Â func_append func_quote_for_eval_result " $_G_quoted_arg" |
---|
1138 | Â Â Â else |
---|
1139 | Â Â Â Â func_append func_quote_for_eval_result "$_G_quoted_arg" |
---|
1140 | Â Â Â fi |
---|
1141 | Â Â Â shift |
---|
1142 | Â Â done |
---|
1143 | } |
---|
1144 | |
---|
1145 | |
---|
1146 | # func_quote_for_expand ARG |
---|
1147 | # ------------------------- |
---|
1148 | # Aesthetically quote ARG to be evaled later; same as above, |
---|
1149 | # but do not quote variable references. |
---|
1150 | func_quote_for_expand () |
---|
1151 | { |
---|
1152 | Â Â $debug_cmd |
---|
1153 | |
---|
1154 |   case $1 in |
---|
1155 | Â Â Â *[\\\`\"]*) |
---|
1156 | Â Â Â Â _G_arg=`$ECHOÂ "$1"Â | $SEDÂ \ |
---|
1157 | Â Â Â Â Â Â -e "$sed_double_quote_subst"Â -e "$sed_double_backslash"`Â ;; |
---|
1158 | Â Â Â *) |
---|
1159 | Â Â Â Â _G_arg=$1Â ;; |
---|
1160 | Â Â esac |
---|
1161 | |
---|
1162 |   case $_G_arg in |
---|
1163 | Â Â Â # Double-quote args containing shell metacharacters to delay |
---|
1164 | Â Â Â # word splitting and command substitution for a subsequent eval. |
---|
1165 | Â Â Â # Many Bourne shells cannot handle close brackets correctly |
---|
1166 | Â Â Â # in scan sets, so we specify it separately. |
---|
1167 | Â Â Â *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ Â Â ]*|*]*|"") |
---|
1168 | Â Â Â Â _G_arg=\"$_G_arg\" |
---|
1169 | Â Â Â Â ;; |
---|
1170 | Â Â esac |
---|
1171 | |
---|
1172 | Â Â func_quote_for_expand_result=$_G_arg |
---|
1173 | } |
---|
1174 | |
---|
1175 | |
---|
1176 | # func_stripname PREFIX SUFFIX NAME |
---|
1177 | # --------------------------------- |
---|
1178 | # strip PREFIX and SUFFIX from NAME, and store in func_stripname_result. |
---|
1179 | # PREFIX and SUFFIX must not contain globbing or regex special |
---|
1180 | # characters, hashes, percent signs, but SUFFIX may contain a leading |
---|
1181 | # dot (in which case that matches only a dot). |
---|
1182 | if test yes = "$_G_HAVE_XSI_OPS"; then |
---|
1183 |  eval 'func_stripname () |
---|
1184 | Â { |
---|
1185 | Â Â $debug_cmd |
---|
1186 | |
---|
1187 | Â Â # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are |
---|
1188 | Â Â # positional parameters, so assign one to ordinary variable first. |
---|
1189 | Â Â func_stripname_result=$3 |
---|
1190 | Â Â func_stripname_result=${func_stripname_result#"$1"} |
---|
1191 | Â Â func_stripname_result=${func_stripname_result%"$2"} |
---|
1192 | Â }' |
---|
1193 | else |
---|
1194 | Â func_stripname () |
---|
1195 | Â { |
---|
1196 | Â Â $debug_cmd |
---|
1197 | |
---|
1198 |   case $2 in |
---|
1199 | Â Â Â .*)Â func_stripname_result=`$ECHOÂ "$3"Â | $SEDÂ -e "s%^$1%%"Â -e "s%\\\\$2\$%%"`;; |
---|
1200 | Â Â Â *)Â func_stripname_result=`$ECHOÂ "$3"Â | $SEDÂ -e "s%^$1%%"Â -e "s%$2\$%%"`;; |
---|
1201 | Â Â esac |
---|
1202 | Â } |
---|
1203 | fi |
---|
1204 | |
---|
1205 | |
---|
1206 | # func_show_eval CMD [FAIL_EXP] |
---|
1207 | # ----------------------------- |
---|
1208 | # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is |
---|
1209 | # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP |
---|
1210 | # is given, then evaluate it. |
---|
1211 | func_show_eval () |
---|
1212 | { |
---|
1213 | Â Â $debug_cmd |
---|
1214 | |
---|
1215 | Â Â _G_cmd=$1 |
---|
1216 | Â Â _G_fail_exp=${2-':'} |
---|
1217 | |
---|
1218 | Â Â func_quote_for_expand "$_G_cmd" |
---|
1219 |   eval "func_notquiet $func_quote_for_expand_result" |
---|
1220 | |
---|
1221 |   $opt_dry_run || { |
---|
1222 |    eval "$_G_cmd" |
---|
1223 | Â Â Â _G_status=$? |
---|
1224 | Â Â Â if test 0 -ne "$_G_status"; then |
---|
1225 |     eval "(exit $_G_status); $_G_fail_exp" |
---|
1226 | Â Â Â fi |
---|
1227 | Â Â } |
---|
1228 | } |
---|
1229 | |
---|
1230 | |
---|
1231 | # func_show_eval_locale CMD [FAIL_EXP] |
---|
1232 | # ------------------------------------ |
---|
1233 | # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is |
---|
1234 | # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP |
---|
1235 | # is given, then evaluate it. Use the saved locale for evaluation. |
---|
1236 | func_show_eval_locale () |
---|
1237 | { |
---|
1238 | Â Â $debug_cmd |
---|
1239 | |
---|
1240 | Â Â _G_cmd=$1 |
---|
1241 | Â Â _G_fail_exp=${2-':'} |
---|
1242 | |
---|
1243 |   $opt_quiet || { |
---|
1244 | Â Â Â func_quote_for_expand "$_G_cmd" |
---|
1245 |    eval "func_echo $func_quote_for_expand_result" |
---|
1246 | Â Â } |
---|
1247 | |
---|
1248 |   $opt_dry_run || { |
---|
1249 |    eval "$_G_user_locale |
---|
1250 | Â Â Â Â Â Â $_G_cmd" |
---|
1251 | Â Â Â _G_status=$? |
---|
1252 |    eval "$_G_safe_locale" |
---|
1253 | Â Â Â if test 0 -ne "$_G_status"; then |
---|
1254 |     eval "(exit $_G_status); $_G_fail_exp" |
---|
1255 | Â Â Â fi |
---|
1256 | Â Â } |
---|
1257 | } |
---|
1258 | |
---|
1259 | |
---|
1260 | # func_tr_sh |
---|
1261 | # ---------- |
---|
1262 | # Turn $1 into a string suitable for a shell variable name. |
---|
1263 | # Result is stored in $func_tr_sh_result. All characters |
---|
1264 | # not in the set a-zA-Z0-9_ are replaced with '_'. Further, |
---|
1265 | # if $1 begins with a digit, a '_' is prepended as well. |
---|
1266 | func_tr_sh () |
---|
1267 | { |
---|
1268 | Â Â $debug_cmd |
---|
1269 | |
---|
1270 |   case $1 in |
---|
1271 | Â Â [0-9]* | *[!a-zA-Z0-9_]*) |
---|
1272 | Â Â Â func_tr_sh_result=`$ECHOÂ "$1"Â | $SEDÂ -e 's/^\([0-9]\)/_\1/'Â -e 's/[^a-zA-Z0-9_]/_/g'` |
---|
1273 | Â Â Â ;; |
---|
1274 | Â Â * ) |
---|
1275 | Â Â Â func_tr_sh_result=$1 |
---|
1276 | Â Â Â ;; |
---|
1277 | Â Â esac |
---|
1278 | } |
---|
1279 | |
---|
1280 | |
---|
1281 | # func_verbose ARG... |
---|
1282 | # ------------------- |
---|
1283 | # Echo program name prefixed message in verbose mode only. |
---|
1284 | func_verbose () |
---|
1285 | { |
---|
1286 | Â Â $debug_cmd |
---|
1287 | |
---|
1288 |   $opt_verbose && func_echo "$*" |
---|
1289 | |
---|
1290 | Â Â : |
---|
1291 | } |
---|
1292 | |
---|
1293 | |
---|
1294 | # func_warn_and_continue ARG... |
---|
1295 | # ----------------------------- |
---|
1296 | # Echo program name prefixed warning message to standard error. |
---|
1297 | func_warn_and_continue () |
---|
1298 | { |
---|
1299 | Â Â $debug_cmd |
---|
1300 | |
---|
1301 | Â Â $require_term_colors |
---|
1302 | |
---|
1303 | Â Â func_echo_infix_1 "${tc_red}warning$tc_reset"Â "$*"Â >&2 |
---|
1304 | } |
---|
1305 | |
---|
1306 | |
---|
1307 | # func_warning CATEGORY ARG... |
---|
1308 | # ---------------------------- |
---|
1309 | # Echo program name prefixed warning message to standard error. Warning |
---|
1310 | # messages can be filtered according to CATEGORY, where this function |
---|
1311 | # elides messages where CATEGORY is not listed in the global variable |
---|
1312 | # 'opt_warning_types'. |
---|
1313 | func_warning () |
---|
1314 | { |
---|
1315 | Â Â $debug_cmd |
---|
1316 | |
---|
1317 | Â Â # CATEGORY must be in the warning_categories list! |
---|
1318 |   case " $warning_categories " in |
---|
1319 | Â Â Â *" $1 "*)Â ;; |
---|
1320 | Â Â Â *)Â func_internal_error "invalid warning category '$1'"Â ;; |
---|
1321 | Â Â esac |
---|
1322 | |
---|
1323 | Â Â _G_category=$1 |
---|
1324 | Â Â shift |
---|
1325 | |
---|
1326 |   case " $opt_warning_types " in |
---|
1327 |    *" $_G_category "*) $warning_func ${1+"$@"} ;; |
---|
1328 | Â Â esac |
---|
1329 | } |
---|
1330 | |
---|
1331 | |
---|
1332 | # func_sort_ver VER1 VER2 |
---|
1333 | # ----------------------- |
---|
1334 | # 'sort -V' is not generally available. |
---|
1335 | # Note this deviates from the version comparison in automake |
---|
1336 | # in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a |
---|
1337 | # but this should suffice as we won't be specifying old |
---|
1338 | # version formats or redundant trailing .0 in bootstrap.conf. |
---|
1339 | # If we did want full compatibility then we should probably |
---|
1340 | # use m4_version_compare from autoconf. |
---|
1341 | func_sort_ver () |
---|
1342 | { |
---|
1343 | Â Â $debug_cmd |
---|
1344 | |
---|
1345 |   printf '%s\n%s\n' "$1" "$2" \ |
---|
1346 | Â Â Â | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n -k 5,5n -k 6,6n -k 7,7n -k 8,8n -k 9,9n |
---|
1347 | } |
---|
1348 | |
---|
1349 | # func_lt_ver PREV CURR |
---|
1350 | # --------------------- |
---|
1351 | # Return true if PREV and CURR are in the correct order according to |
---|
1352 | # func_sort_ver, otherwise false. Use it like this: |
---|
1353 | # |
---|
1354 | #Â func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..." |
---|
1355 | func_lt_ver () |
---|
1356 | { |
---|
1357 | Â Â $debug_cmd |
---|
1358 | |
---|
1359 |   test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q` |
---|
1360 | } |
---|
1361 | |
---|
1362 | |
---|
1363 | # Local variables: |
---|
1364 | # mode: shell-script |
---|
1365 | # sh-indentation: 2 |
---|
1366 | # eval: (add-hook 'before-save-hook 'time-stamp) |
---|
1367 | # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC" |
---|
1368 | # time-stamp-time-zone: "UTC" |
---|
1369 | # End: |
---|
1370 | #! /bin/sh |
---|
1371 | |
---|
1372 | # Set a version string for this script. |
---|
1373 | scriptversion=2014-01-07.03; # UTC |
---|
1374 | |
---|
1375 | # A portable, pluggable option parser for Bourne shell. |
---|
1376 | # Written by Gary V. Vaughan, 2010 |
---|
1377 | |
---|
1378 | # Copyright (C) 2010-2015 Free Software Foundation, Inc. |
---|
1379 | # This is free software; see the source for copying conditions. There is NO |
---|
1380 | # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
---|
1381 | |
---|
1382 | # This program is free software: you can redistribute it and/or modify |
---|
1383 | # it under the terms of the GNU General Public License as published by |
---|
1384 | # the Free Software Foundation, either version 3 of the License, or |
---|
1385 | # (at your option) any later version. |
---|
1386 | |
---|
1387 | # This program is distributed in the hope that it will be useful, |
---|
1388 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
1389 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
1390 | # GNU General Public License for more details. |
---|
1391 | |
---|
1392 | # You should have received a copy of the GNU General Public License |
---|
1393 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
---|
1394 | |
---|
1395 | # Please report bugs or propose patches to gary@gnu.org. |
---|
1396 | |
---|
1397 | |
---|
1398 | ## ------ ## |
---|
1399 | ## Usage. ## |
---|
1400 | ## ------ ## |
---|
1401 | |
---|
1402 | # This file is a library for parsing options in your shell scripts along |
---|
1403 | # with assorted other useful supporting features that you can make use |
---|
1404 | # of too. |
---|
1405 | # |
---|
1406 | # For the simplest scripts you might need only: |
---|
1407 | # |
---|
1408 | #Â Â #!/bin/sh |
---|
1409 | #Â Â . relative/path/to/funclib.sh |
---|
1410 | #Â Â . relative/path/to/options-parser |
---|
1411 | #Â Â scriptversion=1.0 |
---|
1412 | #Â Â func_options ${1+"$@"} |
---|
1413 | #Â Â eval set dummy "$func_options_result"; shift |
---|
1414 | #Â Â ...rest of your script... |
---|
1415 | # |
---|
1416 | # In order for the '--version' option to work, you will need to have a |
---|
1417 | # suitably formatted comment like the one at the top of this file |
---|
1418 | # starting with '# Written by ' and ending with '# warranty; '. |
---|
1419 | # |
---|
1420 | # For '-h' and '--help' to work, you will also need a one line |
---|
1421 | # description of your script's purpose in a comment directly above the |
---|
1422 | # '# Written by ' line, like the one at the top of this file. |
---|
1423 | # |
---|
1424 | # The default options also support '--debug', which will turn on shell |
---|
1425 | # execution tracing (see the comment above debug_cmd below for another |
---|
1426 | # use), and '--verbose' and the func_verbose function to allow your script |
---|
1427 | # to display verbose messages only when your user has specified |
---|
1428 | # '--verbose'. |
---|
1429 | # |
---|
1430 | # After sourcing this file, you can plug processing for additional |
---|
1431 | # options by amending the variables from the 'Configuration' section |
---|
1432 | # below, and following the instructions in the 'Option parsing' |
---|
1433 | # section further down. |
---|
1434 | |
---|
1435 | ## -------------- ## |
---|
1436 | ## Configuration. ## |
---|
1437 | ## -------------- ## |
---|
1438 | |
---|
1439 | # You should override these variables in your script after sourcing this |
---|
1440 | # file so that they reflect the customisations you have added to the |
---|
1441 | # option parser. |
---|
1442 | |
---|
1443 | # The usage line for option parsing errors and the start of '-h' and |
---|
1444 | # '--help' output messages. You can embed shell variables for delayed |
---|
1445 | # expansion at the time the message is displayed, but you will need to |
---|
1446 | # quote other shell meta-characters carefully to prevent them being |
---|
1447 | # expanded when the contents are evaled. |
---|
1448 | usage='$progpath [OPTION]...' |
---|
1449 | |
---|
1450 | # Short help message in response to '-h' and '--help'. Add to this or |
---|
1451 | # override it after sourcing this library to reflect the full set of |
---|
1452 | # options your script accepts. |
---|
1453 | usage_message="\ |
---|
1454 |     --debug    enable verbose shell tracing |
---|
1455 | Â Â -W, --warnings=CATEGORY |
---|
1456 | Â Â Â Â Â Â Â Â Â Â Â report the warnings falling in CATEGORY [all] |
---|
1457 |   -v, --verbose   verbosely report processing |
---|
1458 |     --version   print version information and exit |
---|
1459 |   -h, --help     print short or long help message and exit |
---|
1460 | " |
---|
1461 | |
---|
1462 | # Additional text appended to 'usage_message' in response to '--help'. |
---|
1463 | long_help_message=" |
---|
1464 | Warning categories include: |
---|
1465 | Â Â Â Â 'all'Â Â Â Â Â show all warnings |
---|
1466 | Â Â Â Â 'none'Â Â Â Â Â turn off all the warnings |
---|
1467 | Â Â Â Â 'error'Â Â Â Â warnings are treated as fatal errors" |
---|
1468 | |
---|
1469 | # Help message printed before fatal option parsing errors. |
---|
1470 | fatal_help="Try '\$progname --help' for more information." |
---|
1471 | |
---|
1472 | |
---|
1473 | |
---|
1474 | ## ------------------------- ## |
---|
1475 | ## Hook function management. ## |
---|
1476 | ## ------------------------- ## |
---|
1477 | |
---|
1478 | # This section contains functions for adding, removing, and running hooks |
---|
1479 | # to the main code. A hook is just a named list of of function, that can |
---|
1480 | # be run in order later on. |
---|
1481 | |
---|
1482 | # func_hookable FUNC_NAME |
---|
1483 | # ----------------------- |
---|
1484 | # Declare that FUNC_NAME will run hooks added with |
---|
1485 | # 'func_add_hook FUNC_NAME ...'. |
---|
1486 | func_hookable () |
---|
1487 | { |
---|
1488 | Â Â $debug_cmd |
---|
1489 | |
---|
1490 | Â Â func_append hookable_fns " $1" |
---|
1491 | } |
---|
1492 | |
---|
1493 | |
---|
1494 | # func_add_hook FUNC_NAME HOOK_FUNC |
---|
1495 | # --------------------------------- |
---|
1496 | # Request that FUNC_NAME call HOOK_FUNC before it returns. FUNC_NAME must |
---|
1497 | # first have been declared "hookable" by a call to 'func_hookable'. |
---|
1498 | func_add_hook () |
---|
1499 | { |
---|
1500 | Â Â $debug_cmd |
---|
1501 | |
---|
1502 |   case " $hookable_fns " in |
---|
1503 | Â Â Â *" $1 "*)Â ;; |
---|
1504 | Â Â Â *)Â func_fatal_error "'$1' does not accept hook functions."Â ;; |
---|
1505 | Â Â esac |
---|
1506 | |
---|
1507 | Â Â eval func_append ${1}_hooks '" $2"' |
---|
1508 | } |
---|
1509 | |
---|
1510 | |
---|
1511 | # func_remove_hook FUNC_NAME HOOK_FUNC |
---|
1512 | # ------------------------------------ |
---|
1513 | # Remove HOOK_FUNC from the list of functions called by FUNC_NAME. |
---|
1514 | func_remove_hook () |
---|
1515 | { |
---|
1516 | Â Â $debug_cmd |
---|
1517 | |
---|
1518 |   eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`' |
---|
1519 | } |
---|
1520 | |
---|
1521 | |
---|
1522 | # func_run_hooks FUNC_NAME [ARG]... |
---|
1523 | # --------------------------------- |
---|
1524 | # Run all hook functions registered to FUNC_NAME. |
---|
1525 | # It is assumed that the list of hook functions contains nothing more |
---|
1526 | # than a whitespace-delimited list of legal shell function names, and |
---|
1527 | # no effort is wasted trying to catch shell meta-characters or preserve |
---|
1528 | # whitespace. |
---|
1529 | func_run_hooks () |
---|
1530 | { |
---|
1531 | Â Â $debug_cmd |
---|
1532 | |
---|
1533 |   case " $hookable_fns " in |
---|
1534 | Â Â Â *" $1 "*)Â ;; |
---|
1535 | Â Â Â *)Â func_fatal_error "'$1' does not support hook funcions.n"Â ;; |
---|
1536 | Â Â esac |
---|
1537 | |
---|
1538 | Â Â eval _G_hook_fns=\$$1_hooks; shift |
---|
1539 | |
---|
1540 | Â Â for _G_hook in $_G_hook_fns; do |
---|
1541 |    eval $_G_hook '"$@"' |
---|
1542 | |
---|
1543 | Â Â Â # store returned options list back into positional |
---|
1544 | Â Â Â # parameters for next 'cmd' execution. |
---|
1545 | Â Â Â eval _G_hook_result=\$${_G_hook}_result |
---|
1546 | Â Â Â eval set dummy "$_G_hook_result"; shift |
---|
1547 | Â Â done |
---|
1548 | |
---|
1549 | Â Â func_quote_for_eval ${1+"$@"} |
---|
1550 | Â Â func_run_hooks_result=$func_quote_for_eval_result |
---|
1551 | } |
---|
1552 | |
---|
1553 | |
---|
1554 | |
---|
1555 | ## --------------- ## |
---|
1556 | ## Option parsing. ## |
---|
1557 | ## --------------- ## |
---|
1558 | |
---|
1559 | # In order to add your own option parsing hooks, you must accept the |
---|
1560 | # full positional parameter list in your hook function, remove any |
---|
1561 | # options that you action, and then pass back the remaining unprocessed |
---|
1562 | # options in '<hooked_function_name>_result', escaped suitably for |
---|
1563 | # 'eval'. Like this: |
---|
1564 | # |
---|
1565 | #Â Â my_options_prep () |
---|
1566 | #Â Â { |
---|
1567 | #Â Â Â Â $debug_cmd |
---|
1568 | # |
---|
1569 | #Â Â Â Â # Extend the existing usage message. |
---|
1570 | #Â Â Â Â usage_message=$usage_message' |
---|
1571 | #   -s, --silent    don'\''t print informational messages |
---|
1572 | #Â Â ' |
---|
1573 | # |
---|
1574 | #Â Â Â Â func_quote_for_eval ${1+"$@"} |
---|
1575 | #Â Â Â Â my_options_prep_result=$func_quote_for_eval_result |
---|
1576 | #Â Â } |
---|
1577 | #Â Â func_add_hook func_options_prep my_options_prep |
---|
1578 | # |
---|
1579 | # |
---|
1580 | #Â Â my_silent_option () |
---|
1581 | #Â Â { |
---|
1582 | #Â Â Â Â $debug_cmd |
---|
1583 | # |
---|
1584 | #Â Â Â Â # Note that for efficiency, we parse as many options as we can |
---|
1585 | #Â Â Â Â # recognise in a loop before passing the remainder back to the |
---|
1586 | #Â Â Â Â # caller on the first unrecognised argument we encounter. |
---|
1587 | #Â Â Â Â while test $# -gt 0; do |
---|
1588 | #Â Â Â Â Â opt=$1; shift |
---|
1589 | #Â Â Â Â Â case $opt in |
---|
1590 | #Â Â Â Â Â Â --silent|-s) opt_silent=: ;; |
---|
1591 | #Â Â Â Â Â Â # Separate non-argument short options: |
---|
1592 | #Â Â Â Â Â Â -s*)Â Â Â Â Â func_split_short_opt "$_G_opt" |
---|
1593 | #Â Â Â Â Â Â Â Â Â Â Â Â Â set dummy "$func_split_short_opt_name" \ |
---|
1594 | #Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "-$func_split_short_opt_arg" ${1+"$@"} |
---|
1595 | #Â Â Â Â Â Â Â Â Â Â Â Â Â shift |
---|
1596 | #Â Â Â Â Â Â Â Â Â Â Â Â Â ;; |
---|
1597 | #Â Â Â Â Â Â *)Â Â Â Â Â Â set dummy "$_G_opt" "$*"; shift; break ;; |
---|
1598 | #Â Â Â Â Â esac |
---|
1599 | #Â Â Â Â done |
---|
1600 | # |
---|
1601 | #Â Â Â Â func_quote_for_eval ${1+"$@"} |
---|
1602 | #Â Â Â Â my_silent_option_result=$func_quote_for_eval_result |
---|
1603 | #Â Â } |
---|
1604 | #Â Â func_add_hook func_parse_options my_silent_option |
---|
1605 | # |
---|
1606 | # |
---|
1607 | #Â Â my_option_validation () |
---|
1608 | #Â Â { |
---|
1609 | #Â Â Â Â $debug_cmd |
---|
1610 | # |
---|
1611 | #Â Â Â Â $opt_silent && $opt_verbose && func_fatal_help "\ |
---|
1612 | #Â Â '--silent' and '--verbose' options are mutually exclusive." |
---|
1613 | # |
---|
1614 | #Â Â Â Â func_quote_for_eval ${1+"$@"} |
---|
1615 | #Â Â Â Â my_option_validation_result=$func_quote_for_eval_result |
---|
1616 | #Â Â } |
---|
1617 | #Â Â func_add_hook func_validate_options my_option_validation |
---|
1618 | # |
---|
1619 | # You'll alse need to manually amend $usage_message to reflect the extra |
---|
1620 | # options you parse. It's preferable to append if you can, so that |
---|
1621 | # multiple option parsing hooks can be added safely. |
---|
1622 | |
---|
1623 | |
---|
1624 | # func_options [ARG]... |
---|
1625 | # --------------------- |
---|
1626 | # All the functions called inside func_options are hookable. See the |
---|
1627 | # individual implementations for details. |
---|
1628 | func_hookable func_options |
---|
1629 | func_options () |
---|
1630 | { |
---|
1631 | Â Â $debug_cmd |
---|
1632 | |
---|
1633 | Â Â func_options_prep ${1+"$@"} |
---|
1634 | Â Â eval func_parse_options \ |
---|
1635 | Â Â Â Â ${func_options_prep_result+"$func_options_prep_result"} |
---|
1636 | Â Â eval func_validate_options \ |
---|
1637 | Â Â Â Â ${func_parse_options_result+"$func_parse_options_result"} |
---|
1638 | |
---|
1639 | Â Â eval func_run_hooks func_options \ |
---|
1640 | Â Â Â Â ${func_validate_options_result+"$func_validate_options_result"} |
---|
1641 | |
---|
1642 | Â Â # save modified positional parameters for caller |
---|
1643 | Â Â func_options_result=$func_run_hooks_result |
---|
1644 | } |
---|
1645 | |
---|
1646 | |
---|
1647 | # func_options_prep [ARG]... |
---|
1648 | # -------------------------- |
---|
1649 | # All initialisations required before starting the option parse loop. |
---|
1650 | # Note that when calling hook functions, we pass through the list of |
---|
1651 | # positional parameters. If a hook function modifies that list, and |
---|
1652 | # needs to propogate that back to rest of this script, then the complete |
---|
1653 | # modified list must be put in 'func_run_hooks_result' before |
---|
1654 | # returning. |
---|
1655 | func_hookable func_options_prep |
---|
1656 | func_options_prep () |
---|
1657 | { |
---|
1658 | Â Â $debug_cmd |
---|
1659 | |
---|
1660 | Â Â # Option defaults: |
---|
1661 | Â Â opt_verbose=false |
---|
1662 | Â Â opt_warning_types= |
---|
1663 | |
---|
1664 | Â Â func_run_hooks func_options_prep ${1+"$@"} |
---|
1665 | |
---|
1666 | Â Â # save modified positional parameters for caller |
---|
1667 | Â Â func_options_prep_result=$func_run_hooks_result |
---|
1668 | } |
---|
1669 | |
---|
1670 | |
---|
1671 | # func_parse_options [ARG]... |
---|
1672 | # --------------------------- |
---|
1673 | # The main option parsing loop. |
---|
1674 | func_hookable func_parse_options |
---|
1675 | func_parse_options () |
---|
1676 | { |
---|
1677 | Â Â $debug_cmd |
---|
1678 | |
---|
1679 | Â Â func_parse_options_result= |
---|
1680 | |
---|
1681 | Â Â # this just eases exit handling |
---|
1682 |   while test $# -gt 0; do |
---|
1683 | Â Â Â # Defer to hook functions for initial option parsing, so they |
---|
1684 | Â Â Â # get priority in the event of reusing an option name. |
---|
1685 | Â Â Â func_run_hooks func_parse_options ${1+"$@"} |
---|
1686 | |
---|
1687 | Â Â Â # Adjust func_parse_options positional parameters to match |
---|
1688 | Â Â Â eval set dummy "$func_run_hooks_result"; shift |
---|
1689 | |
---|
1690 | Â Â Â # Break out of the loop if we already parsed every option. |
---|
1691 |    test $# -gt 0 || break |
---|
1692 | |
---|
1693 | Â Â Â _G_opt=$1 |
---|
1694 | Â Â Â shift |
---|
1695 |    case $_G_opt in |
---|
1696 | Â Â Â Â --debug|-x)Â Â debug_cmd='set -x' |
---|
1697 | Â Â Â Â Â Â Â Â Â Â Â func_echo "enabling shell trace mode" |
---|
1698 | Â Â Â Â Â Â Â Â Â Â Â $debug_cmd |
---|
1699 | Â Â Â Â Â Â Â Â Â Â Â ;; |
---|
1700 | |
---|
1701 | Â Â Â Â --no-warnings|--no-warning|--no-warn) |
---|
1702 | Â Â Â Â Â Â Â Â Â Â Â set dummy --warnings none ${1+"$@"} |
---|
1703 | Â Â Â Â Â Â Â Â Â Â Â shift |
---|
1704 | Â Â Â Â Â Â Â Â Â Â Â ;; |
---|
1705 | |
---|
1706 | Â Â Â Â --warnings|--warning|-W) |
---|
1707 |            test $# = 0 && func_missing_arg $_G_opt && break |
---|
1708 |            case " $warning_categories $1" in |
---|
1709 | Â Â Â Â Â Â Â Â Â Â Â Â *" $1 "*) |
---|
1710 | Â Â Â Â Â Â Â Â Â Â Â Â Â # trailing space prevents matching last $1 above |
---|
1711 | Â Â Â Â Â Â Â Â Â Â Â Â Â func_append_uniq opt_warning_types " $1" |
---|
1712 | Â Â Â Â Â Â Â Â Â Â Â Â Â ;; |
---|
1713 | Â Â Â Â Â Â Â Â Â Â Â Â *all) |
---|
1714 | Â Â Â Â Â Â Â Â Â Â Â Â Â opt_warning_types=$warning_categories |
---|
1715 | Â Â Â Â Â Â Â Â Â Â Â Â Â ;; |
---|
1716 | Â Â Â Â Â Â Â Â Â Â Â Â *none) |
---|
1717 | Â Â Â Â Â Â Â Â Â Â Â Â Â opt_warning_types=none |
---|
1718 | Â Â Â Â Â Â Â Â Â Â Â Â Â warning_func=: |
---|
1719 | Â Â Â Â Â Â Â Â Â Â Â Â Â ;; |
---|
1720 | Â Â Â Â Â Â Â Â Â Â Â Â *error) |
---|
1721 | Â Â Â Â Â Â Â Â Â Â Â Â Â opt_warning_types=$warning_categories |
---|
1722 | Â Â Â Â Â Â Â Â Â Â Â Â Â warning_func=func_fatal_error |
---|
1723 | Â Â Â Â Â Â Â Â Â Â Â Â Â ;; |
---|
1724 | Â Â Â Â Â Â Â Â Â Â Â Â *) |
---|
1725 | Â Â Â Â Â Â Â Â Â Â Â Â Â func_fatal_error \ |
---|
1726 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "unsupported warning category: '$1'" |
---|
1727 | Â Â Â Â Â Â Â Â Â Â Â Â Â ;; |
---|
1728 | Â Â Â Â Â Â Â Â Â Â Â esac |
---|
1729 | Â Â Â Â Â Â Â Â Â Â Â shift |
---|
1730 | Â Â Â Â Â Â Â Â Â Â Â ;; |
---|
1731 | |
---|
1732 | Â Â Â Â --verbose|-v)Â opt_verbose=: ;; |
---|
1733 | Â Â Â Â --version)Â Â func_version ;; |
---|
1734 | Â Â Â Â -\?|-h)Â Â Â Â func_usage ;; |
---|
1735 | Â Â Â Â --help)Â Â Â Â func_help ;; |
---|
1736 | |
---|
1737 | Â Â Â Â # Separate optargs to long options (plugins may need this): |
---|
1738 | Â Â Â Â --*=*)Â Â Â Â func_split_equals "$_G_opt" |
---|
1739 | Â Â Â Â Â Â Â Â Â Â Â set dummy "$func_split_equals_lhs"Â \ |
---|
1740 | Â Â Â Â Â Â Â Â Â Â Â Â Â "$func_split_equals_rhs"Â ${1+"$@"} |
---|
1741 | Â Â Â Â Â Â Â Â Â Â Â shift |
---|
1742 | Â Â Â Â Â Â Â Â Â Â Â ;; |
---|
1743 | |
---|
1744 | Â Â Â Â # Separate optargs to short options: |
---|
1745 | Â Â Â Â -W*) |
---|
1746 | Â Â Â Â Â Â Â Â Â Â Â func_split_short_opt "$_G_opt" |
---|
1747 | Â Â Â Â Â Â Â Â Â Â Â set dummy "$func_split_short_opt_name"Â \ |
---|
1748 | Â Â Â Â Â Â Â Â Â Â Â Â Â "$func_split_short_opt_arg"Â ${1+"$@"} |
---|
1749 | Â Â Â Â Â Â Â Â Â Â Â shift |
---|
1750 | Â Â Â Â Â Â Â Â Â Â Â ;; |
---|
1751 | |
---|
1752 | Â Â Â Â # Separate non-argument short options: |
---|
1753 | Â Â Â Â -\?*|-h*|-v*|-x*) |
---|
1754 | Â Â Â Â Â Â Â Â Â Â Â func_split_short_opt "$_G_opt" |
---|
1755 | Â Â Â Â Â Â Â Â Â Â Â set dummy "$func_split_short_opt_name"Â \ |
---|
1756 | Â Â Â Â Â Â Â Â Â Â Â Â Â "-$func_split_short_opt_arg"Â ${1+"$@"} |
---|
1757 | Â Â Â Â Â Â Â Â Â Â Â shift |
---|
1758 | Â Â Â Â Â Â Â Â Â Â Â ;; |
---|
1759 | |
---|
1760 |     --)      break ;; |
---|
1761 | Â Â Â Â -*)Â Â Â Â Â Â func_fatal_help "unrecognised option: '$_G_opt'"Â ;; |
---|
1762 |     *)      set dummy "$_G_opt" ${1+"$@"}; shift; break ;; |
---|
1763 | Â Â Â esac |
---|
1764 | Â Â done |
---|
1765 | |
---|
1766 | Â Â # save modified positional parameters for caller |
---|
1767 | Â Â func_quote_for_eval ${1+"$@"} |
---|
1768 | Â Â func_parse_options_result=$func_quote_for_eval_result |
---|
1769 | } |
---|
1770 | |
---|
1771 | |
---|
1772 | # func_validate_options [ARG]... |
---|
1773 | # ------------------------------ |
---|
1774 | # Perform any sanity checks on option settings and/or unconsumed |
---|
1775 | # arguments. |
---|
1776 | func_hookable func_validate_options |
---|
1777 | func_validate_options () |
---|
1778 | { |
---|
1779 | Â Â $debug_cmd |
---|
1780 | |
---|
1781 | Â Â # Display all warnings if -W was not given. |
---|
1782 |   test -n "$opt_warning_types" || opt_warning_types=" $warning_categories" |
---|
1783 | |
---|
1784 | Â Â func_run_hooks func_validate_options ${1+"$@"} |
---|
1785 | |
---|
1786 | Â Â # Bail if the options were screwed! |
---|
1787 |   $exit_cmd $EXIT_FAILURE |
---|
1788 | |
---|
1789 | Â Â # save modified positional parameters for caller |
---|
1790 | Â Â func_validate_options_result=$func_run_hooks_result |
---|
1791 | } |
---|
1792 | |
---|
1793 | |
---|
1794 | |
---|
1795 | ## ----------------- ## |
---|
1796 | ## Helper functions. ## |
---|
1797 | ## ----------------- ## |
---|
1798 | |
---|
1799 | # This section contains the helper functions used by the rest of the |
---|
1800 | # hookable option parser framework in ascii-betical order. |
---|
1801 | |
---|
1802 | |
---|
1803 | # func_fatal_help ARG... |
---|
1804 | # ---------------------- |
---|
1805 | # Echo program name prefixed message to standard error, followed by |
---|
1806 | # a help hint, and exit. |
---|
1807 | func_fatal_help () |
---|
1808 | { |
---|
1809 | Â Â $debug_cmd |
---|
1810 | |
---|
1811 |   eval \$ECHO \""Usage: $usage"\" |
---|
1812 |   eval \$ECHO \""$fatal_help"\" |
---|
1813 | Â Â func_error ${1+"$@"} |
---|
1814 |   exit $EXIT_FAILURE |
---|
1815 | } |
---|
1816 | |
---|
1817 | |
---|
1818 | # func_help |
---|
1819 | # --------- |
---|
1820 | # Echo long help message to standard output and exit. |
---|
1821 | func_help () |
---|
1822 | { |
---|
1823 | Â Â $debug_cmd |
---|
1824 | |
---|
1825 | Â Â func_usage_message |
---|
1826 | Â Â $ECHOÂ "$long_help_message" |
---|
1827 | Â Â exit 0 |
---|
1828 | } |
---|
1829 | |
---|
1830 | |
---|
1831 | # func_missing_arg ARGNAME |
---|
1832 | # ------------------------ |
---|
1833 | # Echo program name prefixed message to standard error and set global |
---|
1834 | # exit_cmd. |
---|
1835 | func_missing_arg () |
---|
1836 | { |
---|
1837 | Â Â $debug_cmd |
---|
1838 | |
---|
1839 | Â Â func_error "Missing argument for '$1'." |
---|
1840 | Â Â exit_cmd=exit |
---|
1841 | } |
---|
1842 | |
---|
1843 | |
---|
1844 | # func_split_equals STRING |
---|
1845 | # ------------------------ |
---|
1846 | # Set func_split_equals_lhs and func_split_equals_rhs shell variables after |
---|
1847 | # splitting STRING at the '=' sign. |
---|
1848 | test -z "$_G_HAVE_XSI_OPS" \ |
---|
1849 |   && (eval 'x=a/b/c; |
---|
1850 | Â Â Â test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"')Â 2>/dev/null \ |
---|
1851 | Â Â &&Â _G_HAVE_XSI_OPS=yes |
---|
1852 | |
---|
1853 | if test yes = "$_G_HAVE_XSI_OPS" |
---|
1854 | then |
---|
1855 | Â # This is an XSI compatible shell, allowing a faster implementation... |
---|
1856 |  eval 'func_split_equals () |
---|
1857 | Â { |
---|
1858 | Â Â Â $debug_cmd |
---|
1859 | |
---|
1860 | Â Â Â func_split_equals_lhs=${1%%=*} |
---|
1861 | Â Â Â func_split_equals_rhs=${1#*=} |
---|
1862 | Â Â Â test "x$func_split_equals_lhs" = "x$1" \ |
---|
1863 | Â Â Â Â && func_split_equals_rhs= |
---|
1864 | Â }' |
---|
1865 | else |
---|
1866 | Â # ...otherwise fall back to using expr, which is often a shell builtin. |
---|
1867 | Â func_split_equals () |
---|
1868 | Â { |
---|
1869 | Â Â Â $debug_cmd |
---|
1870 | |
---|
1871 | Â Â Â func_split_equals_lhs=`expr "x$1"Â : 'x\([^=]*\)'` |
---|
1872 | Â Â Â func_split_equals_rhs= |
---|
1873 |    test "x$func_split_equals_lhs" = "x$1" \ |
---|
1874 | Â Â Â Â ||Â func_split_equals_rhs=`expr "x$1"Â : 'x[^=]*=\(.*\)$'` |
---|
1875 | Â } |
---|
1876 | fi #func_split_equals |
---|
1877 | |
---|
1878 | |
---|
1879 | # func_split_short_opt SHORTOPT |
---|
1880 | # ----------------------------- |
---|
1881 | # Set func_split_short_opt_name and func_split_short_opt_arg shell |
---|
1882 | # variables after splitting SHORTOPT after the 2nd character. |
---|
1883 | if test yes = "$_G_HAVE_XSI_OPS" |
---|
1884 | then |
---|
1885 | Â # This is an XSI compatible shell, allowing a faster implementation... |
---|
1886 |  eval 'func_split_short_opt () |
---|
1887 | Â { |
---|
1888 | Â Â Â $debug_cmd |
---|
1889 | |
---|
1890 | Â Â Â func_split_short_opt_arg=${1#??} |
---|
1891 | Â Â Â func_split_short_opt_name=${1%"$func_split_short_opt_arg"} |
---|
1892 | Â }' |
---|
1893 | else |
---|
1894 | Â # ...otherwise fall back to using expr, which is often a shell builtin. |
---|
1895 | Â func_split_short_opt () |
---|
1896 | Â { |
---|
1897 | Â Â Â $debug_cmd |
---|
1898 | |
---|
1899 | Â Â Â func_split_short_opt_name=`expr "x$1"Â : 'x-\(.\)'` |
---|
1900 | Â Â Â func_split_short_opt_arg=`expr "x$1"Â : 'x-.\(.*\)$'` |
---|
1901 | Â } |
---|
1902 | fi #func_split_short_opt |
---|
1903 | |
---|
1904 | |
---|
1905 | # func_usage |
---|
1906 | # ---------- |
---|
1907 | # Echo short help message to standard output and exit. |
---|
1908 | func_usage () |
---|
1909 | { |
---|
1910 | Â Â $debug_cmd |
---|
1911 | |
---|
1912 | Â Â func_usage_message |
---|
1913 | Â Â $ECHOÂ "Run '$progname --help |${PAGER-more}' for full usage" |
---|
1914 | Â Â exit 0 |
---|
1915 | } |
---|
1916 | |
---|
1917 | |
---|
1918 | # func_usage_message |
---|
1919 | # ------------------ |
---|
1920 | # Echo short help message to standard output. |
---|
1921 | func_usage_message () |
---|
1922 | { |
---|
1923 | Â Â $debug_cmd |
---|
1924 | |
---|
1925 |   eval \$ECHO \""Usage: $usage"\" |
---|
1926 | Â Â echo |
---|
1927 | Â Â $SEDÂ -n 's|^# || |
---|
1928 | Â Â Â Â /^Written by/{ |
---|
1929 | Â Â Â Â Â x;p;x |
---|
1930 | Â Â Â Â } |
---|
1931 | Â Â Â Â h |
---|
1932 | Â Â Â Â /^Written by/q'Â < "$progpath" |
---|
1933 | Â Â echo |
---|
1934 |   eval \$ECHO \""$usage_message"\" |
---|
1935 | } |
---|
1936 | |
---|
1937 | |
---|
1938 | # func_version |
---|
1939 | # ------------ |
---|
1940 | # Echo version message to standard output and exit. |
---|
1941 | func_version () |
---|
1942 | { |
---|
1943 | Â Â $debug_cmd |
---|
1944 | |
---|
1945 |   printf '%s\n' "$progname $scriptversion" |
---|
1946 | Â Â $SEDÂ -n ' |
---|
1947 | Â Â Â Â /(C)/!b go |
---|
1948 | Â Â Â Â :more |
---|
1949 | Â Â Â Â /\./!{ |
---|
1950 | Â Â Â Â Â N |
---|
1951 | Â Â Â Â Â s|\n# | | |
---|
1952 | Â Â Â Â Â b more |
---|
1953 | Â Â Â Â } |
---|
1954 | Â Â Â Â :go |
---|
1955 | Â Â Â Â /^# Written by /,/# warranty; / { |
---|
1956 | Â Â Â Â Â s|^# || |
---|
1957 | Â Â Â Â Â s|^# *$|| |
---|
1958 | Â Â Â Â Â s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2| |
---|
1959 | Â Â Â Â Â p |
---|
1960 | Â Â Â Â } |
---|
1961 | Â Â Â Â /^# Written by / { |
---|
1962 | Â Â Â Â Â s|^# || |
---|
1963 | Â Â Â Â Â p |
---|
1964 | Â Â Â Â } |
---|
1965 | Â Â Â Â /^warranty; /q'Â < "$progpath" |
---|
1966 | |
---|
1967 |   exit $? |
---|
1968 | } |
---|
1969 | |
---|
1970 | |
---|
1971 | # Local variables: |
---|
1972 | # mode: shell-script |
---|
1973 | # sh-indentation: 2 |
---|
1974 | # eval: (add-hook 'before-save-hook 'time-stamp) |
---|
1975 | # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC" |
---|
1976 | # time-stamp-time-zone: "UTC" |
---|
1977 | # End: |
---|
1978 | |
---|
1979 | # Set a version string. |
---|
1980 | scriptversion='(GNU libtool) 2.4.6' |
---|
1981 | |
---|
1982 | |
---|
1983 | # func_echo ARG... |
---|
1984 | # ---------------- |
---|
1985 | # Libtool also displays the current mode in messages, so override |
---|
1986 | # funclib.sh func_echo with this custom definition. |
---|
1987 | func_echo () |
---|
1988 | { |
---|
1989 | Â Â $debug_cmd |
---|
1990 | |
---|
1991 | Â Â _G_message=$* |
---|
1992 | |
---|
1993 | Â Â func_echo_IFS=$IFS |
---|
1994 | Â Â IFS=$nl |
---|
1995 | Â Â for _G_line in $_G_message; do |
---|
1996 | Â Â Â IFS=$func_echo_IFS |
---|
1997 | Â Â Â $ECHOÂ "$progname${opt_mode+: $opt_mode}: $_G_line" |
---|
1998 | Â Â done |
---|
1999 | Â Â IFS=$func_echo_IFS |
---|
2000 | } |
---|
2001 | |
---|
2002 | |
---|
2003 | # func_warning ARG... |
---|
2004 | # ------------------- |
---|
2005 | # Libtool warnings are not categorized, so override funclib.sh |
---|
2006 | # func_warning with this simpler definition. |
---|
2007 | func_warning () |
---|
2008 | { |
---|
2009 | Â Â $debug_cmd |
---|
2010 | |
---|
2011 |   $warning_func ${1+"$@"} |
---|
2012 | } |
---|
2013 | |
---|
2014 | |
---|
2015 | ## ---------------- ## |
---|
2016 | ## Options parsing. ## |
---|
2017 | ## ---------------- ## |
---|
2018 | |
---|
2019 | # Hook in the functions to make sure our own options are parsed during |
---|
2020 | # the option parsing loop. |
---|
2021 | |
---|
2022 | usage='$progpath [OPTION]... [MODE-ARG]...' |
---|
2023 | |
---|
2024 | # Short help message in response to '-h'. |
---|
2025 | usage_message="Options: |
---|
2026 |     --config       show all configuration variables |
---|
2027 |     --debug       enable verbose shell tracing |
---|
2028 |   -n, --dry-run      display commands without modifying any files |
---|
2029 |     --features      display basic configuration information and exit |
---|
2030 | Â Â Â Â --mode=MODEÂ Â Â Â Â use operation mode MODE |
---|
2031 |     --no-warnings    equivalent to '-Wnone' |
---|
2032 |     --preserve-dup-deps don't remove duplicate dependency libraries |
---|
2033 |     --quiet, --silent  don't print informational messages |
---|
2034 | Â Â Â Â --tag=TAGÂ Â Â Â Â Â use configuration variables from tag TAG |
---|
2035 |   -v, --verbose      print more informational messages than default |
---|
2036 |     --version      print version information |
---|
2037 | Â Â -W, --warnings=CATEGORYÂ report the warnings falling in CATEGORY [all] |
---|
2038 |   -h, --help, --help-all  print short, long, or detailed help message |
---|
2039 | " |
---|
2040 | |
---|
2041 | # Additional text appended to 'usage_message' in response to '--help'. |
---|
2042 | func_help () |
---|
2043 | { |
---|
2044 | Â Â $debug_cmd |
---|
2045 | |
---|
2046 | Â Â func_usage_message |
---|
2047 | Â Â $ECHOÂ "$long_help_message |
---|
2048 | |
---|
2049 | MODE must be one of the following: |
---|
2050 | |
---|
2051 |     clean      remove files from the build directory |
---|
2052 |     compile     compile a source file into a libtool object |
---|
2053 |     execute     automatically set library path, then run a program |
---|
2054 |     finish     complete the installation of libtool libraries |
---|
2055 |     install     install libraries or executables |
---|
2056 |     link      create a library or an executable |
---|
2057 |     uninstall    remove libraries from an installed directory |
---|
2058 | |
---|
2059 | MODE-ARGS vary depending on the MODE. When passed as first option, |
---|
2060 | '--mode=MODE' may be abbreviated as 'MODE' or a unique abbreviation of that. |
---|
2061 | Try '$progname --help --mode=MODE' for a more detailed description of MODE. |
---|
2062 | |
---|
2063 | When reporting a bug, please describe a test case to reproduce it and |
---|
2064 | include the following information: |
---|
2065 | |
---|
2066 | Â Â Â Â host-triplet:Â Â $host |
---|
2067 | Â Â Â Â shell:Â Â Â Â Â $SHELL |
---|
2068 | Â Â Â Â compiler:Â Â Â Â $LTCC |
---|
2069 | Â Â Â Â compiler flags: $LTCFLAGS |
---|
2070 | Â Â Â Â linker:Â Â Â Â Â $LD (gnu? $with_gnu_ld) |
---|
2071 | Â Â Â Â version:Â Â Â Â $progname (GNU libtool) 2.4.6 |
---|
2072 | Â Â Â Â automake:Â Â Â Â `($AUTOMAKE --version) 2>/dev/null |$SED 1q` |
---|
2073 | Â Â Â Â autoconf:Â Â Â Â `($AUTOCONF --version) 2>/dev/null |$SED 1q` |
---|
2074 | |
---|
2075 | Report bugs to <bug-libtool@gnu.org>. |
---|
2076 | GNU libtool home page: <http://www.gnu.org/software/libtool/>. |
---|
2077 | General help using GNU software: <http://www.gnu.org/gethelp/>." |
---|
2078 | Â Â exit 0 |
---|
2079 | } |
---|
2080 | |
---|
2081 | |
---|
2082 | # func_lo2o OBJECT-NAME |
---|
2083 | # --------------------- |
---|
2084 | # Transform OBJECT-NAME from a '.lo' suffix to the platform specific |
---|
2085 | # object suffix. |
---|
2086 | |
---|
2087 | lo2o=s/\\.lo\$/.$objext/ |
---|
2088 | o2lo=s/\\.$objext\$/.lo/ |
---|
2089 | |
---|
2090 | if test yes = "$_G_HAVE_XSI_OPS"; then |
---|
2091 |  eval 'func_lo2o () |
---|
2092 | Â { |
---|
2093 | Â Â case $1 in |
---|
2094 | Â Â Â *.lo) func_lo2o_result=${1%.lo}.$objext ;; |
---|
2095 | Â Â Â *Â Â ) func_lo2o_result=$1Â Â Â Â Â Â Â Â ;; |
---|
2096 | Â Â esac |
---|
2097 | Â }' |
---|
2098 | |
---|
2099 | Â # func_xform LIBOBJ-OR-SOURCE |
---|
2100 | Â # --------------------------- |
---|
2101 | Â # Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise) |
---|
2102 | Â # suffix to a '.lo' libtool-object suffix. |
---|
2103 |  eval 'func_xform () |
---|
2104 | Â { |
---|
2105 | Â Â func_xform_result=${1%.*}.lo |
---|
2106 | Â }' |
---|
2107 | else |
---|
2108 | Â # ...otherwise fall back to using sed. |
---|
2109 | Â func_lo2o () |
---|
2110 | Â { |
---|
2111 | Â Â func_lo2o_result=`$ECHOÂ "$1"Â | $SEDÂ "$lo2o"` |
---|
2112 | Â } |
---|
2113 | |
---|
2114 | Â func_xform () |
---|
2115 | Â { |
---|
2116 | Â Â func_xform_result=`$ECHOÂ "$1"Â | $SEDÂ 's|\.[^.]*$|.lo|'` |
---|
2117 | Â } |
---|
2118 | fi |
---|
2119 | |
---|
2120 | |
---|
2121 | # func_fatal_configuration ARG... |
---|
2122 | # ------------------------------- |
---|
2123 | # Echo program name prefixed message to standard error, followed by |
---|
2124 | # a configuration failure hint, and exit. |
---|
2125 | func_fatal_configuration () |
---|
2126 | { |
---|
2127 | Â Â func__fatal_error ${1+"$@"}Â \ |
---|
2128 | Â Â Â "See the $PACKAGE documentation for more information."Â \ |
---|
2129 | Â Â Â "Fatal configuration error." |
---|
2130 | } |
---|
2131 | |
---|
2132 | |
---|
2133 | # func_config |
---|
2134 | # ----------- |
---|
2135 | # Display the configuration for all the tags in this script. |
---|
2136 | func_config () |
---|
2137 | { |
---|
2138 | Â Â re_begincf='^# ### BEGIN LIBTOOL' |
---|
2139 | Â Â re_endcf='^# ### END LIBTOOL' |
---|
2140 | |
---|
2141 | Â Â # Default configuration. |
---|
2142 | Â Â $SEDÂ "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d"Â < "$progpath" |
---|
2143 | |
---|
2144 | Â Â # Now print the configurations for the tags. |
---|
2145 | Â Â for tagname in $taglist; do |
---|
2146 | Â Â Â $SEDÂ -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p"Â < "$progpath" |
---|
2147 | Â Â done |
---|
2148 | |
---|
2149 |   exit $? |
---|
2150 | } |
---|
2151 | |
---|
2152 | |
---|
2153 | # func_features |
---|
2154 | # ------------- |
---|
2155 | # Display the features supported by this script. |
---|
2156 | func_features () |
---|
2157 | { |
---|
2158 |   echo "host: $host" |
---|
2159 |   if test yes = "$build_libtool_libs"; then |
---|
2160 |    echo "enable shared libraries" |
---|
2161 | Â Â else |
---|
2162 |    echo "disable shared libraries" |
---|
2163 | Â Â fi |
---|
2164 |   if test yes = "$build_old_libs"; then |
---|
2165 |    echo "enable static libraries" |
---|
2166 | Â Â else |
---|
2167 |    echo "disable static libraries" |
---|
2168 | Â Â fi |
---|
2169 | |
---|
2170 |   exit $? |
---|
2171 | } |
---|
2172 | |
---|
2173 | |
---|
2174 | # func_enable_tag TAGNAME |
---|
2175 | # ----------------------- |
---|
2176 | # Verify that TAGNAME is valid, and either flag an error and exit, or |
---|
2177 | # enable the TAGNAME tag. We also add TAGNAME to the global $taglist |
---|
2178 | # variable here. |
---|
2179 | func_enable_tag () |
---|
2180 | { |
---|
2181 | Â Â # Global variable: |
---|
2182 | Â Â tagname=$1 |
---|
2183 | |
---|
2184 | Â Â re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" |
---|
2185 | Â Â re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" |
---|
2186 | Â Â sed_extractcf=/$re_begincf/,/$re_endcf/p |
---|
2187 | |
---|
2188 | Â Â # Validate tagname. |
---|
2189 |   case $tagname in |
---|
2190 | Â Â Â *[!-_A-Za-z0-9,/]*) |
---|
2191 | Â Â Â Â func_fatal_error "invalid tag name: $tagname" |
---|
2192 | Â Â Â Â ;; |
---|
2193 | Â Â esac |
---|
2194 | |
---|
2195 | Â Â # Don't test for the "default" C tag, as we know it's |
---|
2196 | Â Â # there but not specially marked. |
---|
2197 |   case $tagname in |
---|
2198 | Â Â Â Â CC)Â ;; |
---|
2199 | Â Â *) |
---|
2200 |     if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then |
---|
2201 | Â Â Â Â Â taglist="$taglist $tagname" |
---|
2202 | |
---|
2203 |      # Evaluate the configuration. Be careful to quote the path |
---|
2204 | Â Â Â Â Â # and the sed script, to avoid splitting on whitespace, but |
---|
2205 | Â Â Â Â Â # also don't use non-portable quotes within backquotes within |
---|
2206 | Â Â Â Â Â # quotes we have to do it in 2 steps: |
---|
2207 | Â Â Â Â Â extractedcf=`$SEDÂ -n -e "$sed_extractcf"Â < "$progpath"` |
---|
2208 |      eval "$extractedcf" |
---|
2209 | Â Â Â Â else |
---|
2210 | Â Â Â Â Â func_error "ignoring unknown tag $tagname" |
---|
2211 | Â Â Â Â fi |
---|
2212 | Â Â Â Â ;; |
---|
2213 | Â Â esac |
---|
2214 | } |
---|
2215 | |
---|
2216 | |
---|
2217 | # func_check_version_match |
---|
2218 | # ------------------------ |
---|
2219 | # Ensure that we are using m4 macros, and libtool script from the same |
---|
2220 | # release of libtool. |
---|
2221 | func_check_version_match () |
---|
2222 | { |
---|
2223 |   if test "$package_revision" != "$macro_revision"; then |
---|
2224 |    if test "$VERSION" != "$macro_version"; then |
---|
2225 |     if test -z "$macro_version"; then |
---|
2226 | Â Â Â Â Â cat >&2 <<_LT_EOF |
---|
2227 | $progname: Version mismatch error. This is $PACKAGE $VERSION, but the |
---|
2228 | $progname: definition of this LT_INIT comes from an older release. |
---|
2229 | $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION |
---|
2230 | $progname: and run autoconf again. |
---|
2231 | _LT_EOF |
---|
2232 | Â Â Â Â else |
---|
2233 | Â Â Â Â Â cat >&2 <<_LT_EOF |
---|
2234 | $progname: Version mismatch error. This is $PACKAGE $VERSION, but the |
---|
2235 | $progname: definition of this LT_INIT comes from $PACKAGE $macro_version. |
---|
2236 | $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION |
---|
2237 | $progname: and run autoconf again. |
---|
2238 | _LT_EOF |
---|
2239 | Â Â Â Â fi |
---|
2240 | Â Â Â else |
---|
2241 | Â Â Â Â cat >&2 <<_LT_EOF |
---|
2242 | $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, |
---|
2243 | $progname: but the definition of this LT_INIT comes from revision $macro_revision. |
---|
2244 | $progname: You should recreate aclocal.m4 with macros from revision $package_revision |
---|
2245 | $progname: of $PACKAGE $VERSION and run autoconf again. |
---|
2246 | _LT_EOF |
---|
2247 | Â Â Â fi |
---|
2248 | |
---|
2249 |    exit $EXIT_MISMATCH |
---|
2250 | Â Â fi |
---|
2251 | } |
---|
2252 | |
---|
2253 | |
---|
2254 | # libtool_options_prep [ARG]... |
---|
2255 | # ----------------------------- |
---|
2256 | # Preparation for options parsed by libtool. |
---|
2257 | libtool_options_prep () |
---|
2258 | { |
---|
2259 | Â Â $debug_mode |
---|
2260 | |
---|
2261 | Â Â # Option defaults: |
---|
2262 | Â Â opt_config=false |
---|
2263 | Â Â opt_dlopen= |
---|
2264 | Â Â opt_dry_run=false |
---|
2265 | Â Â opt_help=false |
---|
2266 | Â Â opt_mode= |
---|
2267 | Â Â opt_preserve_dup_deps=false |
---|
2268 | Â Â opt_quiet=false |
---|
2269 | |
---|
2270 | Â Â nonopt= |
---|
2271 | Â Â preserve_args= |
---|
2272 | |
---|
2273 | Â Â # Shorthand for --mode=foo, only valid as the first argument |
---|
2274 |   case $1 in |
---|
2275 | Â Â clean|clea|cle|cl) |
---|
2276 | Â Â Â shift; set dummy --mode clean ${1+"$@"}; shift |
---|
2277 | Â Â Â ;; |
---|
2278 | Â Â compile|compil|compi|comp|com|co|c) |
---|
2279 | Â Â Â shift; set dummy --mode compile ${1+"$@"}; shift |
---|
2280 | Â Â Â ;; |
---|
2281 | Â Â execute|execut|execu|exec|exe|ex|e) |
---|
2282 | Â Â Â shift; set dummy --mode execute ${1+"$@"}; shift |
---|
2283 | Â Â Â ;; |
---|
2284 | Â Â finish|finis|fini|fin|fi|f) |
---|
2285 | Â Â Â shift; set dummy --mode finish ${1+"$@"}; shift |
---|
2286 | Â Â Â ;; |
---|
2287 | Â Â install|instal|insta|inst|ins|in|i) |
---|
2288 | Â Â Â shift; set dummy --mode install ${1+"$@"}; shift |
---|
2289 | Â Â Â ;; |
---|
2290 | Â Â link|lin|li|l) |
---|
2291 | Â Â Â shift; set dummy --mode link ${1+"$@"}; shift |
---|
2292 | Â Â Â ;; |
---|
2293 | Â Â uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) |
---|
2294 | Â Â Â shift; set dummy --mode uninstall ${1+"$@"}; shift |
---|
2295 | Â Â Â ;; |
---|
2296 | Â Â esac |
---|
2297 | |
---|
2298 | Â Â # Pass back the list of options. |
---|
2299 | Â Â func_quote_for_eval ${1+"$@"} |
---|
2300 | Â Â libtool_options_prep_result=$func_quote_for_eval_result |
---|
2301 | } |
---|
2302 | func_add_hook func_options_prep libtool_options_prep |
---|
2303 | |
---|
2304 | |
---|
2305 | # libtool_parse_options [ARG]... |
---|
2306 | # --------------------------------- |
---|
2307 | # Provide handling for libtool specific options. |
---|
2308 | libtool_parse_options () |
---|
2309 | { |
---|
2310 | Â Â $debug_cmd |
---|
2311 | |
---|
2312 | Â Â # Perform our own loop to consume as many options as possible in |
---|
2313 | Â Â # each iteration. |
---|
2314 |   while test $# -gt 0; do |
---|
2315 | Â Â Â _G_opt=$1 |
---|
2316 | Â Â Â shift |
---|
2317 |    case $_G_opt in |
---|
2318 | Â Â Â Â --dry-run|--dryrun|-n) |
---|
2319 | Â Â Â Â Â Â Â Â Â Â Â Â opt_dry_run=: |
---|
2320 | Â Â Â Â Â Â Â Â Â Â Â Â ;; |
---|
2321 | |
---|
2322 | Â Â Â Â --config)Â Â Â Â func_config ;; |
---|
2323 | |
---|
2324 | Â Â Â Â --dlopen|-dlopen) |
---|
2325 | Â Â Â Â Â Â Â Â Â Â Â Â opt_dlopen="${opt_dlopen+$opt_dlopen |
---|
2326 | }$1" |
---|
2327 | Â Â Â Â Â Â Â Â Â Â Â Â shift |
---|
2328 | Â Â Â Â Â Â Â Â Â Â Â Â ;; |
---|
2329 | |
---|
2330 | Â Â Â Â --preserve-dup-deps) |
---|
2331 | Â Â Â Â Â Â Â Â Â Â Â Â opt_preserve_dup_deps=: ;; |
---|
2332 | |
---|
2333 | Â Â Â Â --features)Â Â Â func_features ;; |
---|
2334 | |
---|
2335 |     --finish)    set dummy --mode finish ${1+"$@"}; shift ;; |
---|
2336 | |
---|
2337 | Â Â Â Â --help)Â Â Â Â Â opt_help=: ;; |
---|
2338 | |
---|
2339 | Â Â Â Â --help-all)Â Â Â opt_help=': help-all'Â ;; |
---|
2340 | |
---|
2341 |     --mode)     test $# = 0 && func_missing_arg $_G_opt && break |
---|
2342 | Â Â Â Â Â Â Â Â Â Â Â Â opt_mode=$1 |
---|
2343 |             case $1 in |
---|
2344 | Â Â Â Â Â Â Â Â Â Â Â Â Â # Valid mode arguments: |
---|
2345 | Â Â Â Â Â Â Â Â Â Â Â Â Â clean|compile|execute|finish|install|link|relink|uninstall)Â ;; |
---|
2346 | |
---|
2347 | Â Â Â Â Â Â Â Â Â Â Â Â Â # Catch anything else as an error |
---|
2348 | Â Â Â Â Â Â Â Â Â Â Â Â Â *)Â func_error "invalid argument for $_G_opt" |
---|
2349 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â exit_cmd=exit |
---|
2350 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â break |
---|
2351 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ;; |
---|
2352 | Â Â Â Â Â Â Â Â Â Â Â Â esac |
---|
2353 | Â Â Â Â Â Â Â Â Â Â Â Â shift |
---|
2354 | Â Â Â Â Â Â Â Â Â Â Â Â ;; |
---|
2355 | |
---|
2356 | Â Â Â Â --no-silent|--no-quiet) |
---|
2357 | Â Â Â Â Â Â Â Â Â Â Â Â opt_quiet=false |
---|
2358 | Â Â Â Â Â Â Â Â Â Â Â Â func_append preserve_args " $_G_opt" |
---|
2359 | Â Â Â Â Â Â Â Â Â Â Â Â ;; |
---|
2360 | |
---|
2361 | Â Â Â Â --no-warnings|--no-warning|--no-warn) |
---|
2362 | Â Â Â Â Â Â Â Â Â Â Â Â opt_warning=false |
---|
2363 | Â Â Â Â Â Â Â Â Â Â Â Â func_append preserve_args " $_G_opt" |
---|
2364 | Â Â Â Â Â Â Â Â Â Â Â Â ;; |
---|
2365 | |
---|
2366 | Â Â Â Â --no-verbose) |
---|
2367 | Â Â Â Â Â Â Â Â Â Â Â Â opt_verbose=false |
---|
2368 | Â Â Â Â Â Â Â Â Â Â Â Â func_append preserve_args " $_G_opt" |
---|
2369 | Â Â Â Â Â Â Â Â Â Â Â Â ;; |
---|
2370 | |
---|
2371 | Â Â Â Â --silent|--quiet) |
---|
2372 | Â Â Â Â Â Â Â Â Â Â Â Â opt_quiet=: |
---|
2373 | Â Â Â Â Â Â Â Â Â Â Â Â opt_verbose=false |
---|
2374 | Â Â Â Â Â Â Â Â Â Â Â Â func_append preserve_args " $_G_opt" |
---|
2375 | Â Â Â Â Â Â Â Â Â Â Â Â ;; |
---|
2376 | |
---|
2377 |     --tag)     test $# = 0 && func_missing_arg $_G_opt && break |
---|
2378 | Â Â Â Â Â Â Â Â Â Â Â Â opt_tag=$1 |
---|
2379 | Â Â Â Â Â Â Â Â Â Â Â Â func_append preserve_args " $_G_opt $1" |
---|
2380 | Â Â Â Â Â Â Â Â Â Â Â Â func_enable_tag "$1" |
---|
2381 | Â Â Â Â Â Â Â Â Â Â Â Â shift |
---|
2382 | Â Â Â Â Â Â Â Â Â Â Â Â ;; |
---|
2383 | |
---|
2384 | Â Â Â Â --verbose|-v)Â Â opt_quiet=false |
---|
2385 | Â Â Â Â Â Â Â Â Â Â Â Â opt_verbose=: |
---|
2386 | Â Â Â Â Â Â Â Â Â Â Â Â func_append preserve_args " $_G_opt" |
---|
2387 | Â Â Â Â Â Â Â Â Â Â Â Â ;; |
---|
2388 | |
---|
2389 | Â Â Â Â # An option not handled by this hook function: |
---|
2390 |     *)       set dummy "$_G_opt" ${1+"$@"}; shift; break ;; |
---|
2391 | Â Â Â esac |
---|
2392 | Â Â done |
---|
2393 | |
---|
2394 | |
---|
2395 | Â Â # save modified positional parameters for caller |
---|
2396 | Â Â func_quote_for_eval ${1+"$@"} |
---|
2397 | Â Â libtool_parse_options_result=$func_quote_for_eval_result |
---|
2398 | } |
---|
2399 | func_add_hook func_parse_options libtool_parse_options |
---|
2400 | |
---|
2401 | |
---|
2402 | |
---|
2403 | # libtool_validate_options [ARG]... |
---|
2404 | # --------------------------------- |
---|
2405 | # Perform any sanity checks on option settings and/or unconsumed |
---|
2406 | # arguments. |
---|
2407 | libtool_validate_options () |
---|
2408 | { |
---|
2409 | Â Â # save first non-option argument |
---|
2410 | Â Â if test 0 -lt $#;Â then |
---|
2411 | Â Â Â nonopt=$1 |
---|
2412 | Â Â Â shift |
---|
2413 | Â Â fi |
---|
2414 | |
---|
2415 | Â Â # preserve --debug |
---|
2416 |   test : = "$debug_cmd" || func_append preserve_args " --debug" |
---|
2417 | |
---|
2418 |   case $host in |
---|
2419 | Â Â Â # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452 |
---|
2420 | Â Â Â # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788 |
---|
2421 | Â Â Â *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*) |
---|
2422 | Â Â Â Â # don't eliminate duplications in $postdeps and $predeps |
---|
2423 | Â Â Â Â opt_duplicate_compiler_generated_deps=: |
---|
2424 | Â Â Â Â ;; |
---|
2425 | Â Â Â *) |
---|
2426 | Â Â Â Â opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps |
---|
2427 | Â Â Â Â ;; |
---|
2428 | Â Â esac |
---|
2429 | |
---|
2430 |   $opt_help || { |
---|
2431 | Â Â Â # Sanity checks first: |
---|
2432 | Â Â Â func_check_version_match |
---|
2433 | |
---|
2434 | Â Â Â test yes !=Â "$build_libtool_libs"Â \ |
---|
2435 | Â Â Â Â &&Â test yes !=Â "$build_old_libs"Â \ |
---|
2436 | Â Â Â Â &&Â func_fatal_configuration "not configured to build any kind of library" |
---|
2437 | |
---|
2438 | Â Â Â # Darwin sucks |
---|
2439 | Â Â Â eval std_shrext=\"$shrext_cmds\" |
---|
2440 | |
---|
2441 | Â Â Â # Only execute mode is allowed to have -dlopen flags. |
---|
2442 |    if test -n "$opt_dlopen" && test execute != "$opt_mode"; then |
---|
2443 | Â Â Â Â func_error "unrecognized option '-dlopen'" |
---|
2444 | Â Â Â Â $ECHOÂ "$help"Â 1>&2 |
---|
2445 |     exit $EXIT_FAILURE |
---|
2446 | Â Â Â fi |
---|
2447 | |
---|
2448 | Â Â Â # Change the help message to a mode-specific one. |
---|
2449 | Â Â Â generic_help=$help |
---|
2450 | Â Â Â help="Try '$progname --help --mode=$opt_mode' for more information." |
---|
2451 | Â Â } |
---|
2452 | |
---|
2453 | Â Â # Pass back the unparsed argument list |
---|
2454 | Â Â func_quote_for_eval ${1+"$@"} |
---|
2455 | Â Â libtool_validate_options_result=$func_quote_for_eval_result |
---|
2456 | } |
---|
2457 | func_add_hook func_validate_options libtool_validate_options |
---|
2458 | |
---|
2459 | |
---|
2460 | # Process options as early as possible so that --help and --version |
---|
2461 | # can return quickly. |
---|
2462 | func_options ${1+"$@"} |
---|
2463 | eval set dummy "$func_options_result"; shift |
---|
2464 | |
---|
2465 | |
---|
2466 | |
---|
2467 | ## ----------- ## |
---|
2468 | ##  Main.  ## |
---|
2469 | ## ----------- ## |
---|
2470 | |
---|
2471 | magic='%%%MAGIC variable%%%' |
---|
2472 | magic_exe='%%%MAGIC EXE variable%%%' |
---|
2473 | |
---|
2474 | # Global variables. |
---|
2475 | extracted_archives= |
---|
2476 | extracted_serial=0 |
---|
2477 | |
---|
2478 | # If this variable is set in any of the actions, the command in it |
---|
2479 | # will be execed at the end. This prevents here-documents from being |
---|
2480 | # left over by shells. |
---|
2481 | exec_cmd= |
---|
2482 | |
---|
2483 | |
---|
2484 | # A function that is used when there is no print builtin or printf. |
---|
2485 | func_fallback_echo () |
---|
2486 | { |
---|
2487 |  eval 'cat <<_LTECHO_EOF |
---|
2488 | $1 |
---|
2489 | _LTECHO_EOF' |
---|
2490 | } |
---|
2491 | |
---|
2492 | # func_generated_by_libtool |
---|
2493 | # True iff stdin has been generated by Libtool. This function is only |
---|
2494 | # a basic sanity check; it will hardly flush out determined imposters. |
---|
2495 | func_generated_by_libtool_p () |
---|
2496 | { |
---|
2497 | Â $GREPÂ "^# Generated by .*$PACKAGE"Â > /dev/null 2>&1 |
---|
2498 | } |
---|
2499 | |
---|
2500 | # func_lalib_p file |
---|
2501 | # True iff FILE is a libtool '.la' library or '.lo' object file. |
---|
2502 | # This function is only a basic sanity check; it will hardly flush out |
---|
2503 | # determined imposters. |
---|
2504 | func_lalib_p () |
---|
2505 | { |
---|
2506 |   test -f "$1" && |
---|
2507 | Â Â Â $SEDÂ -e 4q "$1"Â 2>/dev/null | func_generated_by_libtool_p |
---|
2508 | } |
---|
2509 | |
---|
2510 | # func_lalib_unsafe_p file |
---|
2511 | # True iff FILE is a libtool '.la' library or '.lo' object file. |
---|
2512 | # This function implements the same check as func_lalib_p without |
---|
2513 | # resorting to external programs. To this end, it redirects stdin and |
---|
2514 | # closes it afterwards, without saving the original file descriptor. |
---|
2515 | # As a safety measure, use it only where a negative result would be |
---|
2516 | # fatal anyway. Works if 'file' does not exist. |
---|
2517 | func_lalib_unsafe_p () |
---|
2518 | { |
---|
2519 | Â Â lalib_p=no |
---|
2520 |   if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then |
---|
2521 | Â Â Â Â for lalib_p_l in 1 2 3 4 |
---|
2522 | Â Â Â Â do |
---|
2523 | Â Â Â Â Â Â read lalib_p_line |
---|
2524 |       case $lalib_p_line in |
---|
2525 | Â Â Â Â Â Â Â Â \#\ Generated\ by\ *$PACKAGE* )Â lalib_p=yes; break;; |
---|
2526 | Â Â Â Â Â Â esac |
---|
2527 | Â Â Â Â done |
---|
2528 | Â Â Â Â exec 0<&5 5<&- |
---|
2529 | Â Â fi |
---|
2530 |   test yes = "$lalib_p" |
---|
2531 | } |
---|
2532 | |
---|
2533 | # func_ltwrapper_script_p file |
---|
2534 | # True iff FILE is a libtool wrapper script |
---|
2535 | # This function is only a basic sanity check; it will hardly flush out |
---|
2536 | # determined imposters. |
---|
2537 | func_ltwrapper_script_p () |
---|
2538 | { |
---|
2539 |   test -f "$1" && |
---|
2540 |    $lt_truncate_bin < "$1" 2>/dev/null | func_generated_by_libtool_p |
---|
2541 | } |
---|
2542 | |
---|
2543 | # func_ltwrapper_executable_p file |
---|
2544 | # True iff FILE is a libtool wrapper executable |
---|
2545 | # This function is only a basic sanity check; it will hardly flush out |
---|
2546 | # determined imposters. |
---|
2547 | func_ltwrapper_executable_p () |
---|
2548 | { |
---|
2549 | Â Â func_ltwrapper_exec_suffix= |
---|
2550 |   case $1 in |
---|
2551 | Â Â *.exe)Â ;; |
---|
2552 | Â Â *)Â func_ltwrapper_exec_suffix=.exe ;; |
---|
2553 | Â Â esac |
---|
2554 | Â Â $GREPÂ "$magic_exe"Â "$1$func_ltwrapper_exec_suffix"Â >/dev/null 2>&1 |
---|
2555 | } |
---|
2556 | |
---|
2557 | # func_ltwrapper_scriptname file |
---|
2558 | # Assumes file is an ltwrapper_executable |
---|
2559 | # uses $file to determine the appropriate filename for a |
---|
2560 | # temporary ltwrapper_script. |
---|
2561 | func_ltwrapper_scriptname () |
---|
2562 | { |
---|
2563 | Â Â func_dirname_and_basename "$1"Â ""Â "." |
---|
2564 | Â Â func_stripname ''Â '.exe'Â "$func_basename_result" |
---|
2565 | Â Â func_ltwrapper_scriptname_result=$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper |
---|
2566 | } |
---|
2567 | |
---|
2568 | # func_ltwrapper_p file |
---|
2569 | # True iff FILE is a libtool wrapper script or wrapper executable |
---|
2570 | # This function is only a basic sanity check; it will hardly flush out |
---|
2571 | # determined imposters. |
---|
2572 | func_ltwrapper_p () |
---|
2573 | { |
---|
2574 | Â Â func_ltwrapper_script_p "$1"Â ||Â func_ltwrapper_executable_p "$1" |
---|
2575 | } |
---|
2576 | |
---|
2577 | |
---|
2578 | # func_execute_cmds commands fail_cmd |
---|
2579 | # Execute tilde-delimited COMMANDS. |
---|
2580 | # If FAIL_CMD is given, eval that upon failure. |
---|
2581 | # FAIL_CMD may read-access the current command in variable CMD! |
---|
2582 | func_execute_cmds () |
---|
2583 | { |
---|
2584 | Â Â $debug_cmd |
---|
2585 | |
---|
2586 | Â Â save_ifs=$IFS; IFS='~' |
---|
2587 | Â Â for cmd in $1; do |
---|
2588 | Â Â Â IFS=$sp$nl |
---|
2589 | Â Â Â eval cmd=\"$cmd\" |
---|
2590 | Â Â Â IFS=$save_ifs |
---|
2591 | Â Â Â func_show_eval "$cmd"Â "${2-:}" |
---|
2592 | Â Â done |
---|
2593 | Â Â IFS=$save_ifs |
---|
2594 | } |
---|
2595 | |
---|
2596 | |
---|
2597 | # func_source file |
---|
2598 | # Source FILE, adding directory component if necessary. |
---|
2599 | # Note that it is not necessary on cygwin/mingw to append a dot to |
---|
2600 | # FILE even if both FILE and FILE.exe exist: automatic-append-.exe |
---|
2601 | # behavior happens only for exec(3), not for open(2)! Also, sourcing |
---|
2602 | # 'FILE.' does not work on cygwin managed mounts. |
---|
2603 | func_source () |
---|
2604 | { |
---|
2605 | Â Â $debug_cmd |
---|
2606 | |
---|
2607 |   case $1 in |
---|
2608 | Â Â */* | *\\*)Â . "$1"Â ;; |
---|
2609 | Â Â *)Â Â Â Â Â . "./$1"Â ;; |
---|
2610 | Â Â esac |
---|
2611 | } |
---|
2612 | |
---|
2613 | |
---|
2614 | # func_resolve_sysroot PATH |
---|
2615 | # Replace a leading = in PATH with a sysroot. Store the result into |
---|
2616 | # func_resolve_sysroot_result |
---|
2617 | func_resolve_sysroot () |
---|
2618 | { |
---|
2619 | Â func_resolve_sysroot_result=$1 |
---|
2620 |  case $func_resolve_sysroot_result in |
---|
2621 | Â =*) |
---|
2622 | Â Â func_stripname '='Â ''Â "$func_resolve_sysroot_result" |
---|
2623 | Â Â func_resolve_sysroot_result=$lt_sysroot$func_stripname_result |
---|
2624 | Â Â ;; |
---|
2625 | Â esac |
---|
2626 | } |
---|
2627 | |
---|
2628 | # func_replace_sysroot PATH |
---|
2629 | # If PATH begins with the sysroot, replace it with = and |
---|
2630 | # store the result into func_replace_sysroot_result. |
---|
2631 | func_replace_sysroot () |
---|
2632 | { |
---|
2633 |  case $lt_sysroot:$1 in |
---|
2634 | Â ?*:"$lt_sysroot"*) |
---|
2635 | Â Â func_stripname "$lt_sysroot"Â ''Â "$1" |
---|
2636 | Â Â func_replace_sysroot_result='='$func_stripname_result |
---|
2637 | Â Â ;; |
---|
2638 | Â *) |
---|
2639 | Â Â # Including no sysroot. |
---|
2640 | Â Â func_replace_sysroot_result=$1 |
---|
2641 | Â Â ;; |
---|
2642 | Â esac |
---|
2643 | } |
---|
2644 | |
---|
2645 | # func_infer_tag arg |
---|
2646 | # Infer tagged configuration to use if any are available and |
---|
2647 | # if one wasn't chosen via the "--tag" command line option. |
---|
2648 | # Only attempt this if the compiler in the base compile |
---|
2649 | # command doesn't match the default compiler. |
---|
2650 | # arg is usually of the form 'gcc ...' |
---|
2651 | func_infer_tag () |
---|
2652 | { |
---|
2653 | Â Â $debug_cmd |
---|
2654 | |
---|
2655 |   if test -n "$available_tags" && test -z "$tagname"; then |
---|
2656 | Â Â Â CC_quoted= |
---|
2657 | Â Â Â for arg in $CC; do |
---|
2658 | Â Â Â Â func_append_quoted CC_quoted "$arg" |
---|
2659 | Â Â Â done |
---|
2660 | Â Â Â CC_expanded=`func_echo_all $CC` |
---|
2661 | Â Â Â CC_quoted_expanded=`func_echo_all $CC_quoted` |
---|
2662 |    case $@ in |
---|
2663 | Â Â Â # Blanks in the command may have been stripped by the calling shell, |
---|
2664 | Â Â Â # but not from the CC environment variable when configure was run. |
---|
2665 | Â Â Â " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ |
---|
2666 | Â Â Â " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)Â ;; |
---|
2667 | Â Â Â # Blanks at the start of $base_compile will cause this to fail |
---|
2668 | Â Â Â # if we don't check for them as well. |
---|
2669 | Â Â Â *) |
---|
2670 | Â Â Â Â for z in $available_tags; do |
---|
2671 |      if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then |
---|
2672 | Â Â Â Â Â Â # Evaluate the configuration. |
---|
2673 |       eval "`$SED -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" |
---|
2674 | Â Â Â Â Â Â CC_quoted= |
---|
2675 | Â Â Â Â Â Â for arg in $CC; do |
---|
2676 | Â Â Â Â Â Â Â # Double-quote args containing other shell metacharacters. |
---|
2677 | Â Â Â Â Â Â Â func_append_quoted CC_quoted "$arg" |
---|
2678 | Â Â Â Â Â Â done |
---|
2679 | Â Â Â Â Â Â CC_expanded=`func_echo_all $CC` |
---|
2680 | Â Â Â Â Â Â CC_quoted_expanded=`func_echo_all $CC_quoted` |
---|
2681 |       case "$@ " in |
---|
2682 | Â Â Â Â Â Â " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ |
---|
2683 | Â Â Â Â Â Â " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) |
---|
2684 | Â Â Â Â Â Â Â # The compiler in the base compile command matches |
---|
2685 | Â Â Â Â Â Â Â # the one in the tagged configuration. |
---|
2686 | Â Â Â Â Â Â Â # Assume this is the tagged configuration we want. |
---|
2687 | Â Â Â Â Â Â Â tagname=$z |
---|
2688 | Â Â Â Â Â Â Â break |
---|
2689 | Â Â Â Â Â Â Â ;; |
---|
2690 | Â Â Â Â Â Â esac |
---|
2691 | Â Â Â Â Â fi |
---|
2692 | Â Â Â Â done |
---|
2693 | Â Â Â Â # If $tagname still isn't set, then no tagged configuration |
---|
2694 | Â Â Â Â # was found and let the user know that the "--tag" command |
---|
2695 | Â Â Â Â # line option must be used. |
---|
2696 |     if test -z "$tagname"; then |
---|
2697 | Â Â Â Â Â func_echo "unable to infer tagged configuration" |
---|
2698 | Â Â Â Â Â func_fatal_error "specify a tag with '--tag'" |
---|
2699 | #Â Â Â Â else |
---|
2700 | #Â Â Â Â Â func_verbose "using $tagname tagged configuration" |
---|
2701 | Â Â Â Â fi |
---|
2702 | Â Â Â Â ;; |
---|
2703 | Â Â Â esac |
---|
2704 | Â Â fi |
---|
2705 | } |
---|
2706 | |
---|
2707 | |
---|
2708 | |
---|
2709 | # func_write_libtool_object output_name pic_name nonpic_name |
---|
2710 | # Create a libtool object file (analogous to a ".la" file), |
---|
2711 | # but don't create it if we're doing a dry run. |
---|
2712 | func_write_libtool_object () |
---|
2713 | { |
---|
2714 | Â Â write_libobj=$1 |
---|
2715 |   if test yes = "$build_libtool_libs"; then |
---|
2716 | Â Â Â write_lobj=\'$2\' |
---|
2717 | Â Â else |
---|
2718 | Â Â Â write_lobj=none |
---|
2719 | Â Â fi |
---|
2720 | |
---|
2721 |   if test yes = "$build_old_libs"; then |
---|
2722 | Â Â Â write_oldobj=\'$3\' |
---|
2723 | Â Â else |
---|
2724 | Â Â Â write_oldobj=none |
---|
2725 | Â Â fi |
---|
2726 | |
---|
2727 |   $opt_dry_run || { |
---|
2728 | Â Â Â cat >${write_libobj}T <<EOF |
---|
2729 | # $write_libobj - a libtool object file |
---|
2730 | # Generated by $PROGRAM (GNU $PACKAGE) $VERSION |
---|
2731 | # |
---|
2732 | # Please DO NOT delete this file! |
---|
2733 | # It is necessary for linking the library. |
---|
2734 | |
---|
2735 | # Name of the PIC object. |
---|
2736 | pic_object=$write_lobj |
---|
2737 | |
---|
2738 | # Name of the non-PIC object |
---|
2739 | non_pic_object=$write_oldobj |
---|
2740 | |
---|
2741 | EOF |
---|
2742 | Â Â Â $MVÂ "${write_libobj}T"Â "$write_libobj" |
---|
2743 | Â Â } |
---|
2744 | } |
---|
2745 | |
---|
2746 | |
---|
2747 | ################################################## |
---|
2748 | # FILE NAME AND PATH CONVERSION HELPER FUNCTIONS # |
---|
2749 | ################################################## |
---|
2750 | |
---|
2751 | # func_convert_core_file_wine_to_w32 ARG |
---|
2752 | # Helper function used by file name conversion functions when $build is *nix, |
---|
2753 | # and $host is mingw, cygwin, or some other w32 environment. Relies on a |
---|
2754 | # correctly configured wine environment available, with the winepath program |
---|
2755 | # in $build's $PATH. |
---|
2756 | # |
---|
2757 | # ARG is the $build file name to be converted to w32 format. |
---|
2758 | # Result is available in $func_convert_core_file_wine_to_w32_result, and will |
---|
2759 | # be empty on error (or when ARG is empty) |
---|
2760 | func_convert_core_file_wine_to_w32 () |
---|
2761 | { |
---|
2762 | Â $debug_cmd |
---|
2763 | |
---|
2764 | Â func_convert_core_file_wine_to_w32_result=$1 |
---|
2765 |  if test -n "$1"; then |
---|
2766 | Â Â # Unfortunately, winepath does not exit with a non-zero error code, so we |
---|
2767 | Â Â # are forced to check the contents of stdout. On the other hand, if the |
---|
2768 | Â Â # command is not found, the shell will set an exit code of 127 and print |
---|
2769 | Â Â # *an error message* to stdout. So we must check for both error code of |
---|
2770 | Â Â # zero AND non-empty stdout, which explains the odd construction: |
---|
2771 | Â Â func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1"Â 2>/dev/null` |
---|
2772 |   if test "$?" -eq 0 && test -n "$func_convert_core_file_wine_to_w32_tmp"; then |
---|
2773 | Â Â Â func_convert_core_file_wine_to_w32_result=`$ECHOÂ "$func_convert_core_file_wine_to_w32_tmp"Â | |
---|
2774 | Â Â Â Â $SEDÂ -e "$sed_naive_backslashify"` |
---|
2775 | Â Â else |
---|
2776 | Â Â Â func_convert_core_file_wine_to_w32_result= |
---|
2777 | Â Â fi |
---|
2778 | Â fi |
---|
2779 | } |
---|
2780 | # end: func_convert_core_file_wine_to_w32 |
---|
2781 | |
---|
2782 | |
---|
2783 | # func_convert_core_path_wine_to_w32 ARG |
---|
2784 | # Helper function used by path conversion functions when $build is *nix, and |
---|
2785 | # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly |
---|
2786 | # configured wine environment available, with the winepath program in $build's |
---|
2787 | # $PATH. Assumes ARG has no leading or trailing path separator characters. |
---|
2788 | # |
---|
2789 | # ARG is path to be converted from $build format to win32. |
---|
2790 | # Result is available in $func_convert_core_path_wine_to_w32_result. |
---|
2791 | # Unconvertible file (directory) names in ARG are skipped; if no directory names |
---|
2792 | # are convertible, then the result may be empty. |
---|
2793 | func_convert_core_path_wine_to_w32 () |
---|
2794 | { |
---|
2795 | Â $debug_cmd |
---|
2796 | |
---|
2797 | Â # unfortunately, winepath doesn't convert paths, only file names |
---|
2798 | Â func_convert_core_path_wine_to_w32_result= |
---|
2799 |  if test -n "$1"; then |
---|
2800 | Â Â oldIFS=$IFS |
---|
2801 | Â Â IFS=: |
---|
2802 | Â Â for func_convert_core_path_wine_to_w32_f in $1; do |
---|
2803 | Â Â Â IFS=$oldIFS |
---|
2804 | Â Â Â func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" |
---|
2805 |    if test -n "$func_convert_core_file_wine_to_w32_result"; then |
---|
2806 |     if test -z "$func_convert_core_path_wine_to_w32_result"; then |
---|
2807 | Â Â Â Â Â func_convert_core_path_wine_to_w32_result=$func_convert_core_file_wine_to_w32_result |
---|
2808 | Â Â Â Â else |
---|
2809 | Â Â Â Â Â func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" |
---|
2810 | Â Â Â Â fi |
---|
2811 | Â Â Â fi |
---|
2812 | Â Â done |
---|
2813 | Â Â IFS=$oldIFS |
---|
2814 | Â fi |
---|
2815 | } |
---|
2816 | # end: func_convert_core_path_wine_to_w32 |
---|
2817 | |
---|
2818 | |
---|
2819 | # func_cygpath ARGS... |
---|
2820 | # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when |
---|
2821 | # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) |
---|
2822 | # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or |
---|
2823 | # (2), returns the Cygwin file name or path in func_cygpath_result (input |
---|
2824 | # file name or path is assumed to be in w32 format, as previously converted |
---|
2825 | # from $build's *nix or MSYS format). In case (3), returns the w32 file name |
---|
2826 | # or path in func_cygpath_result (input file name or path is assumed to be in |
---|
2827 | # Cygwin format). Returns an empty string on error. |
---|
2828 | # |
---|
2829 | # ARGS are passed to cygpath, with the last one being the file name or path to |
---|
2830 | # be converted. |
---|
2831 | # |
---|
2832 | # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH |
---|
2833 | # environment variable; do not put it in $PATH. |
---|
2834 | func_cygpath () |
---|
2835 | { |
---|
2836 | Â $debug_cmd |
---|
2837 | |
---|
2838 |  if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then |
---|
2839 | Â Â func_cygpath_result=`$LT_CYGPATHÂ "$@"Â 2>/dev/null` |
---|
2840 |   if test "$?" -ne 0; then |
---|
2841 | Â Â Â # on failure, ensure result is empty |
---|
2842 | Â Â Â func_cygpath_result= |
---|
2843 | Â Â fi |
---|
2844 | Â else |
---|
2845 | Â Â func_cygpath_result= |
---|
2846 | Â Â func_error "LT_CYGPATH is empty or specifies non-existent file: '$LT_CYGPATH'" |
---|
2847 | Â fi |
---|
2848 | } |
---|
2849 | #end: func_cygpath |
---|
2850 | |
---|
2851 | |
---|
2852 | # func_convert_core_msys_to_w32 ARG |
---|
2853 | # Convert file name or path ARG from MSYS format to w32 format. Return |
---|
2854 | # result in func_convert_core_msys_to_w32_result. |
---|
2855 | func_convert_core_msys_to_w32 () |
---|
2856 | { |
---|
2857 | Â $debug_cmd |
---|
2858 | |
---|
2859 | Â # awkward: cmd appends spaces to result |
---|
2860 |  func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | |
---|
2861 | Â Â $SEDÂ -e 's/[ ]*$//'Â -e "$sed_naive_backslashify"` |
---|
2862 | } |
---|
2863 | #end: func_convert_core_msys_to_w32 |
---|
2864 | |
---|
2865 | |
---|
2866 | # func_convert_file_check ARG1 ARG2 |
---|
2867 | # Verify that ARG1 (a file name in $build format) was converted to $host |
---|
2868 | # format in ARG2. Otherwise, emit an error message, but continue (resetting |
---|
2869 | # func_to_host_file_result to ARG1). |
---|
2870 | func_convert_file_check () |
---|
2871 | { |
---|
2872 | Â $debug_cmd |
---|
2873 | |
---|
2874 |  if test -z "$2" && test -n "$1"; then |
---|
2875 | Â Â func_error "Could not determine host file name corresponding to" |
---|
2876 | Â Â func_error "Â '$1'" |
---|
2877 | Â Â func_error "Continuing, but uninstalled executables may not work." |
---|
2878 | Â Â # Fallback: |
---|
2879 | Â Â func_to_host_file_result=$1 |
---|
2880 | Â fi |
---|
2881 | } |
---|
2882 | # end func_convert_file_check |
---|
2883 | |
---|
2884 | |
---|
2885 | # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH |
---|
2886 | # Verify that FROM_PATH (a path in $build format) was converted to $host |
---|
2887 | # format in TO_PATH. Otherwise, emit an error message, but continue, resetting |
---|
2888 | # func_to_host_file_result to a simplistic fallback value (see below). |
---|
2889 | func_convert_path_check () |
---|
2890 | { |
---|
2891 | Â $debug_cmd |
---|
2892 | |
---|
2893 |  if test -z "$4" && test -n "$3"; then |
---|
2894 | Â Â func_error "Could not determine the host path corresponding to" |
---|
2895 | Â Â func_error "Â '$3'" |
---|
2896 | Â Â func_error "Continuing, but uninstalled executables may not work." |
---|
2897 |   # Fallback. This is a deliberately simplistic "conversion" and |
---|
2898 |   # should not be "improved". See libtool.info. |
---|
2899 |   if test "x$1" != "x$2"; then |
---|
2900 | Â Â Â lt_replace_pathsep_chars="s|$1|$2|g" |
---|
2901 |    func_to_host_path_result=`echo "$3" | |
---|
2902 | Â Â Â Â $SEDÂ -e "$lt_replace_pathsep_chars"` |
---|
2903 | Â Â else |
---|
2904 | Â Â Â func_to_host_path_result=$3 |
---|
2905 | Â Â fi |
---|
2906 | Â fi |
---|
2907 | } |
---|
2908 | # end func_convert_path_check |
---|
2909 | |
---|
2910 | |
---|
2911 | # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG |
---|
2912 | # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT |
---|
2913 | # and appending REPL if ORIG matches BACKPAT. |
---|
2914 | func_convert_path_front_back_pathsep () |
---|
2915 | { |
---|
2916 | Â $debug_cmd |
---|
2917 | |
---|
2918 |  case $4 in |
---|
2919 | Â $1Â )Â func_to_host_path_result=$3$func_to_host_path_result |
---|
2920 | Â Â ;; |
---|
2921 | Â esac |
---|
2922 |  case $4 in |
---|
2923 | Â $2Â )Â func_append func_to_host_path_result "$3" |
---|
2924 | Â Â ;; |
---|
2925 | Â esac |
---|
2926 | } |
---|
2927 | # end func_convert_path_front_back_pathsep |
---|
2928 | |
---|
2929 | |
---|
2930 | ################################################## |
---|
2931 | # $build to $host FILE NAME CONVERSION FUNCTIONS # |
---|
2932 | ################################################## |
---|
2933 | # invoked via '$to_host_file_cmd ARG' |
---|
2934 | # |
---|
2935 | # In each case, ARG is the path to be converted from $build to $host format. |
---|
2936 | # Result will be available in $func_to_host_file_result. |
---|
2937 | |
---|
2938 | |
---|
2939 | # func_to_host_file ARG |
---|
2940 | # Converts the file name ARG from $build format to $host format. Return result |
---|
2941 | # in func_to_host_file_result. |
---|
2942 | func_to_host_file () |
---|
2943 | { |
---|
2944 | Â $debug_cmd |
---|
2945 | |
---|
2946 |  $to_host_file_cmd "$1" |
---|
2947 | } |
---|
2948 | # end func_to_host_file |
---|
2949 | |
---|
2950 | |
---|
2951 | # func_to_tool_file ARG LAZY |
---|
2952 | # converts the file name ARG from $build format to toolchain format. Return |
---|
2953 | # result in func_to_tool_file_result. If the conversion in use is listed |
---|
2954 | # in (the comma separated) LAZY, no conversion takes place. |
---|
2955 | func_to_tool_file () |
---|
2956 | { |
---|
2957 | Â $debug_cmd |
---|
2958 | |
---|
2959 |  case ,$2, in |
---|
2960 | Â Â *,"$to_tool_file_cmd",*) |
---|
2961 | Â Â Â func_to_tool_file_result=$1 |
---|
2962 | Â Â Â ;; |
---|
2963 | Â Â *) |
---|
2964 |    $to_tool_file_cmd "$1" |
---|
2965 | Â Â Â func_to_tool_file_result=$func_to_host_file_result |
---|
2966 | Â Â Â ;; |
---|
2967 | Â esac |
---|
2968 | } |
---|
2969 | # end func_to_tool_file |
---|
2970 | |
---|
2971 | |
---|
2972 | # func_convert_file_noop ARG |
---|
2973 | # Copy ARG to func_to_host_file_result. |
---|
2974 | func_convert_file_noop () |
---|
2975 | { |
---|
2976 | Â func_to_host_file_result=$1 |
---|
2977 | } |
---|
2978 | # end func_convert_file_noop |
---|
2979 | |
---|
2980 | |
---|
2981 | # func_convert_file_msys_to_w32 ARG |
---|
2982 | # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic |
---|
2983 | # conversion to w32 is not available inside the cwrapper. Returns result in |
---|
2984 | # func_to_host_file_result. |
---|
2985 | func_convert_file_msys_to_w32 () |
---|
2986 | { |
---|
2987 | Â $debug_cmd |
---|
2988 | |
---|
2989 | Â func_to_host_file_result=$1 |
---|
2990 |  if test -n "$1"; then |
---|
2991 | Â Â func_convert_core_msys_to_w32 "$1" |
---|
2992 | Â Â func_to_host_file_result=$func_convert_core_msys_to_w32_result |
---|
2993 | Â fi |
---|
2994 | Â func_convert_file_check "$1"Â "$func_to_host_file_result" |
---|
2995 | } |
---|
2996 | # end func_convert_file_msys_to_w32 |
---|
2997 | |
---|
2998 | |
---|
2999 | # func_convert_file_cygwin_to_w32 ARG |
---|
3000 | # Convert file name ARG from Cygwin to w32 format. Returns result in |
---|
3001 | # func_to_host_file_result. |
---|
3002 | func_convert_file_cygwin_to_w32 () |
---|
3003 | { |
---|
3004 | Â $debug_cmd |
---|
3005 | |
---|
3006 | Â func_to_host_file_result=$1 |
---|
3007 |  if test -n "$1"; then |
---|
3008 | Â Â # because $build is cygwin, we call "the" cygpath in $PATH; no need to use |
---|
3009 | Â Â # LT_CYGPATH in this case. |
---|
3010 | Â Â func_to_host_file_result=`cygpath -m "$1"` |
---|
3011 | Â fi |
---|
3012 | Â func_convert_file_check "$1"Â "$func_to_host_file_result" |
---|
3013 | } |
---|
3014 | # end func_convert_file_cygwin_to_w32 |
---|
3015 | |
---|
3016 | |
---|
3017 | # func_convert_file_nix_to_w32 ARG |
---|
3018 | # Convert file name ARG from *nix to w32 format. Requires a wine environment |
---|
3019 | # and a working winepath. Returns result in func_to_host_file_result. |
---|
3020 | func_convert_file_nix_to_w32 () |
---|
3021 | { |
---|
3022 | Â $debug_cmd |
---|
3023 | |
---|
3024 | Â func_to_host_file_result=$1 |
---|
3025 |  if test -n "$1"; then |
---|
3026 | Â Â func_convert_core_file_wine_to_w32 "$1" |
---|
3027 | Â Â func_to_host_file_result=$func_convert_core_file_wine_to_w32_result |
---|
3028 | Â fi |
---|
3029 | Â func_convert_file_check "$1"Â "$func_to_host_file_result" |
---|
3030 | } |
---|
3031 | # end func_convert_file_nix_to_w32 |
---|
3032 | |
---|
3033 | |
---|
3034 | # func_convert_file_msys_to_cygwin ARG |
---|
3035 | # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. |
---|
3036 | # Returns result in func_to_host_file_result. |
---|
3037 | func_convert_file_msys_to_cygwin () |
---|
3038 | { |
---|
3039 | Â $debug_cmd |
---|
3040 | |
---|
3041 | Â func_to_host_file_result=$1 |
---|
3042 |  if test -n "$1"; then |
---|
3043 | Â Â func_convert_core_msys_to_w32 "$1" |
---|
3044 | Â Â func_cygpath -u "$func_convert_core_msys_to_w32_result" |
---|
3045 | Â Â func_to_host_file_result=$func_cygpath_result |
---|
3046 | Â fi |
---|
3047 | Â func_convert_file_check "$1"Â "$func_to_host_file_result" |
---|
3048 | } |
---|
3049 | # end func_convert_file_msys_to_cygwin |
---|
3050 | |
---|
3051 | |
---|
3052 | # func_convert_file_nix_to_cygwin ARG |
---|
3053 | # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed |
---|
3054 | # in a wine environment, working winepath, and LT_CYGPATH set. Returns result |
---|
3055 | # in func_to_host_file_result. |
---|
3056 | func_convert_file_nix_to_cygwin () |
---|
3057 | { |
---|
3058 | Â $debug_cmd |
---|
3059 | |
---|
3060 | Â func_to_host_file_result=$1 |
---|
3061 |  if test -n "$1"; then |
---|
3062 | Â Â # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. |
---|
3063 | Â Â func_convert_core_file_wine_to_w32 "$1" |
---|
3064 | Â Â func_cygpath -u "$func_convert_core_file_wine_to_w32_result" |
---|
3065 | Â Â func_to_host_file_result=$func_cygpath_result |
---|
3066 | Â fi |
---|
3067 | Â func_convert_file_check "$1"Â "$func_to_host_file_result" |
---|
3068 | } |
---|
3069 | # end func_convert_file_nix_to_cygwin |
---|
3070 | |
---|
3071 | |
---|
3072 | ############################################# |
---|
3073 | # $build to $host PATH CONVERSION FUNCTIONS # |
---|
3074 | ############################################# |
---|
3075 | # invoked via '$to_host_path_cmd ARG' |
---|
3076 | # |
---|
3077 | # In each case, ARG is the path to be converted from $build to $host format. |
---|
3078 | # The result will be available in $func_to_host_path_result. |
---|
3079 | # |
---|
3080 | # Path separators are also converted from $build format to $host format. If |
---|
3081 | # ARG begins or ends with a path separator character, it is preserved (but |
---|
3082 | # converted to $host format) on output. |
---|
3083 | # |
---|
3084 | # All path conversion functions are named using the following convention: |
---|
3085 | #  file name conversion function  : func_convert_file_X_to_Y () |
---|
3086 | #  path conversion function     : func_convert_path_X_to_Y () |
---|
3087 | # where, for any given $build/$host combination the 'X_to_Y' value is the |
---|
3088 | # same. If conversion functions are added for new $build/$host combinations, |
---|
3089 | # the two new functions must follow this pattern, or func_init_to_host_path_cmd |
---|
3090 | # will break. |
---|
3091 | |
---|
3092 | |
---|
3093 | # func_init_to_host_path_cmd |
---|
3094 | # Ensures that function "pointer" variable $to_host_path_cmd is set to the |
---|
3095 | # appropriate value, based on the value of $to_host_file_cmd. |
---|
3096 | to_host_path_cmd= |
---|
3097 | func_init_to_host_path_cmd () |
---|
3098 | { |
---|
3099 | Â $debug_cmd |
---|
3100 | |
---|
3101 |  if test -z "$to_host_path_cmd"; then |
---|
3102 | Â Â func_stripname 'func_convert_file_'Â ''Â "$to_host_file_cmd" |
---|
3103 | Â Â to_host_path_cmd=func_convert_path_$func_stripname_result |
---|
3104 | Â fi |
---|
3105 | } |
---|
3106 | |
---|
3107 | |
---|
3108 | # func_to_host_path ARG |
---|
3109 | # Converts the path ARG from $build format to $host format. Return result |
---|
3110 | # in func_to_host_path_result. |
---|
3111 | func_to_host_path () |
---|
3112 | { |
---|
3113 | Â $debug_cmd |
---|
3114 | |
---|
3115 | Â func_init_to_host_path_cmd |
---|
3116 |  $to_host_path_cmd "$1" |
---|
3117 | } |
---|
3118 | # end func_to_host_path |
---|
3119 | |
---|
3120 | |
---|
3121 | # func_convert_path_noop ARG |
---|
3122 | # Copy ARG to func_to_host_path_result. |
---|
3123 | func_convert_path_noop () |
---|
3124 | { |
---|
3125 | Â func_to_host_path_result=$1 |
---|
3126 | } |
---|
3127 | # end func_convert_path_noop |
---|
3128 | |
---|
3129 | |
---|
3130 | # func_convert_path_msys_to_w32 ARG |
---|
3131 | # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic |
---|
3132 | # conversion to w32 is not available inside the cwrapper. Returns result in |
---|
3133 | # func_to_host_path_result. |
---|
3134 | func_convert_path_msys_to_w32 () |
---|
3135 | { |
---|
3136 | Â $debug_cmd |
---|
3137 | |
---|
3138 | Â func_to_host_path_result=$1 |
---|
3139 |  if test -n "$1"; then |
---|
3140 |   # Remove leading and trailing path separator characters from ARG. MSYS |
---|
3141 | Â Â # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; |
---|
3142 | Â Â # and winepath ignores them completely. |
---|
3143 | Â Â func_stripname : : "$1" |
---|
3144 | Â Â func_to_host_path_tmp1=$func_stripname_result |
---|
3145 | Â Â func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" |
---|
3146 | Â Â func_to_host_path_result=$func_convert_core_msys_to_w32_result |
---|
3147 | Â Â func_convert_path_check : ";"Â \ |
---|
3148 | Â Â Â "$func_to_host_path_tmp1"Â "$func_to_host_path_result" |
---|
3149 | Â Â func_convert_path_front_back_pathsep ":*"Â "*:"Â ";"Â "$1" |
---|
3150 | Â fi |
---|
3151 | } |
---|
3152 | # end func_convert_path_msys_to_w32 |
---|
3153 | |
---|
3154 | |
---|
3155 | # func_convert_path_cygwin_to_w32 ARG |
---|
3156 | # Convert path ARG from Cygwin to w32 format. Returns result in |
---|
3157 | # func_to_host_file_result. |
---|
3158 | func_convert_path_cygwin_to_w32 () |
---|
3159 | { |
---|
3160 | Â $debug_cmd |
---|
3161 | |
---|
3162 | Â func_to_host_path_result=$1 |
---|
3163 |  if test -n "$1"; then |
---|
3164 | Â Â # See func_convert_path_msys_to_w32: |
---|
3165 | Â Â func_stripname : : "$1" |
---|
3166 | Â Â func_to_host_path_tmp1=$func_stripname_result |
---|
3167 | Â Â func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` |
---|
3168 | Â Â func_convert_path_check : ";"Â \ |
---|
3169 | Â Â Â "$func_to_host_path_tmp1"Â "$func_to_host_path_result" |
---|
3170 | Â Â func_convert_path_front_back_pathsep ":*"Â "*:"Â ";"Â "$1" |
---|
3171 | Â fi |
---|
3172 | } |
---|
3173 | # end func_convert_path_cygwin_to_w32 |
---|
3174 | |
---|
3175 | |
---|
3176 | # func_convert_path_nix_to_w32 ARG |
---|
3177 | # Convert path ARG from *nix to w32 format. Requires a wine environment and |
---|
3178 | # a working winepath. Returns result in func_to_host_file_result. |
---|
3179 | func_convert_path_nix_to_w32 () |
---|
3180 | { |
---|
3181 | Â $debug_cmd |
---|
3182 | |
---|
3183 | Â func_to_host_path_result=$1 |
---|
3184 |  if test -n "$1"; then |
---|
3185 | Â Â # See func_convert_path_msys_to_w32: |
---|
3186 | Â Â func_stripname : : "$1" |
---|
3187 | Â Â func_to_host_path_tmp1=$func_stripname_result |
---|
3188 | Â Â func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" |
---|
3189 | Â Â func_to_host_path_result=$func_convert_core_path_wine_to_w32_result |
---|
3190 | Â Â func_convert_path_check : ";"Â \ |
---|
3191 | Â Â Â "$func_to_host_path_tmp1"Â "$func_to_host_path_result" |
---|
3192 | Â Â func_convert_path_front_back_pathsep ":*"Â "*:"Â ";"Â "$1" |
---|
3193 | Â fi |
---|
3194 | } |
---|
3195 | # end func_convert_path_nix_to_w32 |
---|
3196 | |
---|
3197 | |
---|
3198 | # func_convert_path_msys_to_cygwin ARG |
---|
3199 | # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. |
---|
3200 | # Returns result in func_to_host_file_result. |
---|
3201 | func_convert_path_msys_to_cygwin () |
---|
3202 | { |
---|
3203 | Â $debug_cmd |
---|
3204 | |
---|
3205 | Â func_to_host_path_result=$1 |
---|
3206 |  if test -n "$1"; then |
---|
3207 | Â Â # See func_convert_path_msys_to_w32: |
---|
3208 | Â Â func_stripname : : "$1" |
---|
3209 | Â Â func_to_host_path_tmp1=$func_stripname_result |
---|
3210 | Â Â func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" |
---|
3211 | Â Â func_cygpath -u -p "$func_convert_core_msys_to_w32_result" |
---|
3212 | Â Â func_to_host_path_result=$func_cygpath_result |
---|
3213 | Â Â func_convert_path_check : : \ |
---|
3214 | Â Â Â "$func_to_host_path_tmp1"Â "$func_to_host_path_result" |
---|
3215 | Â Â func_convert_path_front_back_pathsep ":*"Â "*:"Â : "$1" |
---|
3216 | Â fi |
---|
3217 | } |
---|
3218 | # end func_convert_path_msys_to_cygwin |
---|
3219 | |
---|
3220 | |
---|
3221 | # func_convert_path_nix_to_cygwin ARG |
---|
3222 | # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a |
---|
3223 | # a wine environment, working winepath, and LT_CYGPATH set. Returns result in |
---|
3224 | # func_to_host_file_result. |
---|
3225 | func_convert_path_nix_to_cygwin () |
---|
3226 | { |
---|
3227 | Â $debug_cmd |
---|
3228 | |
---|
3229 | Â func_to_host_path_result=$1 |
---|
3230 |  if test -n "$1"; then |
---|
3231 | Â Â # Remove leading and trailing path separator characters from |
---|
3232 | Â Â # ARG. msys behavior is inconsistent here, cygpath turns them |
---|
3233 | Â Â # into '.;' and ';.', and winepath ignores them completely. |
---|
3234 | Â Â func_stripname : : "$1" |
---|
3235 | Â Â func_to_host_path_tmp1=$func_stripname_result |
---|
3236 | Â Â func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" |
---|
3237 | Â Â func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" |
---|
3238 | Â Â func_to_host_path_result=$func_cygpath_result |
---|
3239 | Â Â func_convert_path_check : : \ |
---|
3240 | Â Â Â "$func_to_host_path_tmp1"Â "$func_to_host_path_result" |
---|
3241 | Â Â func_convert_path_front_back_pathsep ":*"Â "*:"Â : "$1" |
---|
3242 | Â fi |
---|
3243 | } |
---|
3244 | # end func_convert_path_nix_to_cygwin |
---|
3245 | |
---|
3246 | |
---|
3247 | # func_dll_def_p FILE |
---|
3248 | # True iff FILE is a Windows DLL '.def' file. |
---|
3249 | # Keep in sync with _LT_DLL_DEF_P in libtool.m4 |
---|
3250 | func_dll_def_p () |
---|
3251 | { |
---|
3252 | Â $debug_cmd |
---|
3253 | |
---|
3254 | Â func_dll_def_p_tmp=`$SEDÂ -n \ |
---|
3255 | Â Â -e 's/^[Â Â Â ]*//'Â \ |
---|
3256 | Â Â -e '/^\(;.*\)*$/d'Â \ |
---|
3257 | Â Â -e 's/^\(EXPORTS\|LIBRARY\)\([Â Â Â Â ].*\)*$/DEF/p'Â \ |
---|
3258 | Â Â -e q \ |
---|
3259 | Â Â "$1"` |
---|
3260 | Â test DEFÂ =Â "$func_dll_def_p_tmp" |
---|
3261 | } |
---|
3262 | |
---|
3263 | |
---|
3264 | # func_mode_compile arg... |
---|
3265 | func_mode_compile () |
---|
3266 | { |
---|
3267 | Â Â $debug_cmd |
---|
3268 | |
---|
3269 | Â Â # Get the compilation command and the source file. |
---|
3270 | Â Â base_compile= |
---|
3271 |   srcfile=$nonopt # always keep a non-empty value in "srcfile" |
---|
3272 | Â Â suppress_opt=yes |
---|
3273 | Â Â suppress_output= |
---|
3274 | Â Â arg_mode=normal |
---|
3275 | Â Â libobj= |
---|
3276 | Â Â later= |
---|
3277 | Â Â pie_flag= |
---|
3278 | |
---|
3279 | Â Â for arg |
---|
3280 | Â Â do |
---|
3281 |    case $arg_mode in |
---|
3282 |    arg ) |
---|
3283 |     # do not "continue". Instead, add this to base_compile |
---|
3284 | Â Â Â Â lastarg=$arg |
---|
3285 | Â Â Â Â arg_mode=normal |
---|
3286 | Â Â Â Â ;; |
---|
3287 | |
---|
3288 | Â Â Â target ) |
---|
3289 | Â Â Â Â libobj=$arg |
---|
3290 | Â Â Â Â arg_mode=normal |
---|
3291 | Â Â Â Â continue |
---|
3292 | Â Â Â Â ;; |
---|
3293 | |
---|
3294 | Â Â Â normal ) |
---|
3295 | Â Â Â Â # Accept any command-line options. |
---|
3296 |     case $arg in |
---|
3297 | Â Â Â Â -o) |
---|
3298 |      test -n "$libobj" && \ |
---|
3299 | Â Â Â Â Â Â func_fatal_error "you cannot specify '-o' more than once" |
---|
3300 | Â Â Â Â Â arg_mode=target |
---|
3301 | Â Â Â Â Â continue |
---|
3302 | Â Â Â Â Â ;; |
---|
3303 | |
---|
3304 | Â Â Â Â -pie | -fpie | -fPIE) |
---|
3305 | Â Â Â Â Â func_append pie_flag " $arg" |
---|
3306 | Â Â Â Â Â continue |
---|
3307 | Â Â Â Â Â ;; |
---|
3308 | |
---|
3309 | Â Â Â Â -shared | -static | -prefer-pic | -prefer-non-pic) |
---|
3310 | Â Â Â Â Â func_append later " $arg" |
---|
3311 | Â Â Â Â Â continue |
---|
3312 | Â Â Â Â Â ;; |
---|
3313 | |
---|
3314 | Â Â Â Â -no-suppress) |
---|
3315 | Â Â Â Â Â suppress_opt=no |
---|
3316 | Â Â Â Â Â continue |
---|
3317 | Â Â Â Â Â ;; |
---|
3318 | |
---|
3319 | Â Â Â Â -Xcompiler) |
---|
3320 |      arg_mode=arg # the next one goes into the "base_compile" arg list |
---|
3321 |      continue   # The current "srcfile" will either be retained or |
---|
3322 |      ;;      # replaced later. I would guess that would be a bug. |
---|
3323 | |
---|
3324 | Â Â Â Â -Wc,*) |
---|
3325 | Â Â Â Â Â func_stripname '-Wc,'Â ''Â "$arg" |
---|
3326 | Â Â Â Â Â args=$func_stripname_result |
---|
3327 | Â Â Â Â Â lastarg= |
---|
3328 | Â Â Â Â Â save_ifs=$IFS; IFS=, |
---|
3329 | Â Â Â Â Â for arg in $args; do |
---|
3330 | Â Â Â Â Â Â IFS=$save_ifs |
---|
3331 | Â Â Â Â Â Â func_append_quoted lastarg "$arg" |
---|
3332 | Â Â Â Â Â done |
---|
3333 | Â Â Â Â Â IFS=$save_ifs |
---|
3334 | Â Â Â Â Â func_stripname ' 'Â ''Â "$lastarg" |
---|
3335 | Â Â Â Â Â lastarg=$func_stripname_result |
---|
3336 | |
---|
3337 | Â Â Â Â Â # Add the arguments to base_compile. |
---|
3338 | Â Â Â Â Â func_append base_compile " $lastarg" |
---|
3339 | Â Â Â Â Â continue |
---|
3340 | Â Â Â Â Â ;; |
---|
3341 | |
---|
3342 | Â Â Â Â *) |
---|
3343 | Â Â Â Â Â # Accept the current argument as the source file. |
---|
3344 | Â Â Â Â Â # The previous "srcfile" becomes the current argument. |
---|
3345 | Â Â Â Â Â # |
---|
3346 | Â Â Â Â Â lastarg=$srcfile |
---|
3347 | Â Â Â Â Â srcfile=$arg |
---|
3348 | Â Â Â Â Â ;; |
---|
3349 |     esac # case $arg |
---|
3350 | Â Â Â Â ;; |
---|
3351 |    esac  # case $arg_mode |
---|
3352 | |
---|
3353 | Â Â Â # Aesthetically quote the previous argument. |
---|
3354 | Â Â Â func_append_quoted base_compile "$lastarg" |
---|
3355 |   done # for arg |
---|
3356 | |
---|
3357 |   case $arg_mode in |
---|
3358 | Â Â arg) |
---|
3359 | Â Â Â func_fatal_error "you must specify an argument for -Xcompile" |
---|
3360 | Â Â Â ;; |
---|
3361 | Â Â target) |
---|
3362 | Â Â Â func_fatal_error "you must specify a target with '-o'" |
---|
3363 | Â Â Â ;; |
---|
3364 | Â Â *) |
---|
3365 | Â Â Â # Get the name of the library object. |
---|
3366 |    test -z "$libobj" && { |
---|
3367 | Â Â Â Â func_basename "$srcfile" |
---|
3368 | Â Â Â Â libobj=$func_basename_result |
---|
3369 | Â Â Â } |
---|
3370 | Â Â Â ;; |
---|
3371 | Â Â esac |
---|
3372 | |
---|
3373 | Â Â # Recognize several different file suffixes. |
---|
3374 | Â Â # If the user specifies -o file.o, it is replaced with file.lo |
---|
3375 |   case $libobj in |
---|
3376 | Â Â *.[cCFSifmso]Â | \ |
---|
3377 | Â Â *.ada | *.adb | *.ads | *.asm | \ |
---|
3378 | Â Â *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ |
---|
3379 | Â Â *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup) |
---|
3380 | Â Â Â func_xform "$libobj" |
---|
3381 | Â Â Â libobj=$func_xform_result |
---|
3382 | Â Â Â ;; |
---|
3383 | Â Â esac |
---|
3384 | |
---|
3385 |   case $libobj in |
---|
3386 |   *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; |
---|
3387 | Â Â *) |
---|
3388 | Â Â Â func_fatal_error "cannot determine name of library object from '$libobj'" |
---|
3389 | Â Â Â ;; |
---|
3390 | Â Â esac |
---|
3391 | |
---|
3392 | Â Â func_infer_tag $base_compile |
---|
3393 | |
---|
3394 | Â Â for arg in $later; do |
---|
3395 |    case $arg in |
---|
3396 | Â Â Â -shared) |
---|
3397 |     test yes = "$build_libtool_libs" \ |
---|
3398 | Â Â Â Â Â ||Â func_fatal_configuration "cannot build a shared library" |
---|
3399 | Â Â Â Â build_old_libs=no |
---|
3400 | Â Â Â Â continue |
---|
3401 | Â Â Â Â ;; |
---|
3402 | |
---|
3403 | Â Â Â -static) |
---|
3404 | Â Â Â Â build_libtool_libs=no |
---|
3405 | Â Â Â Â build_old_libs=yes |
---|
3406 | Â Â Â Â continue |
---|
3407 | Â Â Â Â ;; |
---|
3408 | |
---|
3409 | Â Â Â -prefer-pic) |
---|
3410 | Â Â Â Â pic_mode=yes |
---|
3411 | Â Â Â Â continue |
---|
3412 | Â Â Â Â ;; |
---|
3413 | |
---|
3414 | Â Â Â -prefer-non-pic) |
---|
3415 | Â Â Â Â pic_mode=no |
---|
3416 | Â Â Â Â continue |
---|
3417 | Â Â Â Â ;; |
---|
3418 | Â Â Â esac |
---|
3419 | Â Â done |
---|
3420 | |
---|
3421 | Â Â func_quote_for_eval "$libobj" |
---|
3422 |   test "X$libobj" != "X$func_quote_for_eval_result" \ |
---|
3423 | Â Â Â &&Â $ECHOÂ "X$libobj"Â | $GREPÂ '[]~#^*{};<>?"'"'"'Â Â &()|`$[]'Â \ |
---|
3424 | Â Â Â &&Â func_warning "libobj name '$libobj' may not contain shell special characters." |
---|
3425 | Â Â func_dirname_and_basename "$obj"Â "/"Â "" |
---|
3426 | Â Â objname=$func_basename_result |
---|
3427 | Â Â xdir=$func_dirname_result |
---|
3428 | Â Â lobj=$xdir$objdir/$objname |
---|
3429 | |
---|
3430 |   test -z "$base_compile" && \ |
---|
3431 | Â Â Â func_fatal_help "you must specify a compilation command" |
---|
3432 | |
---|
3433 | Â Â # Delete any leftover library objects. |
---|
3434 |   if test yes = "$build_old_libs"; then |
---|
3435 | Â Â Â removelist="$obj $lobj $libobj ${libobj}T" |
---|
3436 | Â Â else |
---|
3437 | Â Â Â removelist="$lobj $libobj ${libobj}T" |
---|
3438 | Â Â fi |
---|
3439 | |
---|
3440 | Â Â # On Cygwin there's no "real" PIC flag so we must build both object types |
---|
3441 |   case $host_os in |
---|
3442 | Â Â cygwin* | mingw* | pw32* | os2* | cegcc*) |
---|
3443 | Â Â Â pic_mode=default |
---|
3444 | Â Â Â ;; |
---|
3445 | Â Â esac |
---|
3446 |   if test no = "$pic_mode" && test pass_all != "$deplibs_check_method"; then |
---|
3447 | Â Â Â # non-PIC code in shared libraries is not supported |
---|
3448 | Â Â Â pic_mode=default |
---|
3449 | Â Â fi |
---|
3450 | |
---|
3451 | Â Â # Calculate the filename of the output object if compiler does |
---|
3452 | Â Â # not support -o with -c |
---|
3453 |   if test no = "$compiler_c_o"; then |
---|
3454 | Â Â Â output_obj=`$ECHOÂ "$srcfile"Â | $SEDÂ 's%^.*/%%; s%\.[^.]*$%%'`.$objext |
---|
3455 | Â Â Â lockfile=$output_obj.lock |
---|
3456 | Â Â else |
---|
3457 | Â Â Â output_obj= |
---|
3458 | Â Â Â need_locks=no |
---|
3459 | Â Â Â lockfile= |
---|
3460 | Â Â fi |
---|
3461 | |
---|
3462 | Â Â # Lock this critical section if it is needed |
---|
3463 | Â Â # We use this script file to make the link, it avoids creating a new file |
---|
3464 |   if test yes = "$need_locks"; then |
---|
3465 |    until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do |
---|
3466 | Â Â Â Â func_echo "Waiting for $lockfile to be removed" |
---|
3467 | Â Â Â Â sleep 2 |
---|
3468 | Â Â Â done |
---|
3469 |   elif test warn = "$need_locks"; then |
---|
3470 |    if test -f "$lockfile"; then |
---|
3471 | Â Â Â Â $ECHOÂ "\ |
---|
3472 | *** ERROR, $lockfile exists and contains: |
---|
3473 | `cat $lockfile 2>/dev/null` |
---|
3474 | |
---|
3475 | This indicates that another process is trying to use the same |
---|
3476 | temporary object file, and libtool could not work around it because |
---|
3477 | your compiler does not support '-c' and '-o' together. If you |
---|
3478 | repeat this compilation, it may succeed, by chance, but you had better |
---|
3479 | avoid parallel builds (make -j) in this platform, or get a better |
---|
3480 | compiler." |
---|
3481 | |
---|
3482 |     $opt_dry_run || $RM $removelist |
---|
3483 |     exit $EXIT_FAILURE |
---|
3484 | Â Â Â fi |
---|
3485 | Â Â Â func_append removelist " $output_obj" |
---|
3486 | Â Â Â $ECHOÂ "$srcfile"Â > "$lockfile" |
---|
3487 | Â Â fi |
---|
3488 | |
---|
3489 |   $opt_dry_run || $RM $removelist |
---|
3490 | Â Â func_append removelist " $lockfile" |
---|
3491 |   trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 |
---|
3492 | |
---|
3493 | Â Â func_to_tool_file "$srcfile"Â func_convert_file_msys_to_w32 |
---|
3494 | Â Â srcfile=$func_to_tool_file_result |
---|
3495 | Â Â func_quote_for_eval "$srcfile" |
---|
3496 | Â Â qsrcfile=$func_quote_for_eval_result |
---|
3497 | |
---|
3498 | Â Â # Only build a PIC object if we are building libtool libraries. |
---|
3499 |   if test yes = "$build_libtool_libs"; then |
---|
3500 | Â Â Â # Without this assignment, base_compile gets emptied. |
---|
3501 | Â Â Â fbsd_hideous_sh_bug=$base_compile |
---|
3502 | |
---|
3503 | Â Â Â if test no !=Â "$pic_mode"; then |
---|
3504 | Â Â Â Â command="$base_compile $qsrcfile $pic_flag" |
---|
3505 | Â Â Â else |
---|
3506 | Â Â Â Â # Don't build PIC code |
---|
3507 | Â Â Â Â command="$base_compile $qsrcfile" |
---|
3508 | Â Â Â fi |
---|
3509 | |
---|
3510 | Â Â Â func_mkdir_p "$xdir$objdir" |
---|
3511 | |
---|
3512 |    if test -z "$output_obj"; then |
---|
3513 | Â Â Â Â # Place PIC objects in $objdir |
---|
3514 |     func_append command " -o $lobj" |
---|
3515 | Â Â Â fi |
---|
3516 | |
---|
3517 | Â Â Â func_show_eval_locale "$command"Â \ |
---|
3518 | Â Â Â Â Â 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' |
---|
3519 | |
---|
3520 |    if test warn = "$need_locks" && |
---|
3521 |      test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then |
---|
3522 | Â Â Â Â $ECHOÂ "\ |
---|
3523 | *** ERROR, $lockfile contains: |
---|
3524 | `cat $lockfile 2>/dev/null` |
---|
3525 | |
---|
3526 | but it should contain: |
---|
3527 | $srcfile |
---|
3528 | |
---|
3529 | This indicates that another process is trying to use the same |
---|
3530 | temporary object file, and libtool could not work around it because |
---|
3531 | your compiler does not support '-c' and '-o' together. If you |
---|
3532 | repeat this compilation, it may succeed, by chance, but you had better |
---|
3533 | avoid parallel builds (make -j) in this platform, or get a better |
---|
3534 | compiler." |
---|
3535 | |
---|
3536 |     $opt_dry_run || $RM $removelist |
---|
3537 |     exit $EXIT_FAILURE |
---|
3538 | Â Â Â fi |
---|
3539 | |
---|
3540 | Â Â Â # Just move the object if needed, then go on to compile the next one |
---|
3541 |    if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then |
---|
3542 | Â Â Â Â func_show_eval '$MV "$output_obj" "$lobj"'Â \ |
---|
3543 | Â Â Â Â Â 'error=$?; $opt_dry_run || $RM $removelist; exit $error' |
---|
3544 | Â Â Â fi |
---|
3545 | |
---|
3546 | Â Â Â # Allow error messages only from the first compilation. |
---|
3547 |    if test yes = "$suppress_opt"; then |
---|
3548 | Â Â Â Â suppress_output=' >/dev/null 2>&1' |
---|
3549 | Â Â Â fi |
---|
3550 | Â Â fi |
---|
3551 | |
---|
3552 | Â Â # Only build a position-dependent object if we build old libraries. |
---|
3553 |   if test yes = "$build_old_libs"; then |
---|
3554 | Â Â Â if test yes !=Â "$pic_mode"; then |
---|
3555 | Â Â Â Â # Don't build PIC code |
---|
3556 | Â Â Â Â command="$base_compile $qsrcfile$pie_flag" |
---|
3557 | Â Â Â else |
---|
3558 | Â Â Â Â command="$base_compile $qsrcfile $pic_flag" |
---|
3559 | Â Â Â fi |
---|
3560 |    if test yes = "$compiler_c_o"; then |
---|
3561 |     func_append command " -o $obj" |
---|
3562 | Â Â Â fi |
---|
3563 | |
---|
3564 | Â Â Â # Suppress compiler output if we already did a PIC compilation. |
---|
3565 |    func_append command "$suppress_output" |
---|
3566 | Â Â Â func_show_eval_locale "$command"Â \ |
---|
3567 | Â Â Â Â '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' |
---|
3568 | |
---|
3569 |    if test warn = "$need_locks" && |
---|
3570 |      test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then |
---|
3571 | Â Â Â Â $ECHOÂ "\ |
---|
3572 | *** ERROR, $lockfile contains: |
---|
3573 | `cat $lockfile 2>/dev/null` |
---|
3574 | |
---|
3575 | but it should contain: |
---|
3576 | $srcfile |
---|
3577 | |
---|
3578 | This indicates that another process is trying to use the same |
---|
3579 | temporary object file, and libtool could not work around it because |
---|
3580 | your compiler does not support '-c' and '-o' together. If you |
---|
3581 | repeat this compilation, it may succeed, by chance, but you had better |
---|
3582 | avoid parallel builds (make -j) in this platform, or get a better |
---|
3583 | compiler." |
---|
3584 | |
---|
3585 |     $opt_dry_run || $RM $removelist |
---|
3586 |     exit $EXIT_FAILURE |
---|
3587 | Â Â Â fi |
---|
3588 | |
---|
3589 | Â Â Â # Just move the object if needed |
---|
3590 |    if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then |
---|
3591 | Â Â Â Â func_show_eval '$MV "$output_obj" "$obj"'Â \ |
---|
3592 | Â Â Â Â Â 'error=$?; $opt_dry_run || $RM $removelist; exit $error' |
---|
3593 | Â Â Â fi |
---|
3594 | Â Â fi |
---|
3595 | |
---|
3596 |   $opt_dry_run || { |
---|
3597 | Â Â Â func_write_libtool_object "$libobj"Â "$objdir/$objname"Â "$objname" |
---|
3598 | |
---|
3599 | Â Â Â # Unlock the critical section if it was locked |
---|
3600 | Â Â Â if test no !=Â "$need_locks"; then |
---|
3601 | Â Â Â Â removelist=$lockfile |
---|
3602 | Â Â Â Â $RMÂ "$lockfile" |
---|
3603 | Â Â Â fi |
---|
3604 | Â Â } |
---|
3605 | |
---|
3606 |   exit $EXIT_SUCCESS |
---|
3607 | } |
---|
3608 | |
---|
3609 | $opt_help || { |
---|
3610 |  test compile = "$opt_mode" && func_mode_compile ${1+"$@"} |
---|
3611 | } |
---|
3612 | |
---|
3613 | func_mode_help () |
---|
3614 | { |
---|
3615 | Â Â # We need to display help for each of the modes. |
---|
3616 |   case $opt_mode in |
---|
3617 | Â Â Â "") |
---|
3618 | Â Â Â Â # Generic help is extracted from the usage comments |
---|
3619 | Â Â Â Â # at the start of this file. |
---|
3620 | Â Â Â Â func_help |
---|
3621 | Â Â Â Â ;; |
---|
3622 | |
---|
3623 | Â Â Â clean) |
---|
3624 | Â Â Â Â $ECHOÂ \ |
---|
3625 | "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... |
---|
3626 | |
---|
3627 | Remove files from the build directory. |
---|
3628 | |
---|
3629 | RM is the name of the program to use to delete files associated with each FILE |
---|
3630 | (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed |
---|
3631 | to RM. |
---|
3632 | |
---|
3633 | If FILE is a libtool library, object or program, all the files associated |
---|
3634 | with it are deleted. Otherwise, only FILE itself is deleted using RM." |
---|
3635 | Â Â Â Â ;; |
---|
3636 | |
---|
3637 | Â Â Â compile) |
---|
3638 | Â Â Â $ECHOÂ \ |
---|
3639 | "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE |
---|
3640 | |
---|
3641 | Compile a source file into a libtool library object. |
---|
3642 | |
---|
3643 | This mode accepts the following additional options: |
---|
3644 | |
---|
3645 | Â -o OUTPUT-FILEÂ Â set the output file name to OUTPUT-FILE |
---|
3646 |  -no-suppress   do not suppress compiler output for multiple passes |
---|
3647 |  -prefer-pic    try to build PIC objects only |
---|
3648 |  -prefer-non-pic  try to build non-PIC objects only |
---|
3649 |  -shared      do not build a '.o' file suitable for static linking |
---|
3650 |  -static      only build a '.o' file suitable for static linking |
---|
3651 | Â -Wc,FLAGÂ Â Â Â Â pass FLAG directly to the compiler |
---|
3652 | |
---|
3653 | COMPILE-COMMAND is a command to be used in creating a 'standard' object file |
---|
3654 | from the given SOURCEFILE. |
---|
3655 | |
---|
3656 | The output file name is determined by removing the directory component from |
---|
3657 | SOURCEFILE, then substituting the C source code suffix '.c' with the |
---|
3658 | library object suffix, '.lo'." |
---|
3659 | Â Â Â Â ;; |
---|
3660 | |
---|
3661 | Â Â Â execute) |
---|
3662 | Â Â Â Â $ECHOÂ \ |
---|
3663 | "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... |
---|
3664 | |
---|
3665 | Automatically set library path, then run a program. |
---|
3666 | |
---|
3667 | This mode accepts the following additional options: |
---|
3668 | |
---|
3669 | Â -dlopen FILEÂ Â Â add the directory containing FILE to the library path |
---|
3670 | |
---|
3671 | This mode sets the library path environment variable according to '-dlopen' |
---|
3672 | flags. |
---|
3673 | |
---|
3674 | If any of the ARGS are libtool executable wrappers, then they are translated |
---|
3675 | into their corresponding uninstalled binary, and any of their required library |
---|
3676 | directories are added to the library path. |
---|
3677 | |
---|
3678 | Then, COMMAND is executed, with ARGS as arguments." |
---|
3679 | Â Â Â Â ;; |
---|
3680 | |
---|
3681 | Â Â Â finish) |
---|
3682 | Â Â Â Â $ECHOÂ \ |
---|
3683 | "Usage: $progname [OPTION]... --mode=finish [LIBDIR]... |
---|
3684 | |
---|
3685 | Complete the installation of libtool libraries. |
---|
3686 | |
---|
3687 | Each LIBDIR is a directory that contains libtool libraries. |
---|
3688 | |
---|
3689 | The commands that this mode executes may require superuser privileges. Use |
---|
3690 | the '--dry-run' option if you just want to see what would be executed." |
---|
3691 | Â Â Â Â ;; |
---|
3692 | |
---|
3693 | Â Â Â install) |
---|
3694 | Â Â Â Â $ECHOÂ \ |
---|
3695 | "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... |
---|
3696 | |
---|
3697 | Install executables or libraries. |
---|
3698 | |
---|
3699 | INSTALL-COMMAND is the installation command. The first component should be |
---|
3700 | either the 'install' or 'cp' program. |
---|
3701 | |
---|
3702 | The following components of INSTALL-COMMAND are treated specially: |
---|
3703 | |
---|
3704 | Â -inst-prefix-dir PREFIX-DIRÂ Use PREFIX-DIR as a staging area for installation |
---|
3705 | |
---|
3706 | The rest of the components are interpreted as arguments to that command (only |
---|
3707 | BSD-compatible install options are recognized)." |
---|
3708 | Â Â Â Â ;; |
---|
3709 | |
---|
3710 | Â Â Â link) |
---|
3711 | Â Â Â Â $ECHOÂ \ |
---|
3712 | "Usage: $progname [OPTION]... --mode=link LINK-COMMAND... |
---|
3713 | |
---|
3714 | Link object files or libraries together to form another library, or to |
---|
3715 | create an executable program. |
---|
3716 | |
---|
3717 | LINK-COMMAND is a command using the C compiler that you would use to create |
---|
3718 | a program from several object files. |
---|
3719 | |
---|
3720 | The following components of LINK-COMMAND are treated specially: |
---|
3721 | |
---|
3722 |  -all-static    do not do any dynamic linking at all |
---|
3723 |  -avoid-version  do not add a version suffix if possible |
---|
3724 | Â -bindir BINDIRÂ Â specify path to binaries directory (for systems where |
---|
3725 | Â Â Â Â Â Â Â Â Â Â libraries must be found in the PATH setting at runtime) |
---|
3726 | Â -dlopen FILEÂ Â Â '-dlpreopen' FILE if it cannot be dlopened at runtime |
---|
3727 | Â -dlpreopen FILEÂ Â link in FILE and add its symbols to lt_preloaded_symbols |
---|
3728 |  -export-dynamic  allow symbols from OUTPUT-FILE to be resolved with dlsym(3) |
---|
3729 | Â -export-symbols SYMFILE |
---|
3730 | Â Â Â Â Â Â Â Â Â Â try to export only the symbols listed in SYMFILE |
---|
3731 | Â -export-symbols-regex REGEX |
---|
3732 | Â Â Â Â Â Â Â Â Â Â try to export only the symbols matching REGEX |
---|
3733 | Â -LLIBDIRÂ Â Â Â Â search LIBDIR for required installed libraries |
---|
3734 | Â -lNAMEÂ Â Â Â Â Â OUTPUT-FILE requires the installed library libNAME |
---|
3735 |  -module      build a library that can dlopened |
---|
3736 |  -no-fast-install disable the fast-install mode |
---|
3737 |  -no-install    link a not-installable executable |
---|
3738 |  -no-undefined   declare that a library does not refer to external symbols |
---|
3739 | Â -o OUTPUT-FILEÂ Â create OUTPUT-FILE from the specified objects |
---|
3740 | Â -objectlist FILEÂ use a list of object files found in FILE to specify objects |
---|
3741 | Â -os2dllname NAMEÂ force a short DLL name on OS/2 (no effect on other OSes) |
---|
3742 | Â -precious-files-regex REGEX |
---|
3743 | Â Â Â Â Â Â Â Â Â Â don't remove output files matching REGEX |
---|
3744 | Â -release RELEASEÂ specify package release information |
---|
3745 | Â -rpath LIBDIRÂ Â Â the created library will eventually be installed in LIBDIR |
---|
3746 | Â -R[ ]LIBDIRÂ Â Â Â add LIBDIR to the runtime path of programs and libraries |
---|
3747 |  -shared      only do dynamic linking of libtool libraries |
---|
3748 | Â -shrext SUFFIXÂ Â override the standard shared library file extension |
---|
3749 |  -static      do not do any dynamic linking of uninstalled libtool libraries |
---|
3750 | Â -static-libtool-libs |
---|
3751 | Â Â Â Â Â Â Â Â Â Â do not do any dynamic linking of libtool libraries |
---|
3752 | Â -version-info CURRENT[:REVISION[:AGE]] |
---|
3753 | Â Â Â Â Â Â Â Â Â Â specify library version info [each variable defaults to 0] |
---|
3754 | Â -weak LIBNAMEÂ Â Â declare that the target provides the LIBNAME interface |
---|
3755 | Â -Wc,FLAG |
---|
3756 | Â -Xcompiler FLAGÂ Â pass linker-specific FLAG directly to the compiler |
---|
3757 | Â -Wl,FLAG |
---|
3758 | Â -Xlinker FLAGÂ Â Â pass linker-specific FLAG directly to the linker |
---|
3759 | Â -XCClinker FLAGÂ Â pass link-specific FLAG to the compiler driver (CC) |
---|
3760 | |
---|
3761 | All other options (arguments beginning with '-') are ignored. |
---|
3762 | |
---|
3763 | Every other argument is treated as a filename. Files ending in '.la' are |
---|
3764 | treated as uninstalled libtool libraries, other files are standard or library |
---|
3765 | object files. |
---|
3766 | |
---|
3767 | If the OUTPUT-FILE ends in '.la', then a libtool library is created, |
---|
3768 | only library objects ('.lo' files) may be specified, and '-rpath' is |
---|
3769 | required, except when creating a convenience library. |
---|
3770 | |
---|
3771 | If OUTPUT-FILE ends in '.a' or '.lib', then a standard library is created |
---|
3772 | using 'ar' and 'ranlib', or on Windows using 'lib'. |
---|
3773 | |
---|
3774 | If OUTPUT-FILE ends in '.lo' or '.$objext', then a reloadable object file |
---|
3775 | is created, otherwise an executable program is created." |
---|
3776 | Â Â Â Â ;; |
---|
3777 | |
---|
3778 | Â Â Â uninstall) |
---|
3779 | Â Â Â Â $ECHOÂ \ |
---|
3780 | "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... |
---|
3781 | |
---|
3782 | Remove libraries from an installation directory. |
---|
3783 | |
---|
3784 | RM is the name of the program to use to delete files associated with each FILE |
---|
3785 | (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed |
---|
3786 | to RM. |
---|
3787 | |
---|
3788 | If FILE is a libtool library, all the files associated with it are deleted. |
---|
3789 | Otherwise, only FILE itself is deleted using RM." |
---|
3790 | Â Â Â Â ;; |
---|
3791 | |
---|
3792 | Â Â Â *) |
---|
3793 | Â Â Â Â func_fatal_help "invalid operation mode '$opt_mode'" |
---|
3794 | Â Â Â Â ;; |
---|
3795 | Â Â esac |
---|
3796 | |
---|
3797 | Â Â echo |
---|
3798 | Â Â $ECHOÂ "Try '$progname --help' for more information about other modes." |
---|
3799 | } |
---|
3800 | |
---|
3801 | # Now that we've collected a possible --mode arg, show help if necessary |
---|
3802 | if $opt_help; then |
---|
3803 |  if test : = "$opt_help"; then |
---|
3804 | Â Â func_mode_help |
---|
3805 | Â else |
---|
3806 | Â Â { |
---|
3807 | Â Â Â func_help noexit |
---|
3808 | Â Â Â for opt_mode in compile link execute install finish uninstall clean; do |
---|
3809 | Â Â Â Â func_mode_help |
---|
3810 | Â Â Â done |
---|
3811 | Â Â }Â | $SEDÂ -n '1p; 2,$s/^Usage:/Â or: /p' |
---|
3812 | Â Â { |
---|
3813 | Â Â Â func_help noexit |
---|
3814 | Â Â Â for opt_mode in compile link execute install finish uninstall clean; do |
---|
3815 | Â Â Â Â echo |
---|
3816 | Â Â Â Â func_mode_help |
---|
3817 | Â Â Â done |
---|
3818 | Â Â }Â | |
---|
3819 | Â Â $SEDÂ '1d |
---|
3820 | Â Â Â /^When reporting/,/^Report/{ |
---|
3821 | Â Â Â Â H |
---|
3822 | Â Â Â Â d |
---|
3823 | Â Â Â } |
---|
3824 | Â Â Â $x |
---|
3825 | Â Â Â /information about other modes/d |
---|
3826 | Â Â Â /more detailed .*MODE/d |
---|
3827 | Â Â Â s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' |
---|
3828 | Â fi |
---|
3829 |  exit $? |
---|
3830 | fi |
---|
3831 | |
---|
3832 | |
---|
3833 | # func_mode_execute arg... |
---|
3834 | func_mode_execute () |
---|
3835 | { |
---|
3836 | Â Â $debug_cmd |
---|
3837 | |
---|
3838 | Â Â # The first argument is the command name. |
---|
3839 | Â Â cmd=$nonopt |
---|
3840 |   test -z "$cmd" && \ |
---|
3841 | Â Â Â func_fatal_help "you must specify a COMMAND" |
---|
3842 | |
---|
3843 | Â Â # Handle -dlopen flags immediately. |
---|
3844 | Â Â for file in $opt_dlopen; do |
---|
3845 |    test -f "$file" \ |
---|
3846 | Â Â Â Â ||Â func_fatal_help "'$file' is not a file" |
---|
3847 | |
---|
3848 | Â Â Â dir= |
---|
3849 |    case $file in |
---|
3850 | Â Â Â *.la) |
---|
3851 | Â Â Â Â func_resolve_sysroot "$file" |
---|
3852 | Â Â Â Â file=$func_resolve_sysroot_result |
---|
3853 | |
---|
3854 | Â Â Â Â # Check to see that this really is a libtool archive. |
---|
3855 | Â Â Â Â func_lalib_unsafe_p "$file"Â \ |
---|
3856 | Â Â Â Â Â ||Â func_fatal_help "'$lib' is not a valid libtool archive" |
---|
3857 | |
---|
3858 | Â Â Â Â # Read the libtool library. |
---|
3859 | Â Â Â Â dlname= |
---|
3860 | Â Â Â Â library_names= |
---|
3861 | Â Â Â Â func_source "$file" |
---|
3862 | |
---|
3863 | Â Â Â Â # Skip this library if it cannot be dlopened. |
---|
3864 |     if test -z "$dlname"; then |
---|
3865 | Â Â Â Â Â # Warn if it was a shared library. |
---|
3866 |      test -n "$library_names" && \ |
---|
3867 | Â Â Â Â Â Â func_warning "'$file' was not linked with '-export-dynamic'" |
---|
3868 | Â Â Â Â Â continue |
---|
3869 | Â Â Â Â fi |
---|
3870 | |
---|
3871 | Â Â Â Â func_dirname "$file"Â ""Â "." |
---|
3872 | Â Â Â Â dir=$func_dirname_result |
---|
3873 | |
---|
3874 |     if test -f "$dir/$objdir/$dlname"; then |
---|
3875 | Â Â Â Â Â func_append dir "/$objdir" |
---|
3876 | Â Â Â Â else |
---|
3877 |      if test ! -f "$dir/$dlname"; then |
---|
3878 | Â Â Â Â Â Â func_fatal_error "cannot find '$dlname' in '$dir' or '$dir/$objdir'" |
---|
3879 | Â Â Â Â Â fi |
---|
3880 | Â Â Â Â fi |
---|
3881 | Â Â Â Â ;; |
---|
3882 | |
---|
3883 | Â Â Â *.lo) |
---|
3884 | Â Â Â Â # Just add the directory containing the .lo file. |
---|
3885 | Â Â Â Â func_dirname "$file"Â ""Â "." |
---|
3886 | Â Â Â Â dir=$func_dirname_result |
---|
3887 | Â Â Â Â ;; |
---|
3888 | |
---|
3889 | Â Â Â *) |
---|
3890 | Â Â Â Â func_warning "'-dlopen' is ignored for non-libtool libraries and objects" |
---|
3891 | Â Â Â Â continue |
---|
3892 | Â Â Â Â ;; |
---|
3893 | Â Â Â esac |
---|
3894 | |
---|
3895 | Â Â Â # Get the absolute pathname. |
---|
3896 |    absdir=`cd "$dir" && pwd` |
---|
3897 |    test -n "$absdir" && dir=$absdir |
---|
3898 | |
---|
3899 | Â Â Â # Now add the directory to shlibpath_var. |
---|
3900 |    if eval "test -z \"\$$shlibpath_var\""; then |
---|
3901 |     eval "$shlibpath_var=\"\$dir\"" |
---|
3902 | Â Â Â else |
---|
3903 |     eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" |
---|
3904 | Â Â Â fi |
---|
3905 | Â Â done |
---|
3906 | |
---|
3907 | Â Â # This variable tells wrapper scripts just to set shlibpath_var |
---|
3908 | Â Â # rather than running their programs. |
---|
3909 | Â Â libtool_execute_magic=$magic |
---|
3910 | |
---|
3911 | Â Â # Check if any of the arguments is a wrapper script. |
---|
3912 | Â Â args= |
---|
3913 | Â Â for file |
---|
3914 | Â Â do |
---|
3915 |    case $file in |
---|
3916 | Â Â Â -* | *.la | *.lo )Â ;; |
---|
3917 | Â Â Â *) |
---|
3918 | Â Â Â Â # Do a test to see if this is really a libtool program. |
---|
3919 | Â Â Â Â if func_ltwrapper_script_p "$file"; then |
---|
3920 | Â Â Â Â Â func_source "$file" |
---|
3921 | Â Â Â Â Â # Transform arg to wrapped name. |
---|
3922 | Â Â Â Â Â file=$progdir/$program |
---|
3923 | Â Â Â Â elif func_ltwrapper_executable_p "$file"; then |
---|
3924 | Â Â Â Â Â func_ltwrapper_scriptname "$file" |
---|
3925 | Â Â Â Â Â func_source "$func_ltwrapper_scriptname_result" |
---|
3926 | Â Â Â Â Â # Transform arg to wrapped name. |
---|
3927 | Â Â Â Â Â file=$progdir/$program |
---|
3928 | Â Â Â Â fi |
---|
3929 | Â Â Â Â ;; |
---|
3930 | Â Â Â esac |
---|
3931 | Â Â Â # Quote arguments (to preserve shell metacharacters). |
---|
3932 | Â Â Â func_append_quoted args "$file" |
---|
3933 | Â Â done |
---|
3934 | |
---|
3935 |   if $opt_dry_run; then |
---|
3936 | Â Â Â # Display what would be done. |
---|
3937 |    if test -n "$shlibpath_var"; then |
---|
3938 |     eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" |
---|
3939 |     echo "export $shlibpath_var" |
---|
3940 | Â Â Â fi |
---|
3941 | Â Â Â $ECHOÂ "$cmd$args" |
---|
3942 |    exit $EXIT_SUCCESS |
---|
3943 | Â Â else |
---|
3944 |    if test -n "$shlibpath_var"; then |
---|
3945 | Â Â Â Â # Export the shlibpath_var. |
---|
3946 |     eval "export $shlibpath_var" |
---|
3947 | Â Â Â fi |
---|
3948 | |
---|
3949 | Â Â Â # Restore saved environment variables |
---|
3950 | Â Â Â for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES |
---|
3951 | Â Â Â do |
---|
3952 |     eval "if test \"\${save_$lt_var+set}\" = set; then |
---|
3953 | Â Â Â Â Â Â Â Â $lt_var=\$save_$lt_var; export $lt_var |
---|
3954 | Â Â Â Â Â Â Â else |
---|
3955 | Â Â Â Â Â Â Â Â $lt_unset $lt_var |
---|
3956 | Â Â Â Â Â Â Â fi" |
---|
3957 | Â Â Â done |
---|
3958 | |
---|
3959 | Â Â Â # Now prepare to actually exec the command. |
---|
3960 | Â Â Â exec_cmd=\$cmd$args |
---|
3961 | Â Â fi |
---|
3962 | } |
---|
3963 | |
---|
3964 | test execute = "$opt_mode" && func_mode_execute ${1+"$@"} |
---|
3965 | |
---|
3966 | |
---|
3967 | # func_mode_finish arg... |
---|
3968 | func_mode_finish () |
---|
3969 | { |
---|
3970 | Â Â $debug_cmd |
---|
3971 | |
---|
3972 | Â Â libs= |
---|
3973 | Â Â libdirs= |
---|
3974 | Â Â admincmds= |
---|
3975 | |
---|
3976 | Â Â for opt in "$nonopt"Â ${1+"$@"} |
---|
3977 | Â Â do |
---|
3978 |    if test -d "$opt"; then |
---|
3979 | Â Â Â Â func_append libdirs " $opt" |
---|
3980 | |
---|
3981 |    elif test -f "$opt"; then |
---|
3982 | Â Â Â Â if func_lalib_unsafe_p "$opt"; then |
---|
3983 | Â Â Â Â Â func_append libs " $opt" |
---|
3984 | Â Â Â Â else |
---|
3985 | Â Â Â Â Â func_warning "'$opt' is not a valid libtool archive" |
---|
3986 | Â Â Â Â fi |
---|
3987 | |
---|
3988 | Â Â Â else |
---|
3989 | Â Â Â Â func_fatal_error "invalid argument '$opt'" |
---|
3990 | Â Â Â fi |
---|
3991 | Â Â done |
---|
3992 | |
---|
3993 |   if test -n "$libs"; then |
---|
3994 |    if test -n "$lt_sysroot"; then |
---|
3995 | Â Â Â Â sysroot_regex=`$ECHOÂ "$lt_sysroot"Â | $SEDÂ "$sed_make_literal_regex"` |
---|
3996 | Â Â Â Â sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" |
---|
3997 | Â Â Â else |
---|
3998 | Â Â Â Â sysroot_cmd= |
---|
3999 | Â Â Â fi |
---|
4000 | |
---|
4001 | Â Â Â # Remove sysroot references |
---|
4002 |    if $opt_dry_run; then |
---|
4003 | Â Â Â Â for lib in $libs; do |
---|
4004 |      echo "removing references to $lt_sysroot and '=' prefixes from $lib" |
---|
4005 | Â Â Â Â done |
---|
4006 | Â Â Â else |
---|
4007 | Â Â Â Â tmpdir=`func_mktempdir` |
---|
4008 | Â Â Â Â for lib in $libs; do |
---|
4009 |      $SED -e "$sysroot_cmd s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ |
---|
4010 | Â Â Â Â Â Â > $tmpdir/tmp-la |
---|
4011 | Â Â Â Â Â mv -f $tmpdir/tmp-la $lib |
---|
4012 | Â Â Â Â done |
---|
4013 | Â Â Â Â ${RM}r "$tmpdir" |
---|
4014 | Â Â Â fi |
---|
4015 | Â Â fi |
---|
4016 | |
---|
4017 |   if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then |
---|
4018 | Â Â Â for libdir in $libdirs; do |
---|
4019 |     if test -n "$finish_cmds"; then |
---|
4020 | Â Â Â Â Â # Do each command in the finish commands. |
---|
4021 | Â Â Â Â Â func_execute_cmds "$finish_cmds"Â 'admincmds="$admincmds |
---|
4022 | '"$cmd"'"' |
---|
4023 | Â Â Â Â fi |
---|
4024 |     if test -n "$finish_eval"; then |
---|
4025 | Â Â Â Â Â # Do the single finish_eval. |
---|
4026 | Â Â Â Â Â eval cmds=\"$finish_eval\" |
---|
4027 |      $opt_dry_run || eval "$cmds" || func_append admincmds " |
---|
4028 | Â Â Â Â $cmds" |
---|
4029 | Â Â Â Â fi |
---|
4030 | Â Â Â done |
---|
4031 | Â Â fi |
---|
4032 | |
---|
4033 | Â Â # Exit here if they wanted silent mode. |
---|
4034 |   $opt_quiet && exit $EXIT_SUCCESS |
---|
4035 | |
---|
4036 |   if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then |
---|
4037 |    echo "----------------------------------------------------------------------" |
---|
4038 |    echo "Libraries have been installed in:" |
---|
4039 | Â Â Â for libdir in $libdirs; do |
---|
4040 | Â Â Â Â $ECHOÂ "Â Â $libdir" |
---|
4041 | Â Â Â done |
---|
4042 | Â Â Â echo |
---|
4043 |    echo "If you ever happen to want to link against installed libraries" |
---|
4044 |    echo "in a given directory, LIBDIR, you must either use libtool, and" |
---|
4045 |    echo "specify the full pathname of the library, or use the '-LLIBDIR'" |
---|
4046 |    echo "flag during linking and do at least one of the following:" |
---|
4047 |    if test -n "$shlibpath_var"; then |
---|
4048 |     echo "  - add LIBDIR to the '$shlibpath_var' environment variable" |
---|
4049 |     echo "   during execution" |
---|
4050 | Â Â Â fi |
---|
4051 |    if test -n "$runpath_var"; then |
---|
4052 |     echo "  - add LIBDIR to the '$runpath_var' environment variable" |
---|
4053 |     echo "   during linking" |
---|
4054 | Â Â Â fi |
---|
4055 |    if test -n "$hardcode_libdir_flag_spec"; then |
---|
4056 | Â Â Â Â libdir=LIBDIR |
---|
4057 | Â Â Â Â eval flag=\"$hardcode_libdir_flag_spec\" |
---|
4058 | |
---|
4059 | Â Â Â Â $ECHOÂ "Â Â - use the '$flag' linker flag" |
---|
4060 | Â Â Â fi |
---|
4061 |    if test -n "$admincmds"; then |
---|
4062 | Â Â Â Â $ECHOÂ "Â Â - have your system administrator run these commands:$admincmds" |
---|
4063 | Â Â Â fi |
---|
4064 |    if test -f /etc/ld.so.conf; then |
---|
4065 |     echo "  - have your system administrator add LIBDIR to '/etc/ld.so.conf'" |
---|
4066 | Â Â Â fi |
---|
4067 | Â Â Â echo |
---|
4068 | |
---|
4069 |    echo "See any operating system documentation about shared libraries for" |
---|
4070 |    case $host in |
---|
4071 | Â Â Â Â solaris2.[6789]|solaris2.1[0-9]) |
---|
4072 |      echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" |
---|
4073 |      echo "pages." |
---|
4074 | Â Â Â Â Â ;; |
---|
4075 | Â Â Â Â *) |
---|
4076 |      echo "more information, such as the ld(1) and ld.so(8) manual pages." |
---|
4077 | Â Â Â Â Â ;; |
---|
4078 | Â Â Â esac |
---|
4079 |    echo "----------------------------------------------------------------------" |
---|
4080 | Â Â fi |
---|
4081 |   exit $EXIT_SUCCESS |
---|
4082 | } |
---|
4083 | |
---|
4084 | test finish = "$opt_mode" && func_mode_finish ${1+"$@"} |
---|
4085 | |
---|
4086 | |
---|
4087 | # func_mode_install arg... |
---|
4088 | func_mode_install () |
---|
4089 | { |
---|
4090 | Â Â $debug_cmd |
---|
4091 | |
---|
4092 | Â Â # There may be an optional sh(1) argument at the beginning of |
---|
4093 | Â Â # install_prog (especially on Windows NT). |
---|
4094 |   if test "$SHELL" = "$nonopt" || test /bin/sh = "$nonopt" || |
---|
4095 | Â Â Â Â # Allow the use of GNU shtool's install command. |
---|
4096 |     case $nonopt in *shtool*) :;; *) false;; esac |
---|
4097 | Â Â then |
---|
4098 | Â Â Â # Aesthetically quote it. |
---|
4099 | Â Â Â func_quote_for_eval "$nonopt" |
---|
4100 | Â Â Â install_prog="$func_quote_for_eval_result " |
---|
4101 | Â Â Â arg=$1 |
---|
4102 | Â Â Â shift |
---|
4103 | Â Â else |
---|
4104 | Â Â Â install_prog= |
---|
4105 | Â Â Â arg=$nonopt |
---|
4106 | Â Â fi |
---|
4107 | |
---|
4108 | Â Â # The real first argument should be the name of the installation program. |
---|
4109 | Â Â # Aesthetically quote it. |
---|
4110 | Â Â func_quote_for_eval "$arg" |
---|
4111 | Â Â func_append install_prog "$func_quote_for_eval_result" |
---|
4112 | Â Â install_shared_prog=$install_prog |
---|
4113 |   case " $install_prog " in |
---|
4114 | Â Â Â *[\\\ /]cp\ *)Â install_cp=: ;; |
---|
4115 |    *) install_cp=false ;; |
---|
4116 | Â Â esac |
---|
4117 | |
---|
4118 | Â Â # We need to accept at least all the BSD install flags. |
---|
4119 | Â Â dest= |
---|
4120 | Â Â files= |
---|
4121 | Â Â opts= |
---|
4122 | Â Â prev= |
---|
4123 | Â Â install_type= |
---|
4124 | Â Â isdir=false |
---|
4125 | Â Â stripme= |
---|
4126 | Â Â no_mode=: |
---|
4127 | Â Â for arg |
---|
4128 | Â Â do |
---|
4129 | Â Â Â arg2= |
---|
4130 |    if test -n "$dest"; then |
---|
4131 | Â Â Â Â func_append files " $dest" |
---|
4132 | Â Â Â Â dest=$arg |
---|
4133 | Â Â Â Â continue |
---|
4134 | Â Â Â fi |
---|
4135 | |
---|
4136 |    case $arg in |
---|
4137 | Â Â Â -d)Â isdir=: ;; |
---|
4138 | Â Â Â -f) |
---|
4139 |     if $install_cp; then :; else |
---|
4140 | Â Â Â Â Â prev=$arg |
---|
4141 | Â Â Â Â fi |
---|
4142 | Â Â Â Â ;; |
---|
4143 | Â Â Â -g | -m | -o) |
---|
4144 | Â Â Â Â prev=$arg |
---|
4145 | Â Â Â Â ;; |
---|
4146 | Â Â Â -s) |
---|
4147 | Â Â Â Â stripme=" -s" |
---|
4148 | Â Â Â Â continue |
---|
4149 | Â Â Â Â ;; |
---|
4150 | Â Â Â -*) |
---|
4151 | Â Â Â Â ;; |
---|
4152 | Â Â Â *) |
---|
4153 | Â Â Â Â # If the previous option needed an argument, then skip it. |
---|
4154 |     if test -n "$prev"; then |
---|
4155 |      if test X-m = "X$prev" && test -n "$install_override_mode"; then |
---|
4156 | Â Â Â Â Â Â arg2=$install_override_mode |
---|
4157 | Â Â Â Â Â Â no_mode=false |
---|
4158 | Â Â Â Â Â fi |
---|
4159 | Â Â Â Â Â prev= |
---|
4160 | Â Â Â Â else |
---|
4161 | Â Â Â Â Â dest=$arg |
---|
4162 | Â Â Â Â Â continue |
---|
4163 | Â Â Â Â fi |
---|
4164 | Â Â Â Â ;; |
---|
4165 | Â Â Â esac |
---|
4166 | |
---|
4167 | Â Â Â # Aesthetically quote the argument. |
---|
4168 | Â Â Â func_quote_for_eval "$arg" |
---|
4169 | Â Â Â func_append install_prog " $func_quote_for_eval_result" |
---|
4170 |    if test -n "$arg2"; then |
---|
4171 | Â Â Â Â func_quote_for_eval "$arg2" |
---|
4172 | Â Â Â fi |
---|
4173 | Â Â Â func_append install_shared_prog " $func_quote_for_eval_result" |
---|
4174 | Â Â done |
---|
4175 | |
---|
4176 |   test -z "$install_prog" && \ |
---|
4177 | Â Â Â func_fatal_help "you must specify an install program" |
---|
4178 | |
---|
4179 |   test -n "$prev" && \ |
---|
4180 | Â Â Â func_fatal_help "the '$prev' option requires an argument" |
---|
4181 | |
---|
4182 |   if test -n "$install_override_mode" && $no_mode; then |
---|
4183 |    if $install_cp; then :; else |
---|
4184 | Â Â Â Â func_quote_for_eval "$install_override_mode" |
---|
4185 | Â Â Â Â func_append install_shared_prog " -m $func_quote_for_eval_result" |
---|
4186 | Â Â Â fi |
---|
4187 | Â Â fi |
---|
4188 | |
---|
4189 |   if test -z "$files"; then |
---|
4190 |    if test -z "$dest"; then |
---|
4191 | Â Â Â Â func_fatal_help "no file or destination specified" |
---|
4192 | Â Â Â else |
---|
4193 | Â Â Â Â func_fatal_help "you must specify a destination" |
---|
4194 | Â Â Â fi |
---|
4195 | Â Â fi |
---|
4196 | |
---|
4197 | Â Â # Strip any trailing slash from the destination. |
---|
4198 | Â Â func_stripname ''Â '/'Â "$dest" |
---|
4199 | Â Â dest=$func_stripname_result |
---|
4200 | |
---|
4201 | Â Â # Check to see that the destination is a directory. |
---|
4202 |   test -d "$dest" && isdir=: |
---|
4203 |   if $isdir; then |
---|
4204 | Â Â Â destdir=$dest |
---|
4205 | Â Â Â destname= |
---|
4206 | Â Â else |
---|
4207 | Â Â Â func_dirname_and_basename "$dest"Â ""Â "." |
---|
4208 | Â Â Â destdir=$func_dirname_result |
---|
4209 | Â Â Â destname=$func_basename_result |
---|
4210 | |
---|
4211 | Â Â Â # Not a directory, so check to see that there is only one file specified. |
---|
4212 | Â Â Â set dummy $files; shift |
---|
4213 |    test "$#" -gt 1 && \ |
---|
4214 | Â Â Â Â func_fatal_help "'$dest' is not a directory" |
---|
4215 | Â Â fi |
---|
4216 |   case $destdir in |
---|
4217 | Â Â [\\/]* | [A-Za-z]:[\\/]*)Â ;; |
---|
4218 | Â Â *) |
---|
4219 | Â Â Â for file in $files; do |
---|
4220 |     case $file in |
---|
4221 | Â Â Â Â *.lo)Â ;; |
---|
4222 | Â Â Â Â *) |
---|
4223 | Â Â Â Â Â func_fatal_help "'$destdir' must be an absolute directory name" |
---|
4224 | Â Â Â Â Â ;; |
---|
4225 | Â Â Â Â esac |
---|
4226 | Â Â Â done |
---|
4227 | Â Â Â ;; |
---|
4228 | Â Â esac |
---|
4229 | |
---|
4230 | Â Â # This variable tells wrapper scripts just to set variables rather |
---|
4231 | Â Â # than running their programs. |
---|
4232 | Â Â libtool_install_magic=$magic |
---|
4233 | |
---|
4234 | Â Â staticlibs= |
---|
4235 | Â Â future_libdirs= |
---|
4236 | Â Â current_libdirs= |
---|
4237 | Â Â for file in $files; do |
---|
4238 | |
---|
4239 | Â Â Â # Do each installation. |
---|
4240 |    case $file in |
---|
4241 | Â Â Â *.$libext) |
---|
4242 | Â Â Â Â # Do the static libraries later. |
---|
4243 | Â Â Â Â func_append staticlibs " $file" |
---|
4244 | Â Â Â Â ;; |
---|
4245 | |
---|
4246 | Â Â Â *.la) |
---|
4247 | Â Â Â Â func_resolve_sysroot "$file" |
---|
4248 | Â Â Â Â file=$func_resolve_sysroot_result |
---|
4249 | |
---|
4250 | Â Â Â Â # Check to see that this really is a libtool archive. |
---|
4251 | Â Â Â Â func_lalib_unsafe_p "$file"Â \ |
---|
4252 | Â Â Â Â Â ||Â func_fatal_help "'$file' is not a valid libtool archive" |
---|
4253 | |
---|
4254 | Â Â Â Â library_names= |
---|
4255 | Â Â Â Â old_library= |
---|
4256 | Â Â Â Â relink_command= |
---|
4257 | Â Â Â Â func_source "$file" |
---|
4258 | |
---|
4259 | Â Â Â Â # Add the libdir to current_libdirs if it is the destination. |
---|
4260 |     if test "X$destdir" = "X$libdir"; then |
---|
4261 |      case "$current_libdirs " in |
---|
4262 | Â Â Â Â Â *" $libdir "*)Â ;; |
---|
4263 | Â Â Â Â Â *)Â func_append current_libdirs " $libdir"Â ;; |
---|
4264 | Â Â Â Â Â esac |
---|
4265 | Â Â Â Â else |
---|
4266 | Â Â Â Â Â # Note the libdir as a future libdir. |
---|
4267 |      case "$future_libdirs " in |
---|
4268 | Â Â Â Â Â *" $libdir "*)Â ;; |
---|
4269 | Â Â Â Â Â *)Â func_append future_libdirs " $libdir"Â ;; |
---|
4270 | Â Â Â Â Â esac |
---|
4271 | Â Â Â Â fi |
---|
4272 | |
---|
4273 | Â Â Â Â func_dirname "$file"Â "/"Â "" |
---|
4274 | Â Â Â Â dir=$func_dirname_result |
---|
4275 | Â Â Â Â func_append dir "$objdir" |
---|
4276 | |
---|
4277 |     if test -n "$relink_command"; then |
---|
4278 | Â Â Â Â Â # Determine the prefix the user has applied to our future dir. |
---|
4279 | Â Â Â Â Â inst_prefix_dir=`$ECHOÂ "$destdir"Â | $SEDÂ -e "s%$libdir\$%%"` |
---|
4280 | |
---|
4281 | Â Â Â Â Â # Don't allow the user to place us outside of our expected |
---|
4282 | Â Â Â Â Â # location b/c this prevents finding dependent libraries that |
---|
4283 | Â Â Â Â Â # are installed to the same prefix. |
---|
4284 | Â Â Â Â Â # At present, this check doesn't affect windows .dll's that |
---|
4285 | Â Â Â Â Â # are installed into $libdir/../bin (currently, that works fine) |
---|
4286 | Â Â Â Â Â # but it's something to keep an eye on. |
---|
4287 |      test "$inst_prefix_dir" = "$destdir" && \ |
---|
4288 | Â Â Â Â Â Â func_fatal_error "error: cannot install '$file' to a directory not ending in $libdir" |
---|
4289 | |
---|
4290 |      if test -n "$inst_prefix_dir"; then |
---|
4291 | Â Â Â Â Â Â # Stick the inst_prefix_dir data into the link command. |
---|
4292 | Â Â Â Â Â Â relink_command=`$ECHOÂ "$relink_command"Â | $SEDÂ "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` |
---|
4293 | Â Â Â Â Â else |
---|
4294 | Â Â Â Â Â Â relink_command=`$ECHOÂ "$relink_command"Â | $SEDÂ "s%@inst_prefix_dir@%%"` |
---|
4295 | Â Â Â Â Â fi |
---|
4296 | |
---|
4297 | Â Â Â Â Â func_warning "relinking '$file'" |
---|
4298 | Â Â Â Â Â func_show_eval "$relink_command"Â \ |
---|
4299 | Â Â Â Â Â Â 'func_fatal_error "error: relink '\''$file'\'' with the above command before installing it"' |
---|
4300 | Â Â Â Â fi |
---|
4301 | |
---|
4302 | Â Â Â Â # See the names of the shared library. |
---|
4303 | Â Â Â Â set dummy $library_names; shift |
---|
4304 |     if test -n "$1"; then |
---|
4305 | Â Â Â Â Â realname=$1 |
---|
4306 | Â Â Â Â Â shift |
---|
4307 | |
---|
4308 | Â Â Â Â Â srcname=$realname |
---|
4309 |      test -n "$relink_command" && srcname=${realname}T |
---|
4310 | |
---|
4311 | Â Â Â Â Â # Install the shared library and build the symlinks. |
---|
4312 | Â Â Â Â Â func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname"Â \ |
---|
4313 | Â Â Â Â Â Â Â 'exit $?' |
---|
4314 | Â Â Â Â Â tstripme=$stripme |
---|
4315 |      case $host_os in |
---|
4316 | Â Â Â Â Â cygwin* | mingw* | pw32* | cegcc*) |
---|
4317 |       case $realname in |
---|
4318 | Â Â Â Â Â Â *.dll.a) |
---|
4319 | Â Â Â Â Â Â Â tstripme= |
---|
4320 | Â Â Â Â Â Â Â ;; |
---|
4321 | Â Â Â Â Â Â esac |
---|
4322 | Â Â Â Â Â Â ;; |
---|
4323 | Â Â Â Â Â os2*) |
---|
4324 |       case $realname in |
---|
4325 | Â Â Â Â Â Â *_dll.a) |
---|
4326 | Â Â Â Â Â Â Â tstripme= |
---|
4327 | Â Â Â Â Â Â Â ;; |
---|
4328 | Â Â Â Â Â Â esac |
---|
4329 | Â Â Â Â Â Â ;; |
---|
4330 | Â Â Â Â Â esac |
---|
4331 |      if test -n "$tstripme" && test -n "$striplib"; then |
---|
4332 | Â Â Â Â Â Â func_show_eval "$striplib $destdir/$realname"Â 'exit $?' |
---|
4333 | Â Â Â Â Â fi |
---|
4334 | |
---|
4335 |      if test "$#" -gt 0; then |
---|
4336 | Â Â Â Â Â Â # Delete the old symlinks, and create new ones. |
---|
4337 | Â Â Â Â Â Â # Try 'ln -sf' first, because the 'ln' binary might depend on |
---|
4338 |       # the symlink we replace! Solaris /bin/ln does not understand -f, |
---|
4339 | Â Â Â Â Â Â # so we also need to try rm && ln -s. |
---|
4340 | Â Â Â Â Â Â for linkname |
---|
4341 | Â Â Â Â Â Â do |
---|
4342 |        test "$linkname" != "$realname" \ |
---|
4343 | Â Â Â Â Â Â Â Â &&Â func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" |
---|
4344 | Â Â Â Â Â Â done |
---|
4345 | Â Â Â Â Â fi |
---|
4346 | |
---|
4347 | Â Â Â Â Â # Do each command in the postinstall commands. |
---|
4348 | Â Â Â Â Â lib=$destdir/$realname |
---|
4349 | Â Â Â Â Â func_execute_cmds "$postinstall_cmds"Â 'exit $?' |
---|
4350 | Â Â Â Â fi |
---|
4351 | |
---|
4352 | Â Â Â Â # Install the pseudo-library for information purposes. |
---|
4353 | Â Â Â Â func_basename "$file" |
---|
4354 | Â Â Â Â name=$func_basename_result |
---|
4355 | Â Â Â Â instname=$dir/${name}i |
---|
4356 | Â Â Â Â func_show_eval "$install_prog $instname $destdir/$name"Â 'exit $?' |
---|
4357 | |
---|
4358 | Â Â Â Â # Maybe install the static library, too. |
---|
4359 |     test -n "$old_library" && func_append staticlibs " $dir/$old_library" |
---|
4360 | Â Â Â Â ;; |
---|
4361 | |
---|
4362 | Â Â Â *.lo) |
---|
4363 | Â Â Â Â # Install (i.e. copy) a libtool object. |
---|
4364 | |
---|
4365 | Â Â Â Â # Figure out destination file name, if it wasn't already specified. |
---|
4366 |     if test -n "$destname"; then |
---|
4367 | Â Â Â Â Â destfile=$destdir/$destname |
---|
4368 | Â Â Â Â else |
---|
4369 | Â Â Â Â Â func_basename "$file" |
---|
4370 | Â Â Â Â Â destfile=$func_basename_result |
---|
4371 | Â Â Â Â Â destfile=$destdir/$destfile |
---|
4372 | Â Â Â Â fi |
---|
4373 | |
---|
4374 | Â Â Â Â # Deduce the name of the destination old-style object file. |
---|
4375 |     case $destfile in |
---|
4376 | Â Â Â Â *.lo) |
---|
4377 | Â Â Â Â Â func_lo2o "$destfile" |
---|
4378 | Â Â Â Â Â staticdest=$func_lo2o_result |
---|
4379 | Â Â Â Â Â ;; |
---|
4380 | Â Â Â Â *.$objext) |
---|
4381 | Â Â Â Â Â staticdest=$destfile |
---|
4382 | Â Â Â Â Â destfile= |
---|
4383 | Â Â Â Â Â ;; |
---|
4384 | Â Â Â Â *) |
---|
4385 | Â Â Â Â Â func_fatal_help "cannot copy a libtool object to '$destfile'" |
---|
4386 | Â Â Â Â Â ;; |
---|
4387 | Â Â Â Â esac |
---|
4388 | |
---|
4389 | Â Â Â Â # Install the libtool object if requested. |
---|
4390 |     test -n "$destfile" && \ |
---|
4391 | Â Â Â Â Â func_show_eval "$install_prog $file $destfile"Â 'exit $?' |
---|
4392 | |
---|
4393 | Â Â Â Â # Install the old object if enabled. |
---|
4394 |     if test yes = "$build_old_libs"; then |
---|
4395 | Â Â Â Â Â # Deduce the name of the old-style object file. |
---|
4396 | Â Â Â Â Â func_lo2o "$file" |
---|
4397 | Â Â Â Â Â staticobj=$func_lo2o_result |
---|
4398 | Â Â Â Â Â func_show_eval "$install_prog \$staticobj \$staticdest"Â 'exit $?' |
---|
4399 | Â Â Â Â fi |
---|
4400 |     exit $EXIT_SUCCESS |
---|
4401 | Â Â Â Â ;; |
---|
4402 | |
---|
4403 | Â Â Â *) |
---|
4404 | Â Â Â Â # Figure out destination file name, if it wasn't already specified. |
---|
4405 |     if test -n "$destname"; then |
---|
4406 | Â Â Â Â Â destfile=$destdir/$destname |
---|
4407 | Â Â Â Â else |
---|
4408 | Â Â Â Â Â func_basename "$file" |
---|
4409 | Â Â Â Â Â destfile=$func_basename_result |
---|
4410 | Â Â Â Â Â destfile=$destdir/$destfile |
---|
4411 | Â Â Â Â fi |
---|
4412 | |
---|
4413 | Â Â Â Â # If the file is missing, and there is a .exe on the end, strip it |
---|
4414 | Â Â Â Â # because it is most likely a libtool script we actually want to |
---|
4415 | Â Â Â Â # install |
---|
4416 | Â Â Â Â stripped_ext= |
---|
4417 |     case $file in |
---|
4418 | Â Â Â Â Â *.exe) |
---|
4419 |       if test ! -f "$file"; then |
---|
4420 | Â Â Â Â Â Â Â func_stripname ''Â '.exe'Â "$file" |
---|
4421 | Â Â Â Â Â Â Â file=$func_stripname_result |
---|
4422 | Â Â Â Â Â Â Â stripped_ext=.exe |
---|
4423 | Â Â Â Â Â Â fi |
---|
4424 | Â Â Â Â Â Â ;; |
---|
4425 | Â Â Â Â esac |
---|
4426 | |
---|
4427 | Â Â Â Â # Do a test to see if this is really a libtool program. |
---|
4428 |     case $host in |
---|
4429 | Â Â Â Â *cygwin* | *mingw*) |
---|
4430 | Â Â Â Â Â Â if func_ltwrapper_executable_p "$file"; then |
---|
4431 | Â Â Â Â Â Â Â func_ltwrapper_scriptname "$file" |
---|
4432 | Â Â Â Â Â Â Â wrapper=$func_ltwrapper_scriptname_result |
---|
4433 | Â Â Â Â Â Â else |
---|
4434 | Â Â Â Â Â Â Â func_stripname ''Â '.exe'Â "$file" |
---|
4435 | Â Â Â Â Â Â Â wrapper=$func_stripname_result |
---|
4436 | Â Â Â Â Â Â fi |
---|
4437 | Â Â Â Â Â Â ;; |
---|
4438 | Â Â Â Â *) |
---|
4439 | Â Â Â Â Â Â wrapper=$file |
---|
4440 | Â Â Â Â Â Â ;; |
---|
4441 | Â Â Â Â esac |
---|
4442 | Â Â Â Â if func_ltwrapper_script_p "$wrapper"; then |
---|
4443 | Â Â Â Â Â notinst_deplibs= |
---|
4444 | Â Â Â Â Â relink_command= |
---|
4445 | |
---|
4446 | Â Â Â Â Â func_source "$wrapper" |
---|
4447 | |
---|
4448 | Â Â Â Â Â # Check the variables that should have been set. |
---|
4449 |      test -z "$generated_by_libtool_version" && \ |
---|
4450 | Â Â Â Â Â Â func_fatal_error "invalid libtool wrapper script '$wrapper'" |
---|
4451 | |
---|
4452 | Â Â Â Â Â finalize=: |
---|
4453 | Â Â Â Â Â for lib in $notinst_deplibs; do |
---|
4454 | Â Â Â Â Â Â # Check to see that each library is installed. |
---|
4455 | Â Â Â Â Â Â libdir= |
---|
4456 |       if test -f "$lib"; then |
---|
4457 | Â Â Â Â Â Â Â func_source "$lib" |
---|
4458 | Â Â Â Â Â Â fi |
---|
4459 | Â Â Â Â Â Â libfile=$libdir/`$ECHOÂ "$lib"Â | $SEDÂ 's%^.*/%%g'` |
---|
4460 |       if test -n "$libdir" && test ! -f "$libfile"; then |
---|
4461 | Â Â Â Â Â Â Â func_warning "'$lib' has not been installed in '$libdir'" |
---|
4462 | Â Â Â Â Â Â Â finalize=false |
---|
4463 | Â Â Â Â Â Â fi |
---|
4464 | Â Â Â Â Â done |
---|
4465 | |
---|
4466 | Â Â Â Â Â relink_command= |
---|
4467 | Â Â Â Â Â func_source "$wrapper" |
---|
4468 | |
---|
4469 | Â Â Â Â Â outputname= |
---|
4470 |      if test no = "$fast_install" && test -n "$relink_command"; then |
---|
4471 |       $opt_dry_run || { |
---|
4472 |        if $finalize; then |
---|
4473 | Â Â Â Â Â Â Â Â tmpdir=`func_mktempdir` |
---|
4474 | Â Â Â Â Â Â Â Â func_basename "$file$stripped_ext" |
---|
4475 | Â Â Â Â Â Â Â Â file=$func_basename_result |
---|
4476 | Â Â Â Â Â Â Â Â outputname=$tmpdir/$file |
---|
4477 | Â Â Â Â Â Â Â Â # Replace the output file specification. |
---|
4478 | Â Â Â Â Â Â Â Â relink_command=`$ECHOÂ "$relink_command"Â | $SEDÂ 's%@OUTPUT@%'"$outputname"'%g'` |
---|
4479 | |
---|
4480 |         $opt_quiet || { |
---|
4481 | Â Â Â Â Â Â Â Â Â func_quote_for_expand "$relink_command" |
---|
4482 |          eval "func_echo $func_quote_for_expand_result" |
---|
4483 | Â Â Â Â Â Â Â Â } |
---|
4484 |         if eval "$relink_command"; then : |
---|
4485 | Â Â Â Â Â Â Â Â Â else |
---|
4486 | Â Â Â Â Â Â Â Â Â func_error "error: relink '$file' with the above command before installing it" |
---|
4487 |          $opt_dry_run || ${RM}r "$tmpdir" |
---|
4488 | Â Â Â Â Â Â Â Â Â continue |
---|
4489 | Â Â Â Â Â Â Â Â fi |
---|
4490 | Â Â Â Â Â Â Â Â file=$outputname |
---|
4491 | Â Â Â Â Â Â Â else |
---|
4492 | Â Â Â Â Â Â Â Â func_warning "cannot relink '$file'" |
---|
4493 | Â Â Â Â Â Â Â fi |
---|
4494 | Â Â Â Â Â Â } |
---|
4495 | Â Â Â Â Â else |
---|
4496 | Â Â Â Â Â Â # Install the binary that we compiled earlier. |
---|
4497 | Â Â Â Â Â Â file=`$ECHOÂ "$file$stripped_ext"Â | $SEDÂ "s%\([^/]*\)$%$objdir/\1%"` |
---|
4498 | Â Â Â Â Â fi |
---|
4499 | Â Â Â Â fi |
---|
4500 | |
---|
4501 | Â Â Â Â # remove .exe since cygwin /usr/bin/install will append another |
---|
4502 | Â Â Â Â # one anyway |
---|
4503 |     case $install_prog,$host in |
---|
4504 | Â Â Â Â */usr/bin/install*,*cygwin*) |
---|
4505 |      case $file:$destfile in |
---|
4506 | Â Â Â Â Â *.exe:*.exe) |
---|
4507 | Â Â Â Â Â Â # this is ok |
---|
4508 | Â Â Â Â Â Â ;; |
---|
4509 | Â Â Â Â Â *.exe:*) |
---|
4510 | Â Â Â Â Â Â destfile=$destfile.exe |
---|
4511 | Â Â Â Â Â Â ;; |
---|
4512 | Â Â Â Â Â *:*.exe) |
---|
4513 | Â Â Â Â Â Â func_stripname ''Â '.exe'Â "$destfile" |
---|
4514 | Â Â Â Â Â Â destfile=$func_stripname_result |
---|
4515 | Â Â Â Â Â Â ;; |
---|
4516 | Â Â Â Â Â esac |
---|
4517 | Â Â Â Â Â ;; |
---|
4518 | Â Â Â Â esac |
---|
4519 | Â Â Â Â func_show_eval "$install_prog\$stripme \$file \$destfile"Â 'exit $?' |
---|
4520 |     $opt_dry_run || if test -n "$outputname"; then |
---|
4521 | Â Â Â Â Â ${RM}r "$tmpdir" |
---|
4522 | Â Â Â Â fi |
---|
4523 | Â Â Â Â ;; |
---|
4524 | Â Â Â esac |
---|
4525 | Â Â done |
---|
4526 | |
---|
4527 | Â Â for file in $staticlibs; do |
---|
4528 | Â Â Â func_basename "$file" |
---|
4529 | Â Â Â name=$func_basename_result |
---|
4530 | |
---|
4531 | Â Â Â # Set up the ranlib parameters. |
---|
4532 | Â Â Â oldlib=$destdir/$name |
---|
4533 | Â Â Â func_to_tool_file "$oldlib"Â func_convert_file_msys_to_w32 |
---|
4534 | Â Â Â tool_oldlib=$func_to_tool_file_result |
---|
4535 | |
---|
4536 | Â Â Â func_show_eval "$install_prog \$file \$oldlib"Â 'exit $?' |
---|
4537 | |
---|
4538 |    if test -n "$stripme" && test -n "$old_striplib"; then |
---|
4539 | Â Â Â Â func_show_eval "$old_striplib $tool_oldlib"Â 'exit $?' |
---|
4540 | Â Â Â fi |
---|
4541 | |
---|
4542 | Â Â Â # Do each command in the postinstall commands. |
---|
4543 | Â Â Â func_execute_cmds "$old_postinstall_cmds"Â 'exit $?' |
---|
4544 | Â Â done |
---|
4545 | |
---|
4546 |   test -n "$future_libdirs" && \ |
---|
4547 | Â Â Â func_warning "remember to run '$progname --finish$future_libdirs'" |
---|
4548 | |
---|
4549 |   if test -n "$current_libdirs"; then |
---|
4550 | Â Â Â # Maybe just do a dry run. |
---|
4551 |    $opt_dry_run && current_libdirs=" -n$current_libdirs" |
---|
4552 | Â Â Â exec_cmd='$SHELL "$progpath" $preserve_args --finish$current_libdirs' |
---|
4553 | Â Â else |
---|
4554 |    exit $EXIT_SUCCESS |
---|
4555 | Â Â fi |
---|
4556 | } |
---|
4557 | |
---|
4558 | test install = "$opt_mode" && func_mode_install ${1+"$@"} |
---|
4559 | |
---|
4560 | |
---|
4561 | # func_generate_dlsyms outputname originator pic_p |
---|
4562 | # Extract symbols from dlprefiles and create ${outputname}S.o with |
---|
4563 | # a dlpreopen symbol table. |
---|
4564 | func_generate_dlsyms () |
---|
4565 | { |
---|
4566 | Â Â $debug_cmd |
---|
4567 | |
---|
4568 | Â Â my_outputname=$1 |
---|
4569 | Â Â my_originator=$2 |
---|
4570 | Â Â my_pic_p=${3-false} |
---|
4571 | Â Â my_prefix=`$ECHOÂ "$my_originator"Â | $SEDÂ 's%[^a-zA-Z0-9]%_%g'` |
---|
4572 | Â Â my_dlsyms= |
---|
4573 | |
---|
4574 |   if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then |
---|
4575 |    if test -n "$NM" && test -n "$global_symbol_pipe"; then |
---|
4576 | Â Â Â Â my_dlsyms=${my_outputname}S.c |
---|
4577 | Â Â Â else |
---|
4578 | Â Â Â Â func_error "not configured to extract global symbols from dlpreopened files" |
---|
4579 | Â Â Â fi |
---|
4580 | Â Â fi |
---|
4581 | |
---|
4582 |   if test -n "$my_dlsyms"; then |
---|
4583 |    case $my_dlsyms in |
---|
4584 | Â Â Â "")Â ;; |
---|
4585 | Â Â Â *.c) |
---|
4586 | Â Â Â Â # Discover the nlist of each of the dlfiles. |
---|
4587 | Â Â Â Â nlist=$output_objdir/$my_outputname.nm |
---|
4588 | |
---|
4589 | Â Â Â Â func_show_eval "$RM $nlist ${nlist}S ${nlist}T" |
---|
4590 | |
---|
4591 | Â Â Â Â # Parse the name list into a source file. |
---|
4592 | Â Â Â Â func_verbose "creating $output_objdir/$my_dlsyms" |
---|
4593 | |
---|
4594 |     $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ |
---|
4595 | /* $my_dlsyms - symbol resolution table for '$my_outputname' dlsym emulation. */ |
---|
4596 | /* Generated by $PROGRAM (GNU $PACKAGE) $VERSION */ |
---|
4597 | |
---|
4598 | #ifdef __cplusplus |
---|
4599 | extern \"C\" { |
---|
4600 | #endif |
---|
4601 | |
---|
4602 | #if defined __GNUC__ && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) |
---|
4603 | #pragma GCC diagnostic ignored \"-Wstrict-prototypes\" |
---|
4604 | #endif |
---|
4605 | |
---|
4606 | /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ |
---|
4607 | #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE |
---|
4608 | /* DATA imports from DLLs on WIN32 can't be const, because runtime |
---|
4609 |   relocations are performed -- see ld's documentation on pseudo-relocs. */ |
---|
4610 | # define LT_DLSYM_CONST |
---|
4611 | #elif defined __osf__ |
---|
4612 | /* This system does not cope well with relocations in const data. */ |
---|
4613 | # define LT_DLSYM_CONST |
---|
4614 | #else |
---|
4615 | # define LT_DLSYM_CONST const |
---|
4616 | #endif |
---|
4617 | |
---|
4618 | #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0) |
---|
4619 | |
---|
4620 | /* External symbol declarations for the compiler. */\ |
---|
4621 | " |
---|
4622 | |
---|
4623 |     if test yes = "$dlself"; then |
---|
4624 | Â Â Â Â Â func_verbose "generating symbol list for '$output'" |
---|
4625 | |
---|
4626 |      $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" |
---|
4627 | |
---|
4628 | Â Â Â Â Â # Add our own program objects to the symbol list. |
---|
4629 | Â Â Â Â Â progfiles=`$ECHOÂ "$objs$old_deplibs"Â | $SP2NLÂ | $SEDÂ "$lo2o"Â | $NL2SP` |
---|
4630 | Â Â Â Â Â for progfile in $progfiles; do |
---|
4631 | Â Â Â Â Â Â func_to_tool_file "$progfile"Â func_convert_file_msys_to_w32 |
---|
4632 | Â Â Â Â Â Â func_verbose "extracting global C symbols from '$func_to_tool_file_result'" |
---|
4633 |       $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" |
---|
4634 | Â Â Â Â Â done |
---|
4635 | |
---|
4636 |      if test -n "$exclude_expsyms"; then |
---|
4637 |       $opt_dry_run || { |
---|
4638 |        eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' |
---|
4639 |        eval '$MV "$nlist"T "$nlist"' |
---|
4640 | Â Â Â Â Â Â } |
---|
4641 | Â Â Â Â Â fi |
---|
4642 | |
---|
4643 |      if test -n "$export_symbols_regex"; then |
---|
4644 |       $opt_dry_run || { |
---|
4645 |        eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' |
---|
4646 |        eval '$MV "$nlist"T "$nlist"' |
---|
4647 | Â Â Â Â Â Â } |
---|
4648 | Â Â Â Â Â fi |
---|
4649 | |
---|
4650 | Â Â Â Â Â # Prepare the list of exported symbols |
---|
4651 |      if test -z "$export_symbols"; then |
---|
4652 | Â Â Â Â Â Â export_symbols=$output_objdir/$outputname.exp |
---|
4653 |       $opt_dry_run || { |
---|
4654 | Â Â Â Â Â Â Â $RMÂ $export_symbols |
---|
4655 |        eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' |
---|
4656 |        case $host in |
---|
4657 | Â Â Â Â Â Â Â *cygwin* | *mingw* | *cegcc* ) |
---|
4658 |         eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' |
---|
4659 |         eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' |
---|
4660 | Â Â Â Â Â Â Â Â ;; |
---|
4661 | Â Â Â Â Â Â Â esac |
---|
4662 | Â Â Â Â Â Â } |
---|
4663 | Â Â Â Â Â else |
---|
4664 |       $opt_dry_run || { |
---|
4665 |        eval "$SED -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' |
---|
4666 |        eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' |
---|
4667 |        eval '$MV "$nlist"T "$nlist"' |
---|
4668 |        case $host in |
---|
4669 | Â Â Â Â Â Â Â Â *cygwin* | *mingw* | *cegcc* ) |
---|
4670 |          eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' |
---|
4671 |          eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' |
---|
4672 | Â Â Â Â Â Â Â Â Â ;; |
---|
4673 | Â Â Â Â Â Â Â esac |
---|
4674 | Â Â Â Â Â Â } |
---|
4675 | Â Â Â Â Â fi |
---|
4676 | Â Â Â Â fi |
---|
4677 | |
---|
4678 | Â Â Â Â for dlprefile in $dlprefiles; do |
---|
4679 | Â Â Â Â Â func_verbose "extracting global C symbols from '$dlprefile'" |
---|
4680 | Â Â Â Â Â func_basename "$dlprefile" |
---|
4681 | Â Â Â Â Â name=$func_basename_result |
---|
4682 |      case $host in |
---|
4683 | Â Â Â Â Â Â *cygwin* | *mingw* | *cegcc* ) |
---|
4684 | Â Â Â Â Â Â Â # if an import library, we need to obtain dlname |
---|
4685 | Â Â Â Â Â Â Â if func_win32_import_lib_p "$dlprefile"; then |
---|
4686 | Â Â Â Â Â Â Â Â func_tr_sh "$dlprefile" |
---|
4687 |         eval "curr_lafile=\$libfile_$func_tr_sh_result" |
---|
4688 | Â Â Â Â Â Â Â Â dlprefile_dlbasename= |
---|
4689 |         if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then |
---|
4690 | Â Â Â Â Â Â Â Â Â # Use subshell, to avoid clobbering current variable values |
---|
4691 |          dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` |
---|
4692 |          if test -n "$dlprefile_dlname"; then |
---|
4693 | Â Â Â Â Â Â Â Â Â Â func_basename "$dlprefile_dlname" |
---|
4694 | Â Â Â Â Â Â Â Â Â Â dlprefile_dlbasename=$func_basename_result |
---|
4695 | Â Â Â Â Â Â Â Â Â else |
---|
4696 | Â Â Â Â Â Â Â Â Â Â # no lafile. user explicitly requested -dlpreopen <import library>. |
---|
4697 |           $sharedlib_from_linklib_cmd "$dlprefile" |
---|
4698 | Â Â Â Â Â Â Â Â Â Â dlprefile_dlbasename=$sharedlib_from_linklib_result |
---|
4699 | Â Â Â Â Â Â Â Â Â fi |
---|
4700 | Â Â Â Â Â Â Â Â fi |
---|
4701 |         $opt_dry_run || { |
---|
4702 |          if test -n "$dlprefile_dlbasename"; then |
---|
4703 |           eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' |
---|
4704 | Â Â Â Â Â Â Â Â Â else |
---|
4705 | Â Â Â Â Â Â Â Â Â Â func_warning "Could not compute DLL name from $name" |
---|
4706 |           eval '$ECHO ": $name " >> "$nlist"' |
---|
4707 | Â Â Â Â Â Â Â Â Â fi |
---|
4708 | Â Â Â Â Â Â Â Â Â func_to_tool_file "$dlprefile"Â func_convert_file_msys_to_w32 |
---|
4709 |          eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | |
---|
4710 | Â Â Â Â Â Â Â Â Â Â $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" |
---|
4711 | Â Â Â Â Â Â Â Â } |
---|
4712 |        else # not an import lib |
---|
4713 |         $opt_dry_run || { |
---|
4714 |          eval '$ECHO ": $name " >> "$nlist"' |
---|
4715 | Â Â Â Â Â Â Â Â Â func_to_tool_file "$dlprefile"Â func_convert_file_msys_to_w32 |
---|
4716 |          eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" |
---|
4717 | Â Â Â Â Â Â Â Â } |
---|
4718 | Â Â Â Â Â Â Â fi |
---|
4719 | Â Â Â Â Â Â ;; |
---|
4720 | Â Â Â Â Â Â *) |
---|
4721 |        $opt_dry_run || { |
---|
4722 |         eval '$ECHO ": $name " >> "$nlist"' |
---|
4723 | Â Â Â Â Â Â Â Â func_to_tool_file "$dlprefile"Â func_convert_file_msys_to_w32 |
---|
4724 |         eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" |
---|
4725 | Â Â Â Â Â Â Â } |
---|
4726 | Â Â Â Â Â Â ;; |
---|
4727 | Â Â Â Â Â esac |
---|
4728 | Â Â Â Â done |
---|
4729 | |
---|
4730 |     $opt_dry_run || { |
---|
4731 | Â Â Â Â Â # Make sure we have at least an empty file. |
---|
4732 |      test -f "$nlist" || : > "$nlist" |
---|
4733 | |
---|
4734 |      if test -n "$exclude_expsyms"; then |
---|
4735 | Â Â Â Â Â Â $EGREPÂ -v " ($exclude_expsyms)$"Â "$nlist"Â > "$nlist"T |
---|
4736 | Â Â Â Â Â Â $MVÂ "$nlist"T "$nlist" |
---|
4737 | Â Â Â Â Â fi |
---|
4738 | |
---|
4739 | Â Â Â Â Â # Try sorting and uniquifying the output. |
---|
4740 |      if $GREP -v "^: " < "$nlist" | |
---|
4741 | Â Â Â Â Â Â Â if sort -k 3 </dev/null >/dev/null 2>&1; then |
---|
4742 | Â Â Â Â Â Â Â Â sort -k 3 |
---|
4743 | Â Â Â Â Â Â Â else |
---|
4744 | Â Â Â Â Â Â Â Â sort +2 |
---|
4745 |        fi | |
---|
4746 | Â Â Â Â Â Â Â uniq > "$nlist"S; then |
---|
4747 | Â Â Â Â Â Â : |
---|
4748 | Â Â Â Â Â else |
---|
4749 | Â Â Â Â Â Â $GREPÂ -v "^: "Â < "$nlist"Â > "$nlist"S |
---|
4750 | Â Â Â Â Â fi |
---|
4751 | |
---|
4752 |      if test -f "$nlist"S; then |
---|
4753 |       eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' |
---|
4754 | Â Â Â Â Â else |
---|
4755 |       echo '/* NONE */' >> "$output_objdir/$my_dlsyms" |
---|
4756 | Â Â Â Â Â fi |
---|
4757 | |
---|
4758 | Â Â Â Â Â func_show_eval '$RM "${nlist}I"' |
---|
4759 |      if test -n "$global_symbol_to_import"; then |
---|
4760 |       eval "$global_symbol_to_import"' < "$nlist"S > "$nlist"I' |
---|
4761 | Â Â Â Â Â fi |
---|
4762 | |
---|
4763 |      echo >> "$output_objdir/$my_dlsyms" "\ |
---|
4764 | |
---|
4765 | /* The mapping between symbol names and symbols. */ |
---|
4766 | typedef struct { |
---|
4767 | Â const char *name; |
---|
4768 | Â void *address; |
---|
4769 | } lt_dlsymlist; |
---|
4770 | extern LT_DLSYM_CONST lt_dlsymlist |
---|
4771 | lt_${my_prefix}_LTX_preloaded_symbols[];\ |
---|
4772 | " |
---|
4773 | |
---|
4774 |      if test -s "$nlist"I; then |
---|
4775 |       echo >> "$output_objdir/$my_dlsyms" "\ |
---|
4776 | static void lt_syminit(void) |
---|
4777 | { |
---|
4778 | Â LT_DLSYM_CONST lt_dlsymlist *symbol = lt_${my_prefix}_LTX_preloaded_symbols; |
---|
4779 | Â for (; symbol->name; ++symbol) |
---|
4780 | Â Â {" |
---|
4781 | Â Â Â Â Â Â $SEDÂ 's/.*/Â Â Â if (STREQ (symbol->name, \"&\")) symbol->address = (void *) \&&;/'Â < "$nlist"I >> "$output_objdir/$my_dlsyms" |
---|
4782 |       echo >> "$output_objdir/$my_dlsyms" "\ |
---|
4783 | Â Â } |
---|
4784 | }" |
---|
4785 | Â Â Â Â Â fi |
---|
4786 |      echo >> "$output_objdir/$my_dlsyms" "\ |
---|
4787 | LT_DLSYM_CONST lt_dlsymlist |
---|
4788 | lt_${my_prefix}_LTX_preloaded_symbols[] = |
---|
4789 | { {\"$my_originator\", (void *) 0}," |
---|
4790 | |
---|
4791 |      if test -s "$nlist"I; then |
---|
4792 |       echo >> "$output_objdir/$my_dlsyms" "\ |
---|
4793 | Â {\"@INIT@\", (void *) <_syminit}," |
---|
4794 | Â Â Â Â Â fi |
---|
4795 | |
---|
4796 |      case $need_lib_prefix in |
---|
4797 | Â Â Â Â Â no) |
---|
4798 |       eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" |
---|
4799 | Â Â Â Â Â Â ;; |
---|
4800 | Â Â Â Â Â *) |
---|
4801 |       eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" |
---|
4802 | Â Â Â Â Â Â ;; |
---|
4803 | Â Â Â Â Â esac |
---|
4804 |      echo >> "$output_objdir/$my_dlsyms" "\ |
---|
4805 | Â {0, (void *) 0} |
---|
4806 | }; |
---|
4807 | |
---|
4808 | /* This works around a problem in FreeBSD linker */ |
---|
4809 | #ifdef FREEBSD_WORKAROUND |
---|
4810 | static const void *lt_preloaded_setup() { |
---|
4811 | Â return lt_${my_prefix}_LTX_preloaded_symbols; |
---|
4812 | } |
---|
4813 | #endif |
---|
4814 | |
---|
4815 | #ifdef __cplusplus |
---|
4816 | } |
---|
4817 | #endif\ |
---|
4818 | " |
---|
4819 | Â Â Â Â }Â # !$opt_dry_run |
---|
4820 | |
---|
4821 | Â Â Â Â pic_flag_for_symtable= |
---|
4822 |     case "$compile_command " in |
---|
4823 | Â Â Â Â *" -static "*)Â ;; |
---|
4824 | Â Â Â Â *) |
---|
4825 |      case $host in |
---|
4826 | Â Â Â Â Â # compiling the symbol table file with pic_flag works around |
---|
4827 | Â Â Â Â Â # a FreeBSD bug that causes programs to crash when -lm is |
---|
4828 |      # linked before any other PIC object. But we must not use |
---|
4829 |      # pic_flag when linking with -static. The problem exists in |
---|
4830 | Â Â Â Â Â # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. |
---|
4831 | Â Â Â Â Â *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) |
---|
4832 | Â Â Â Â Â Â pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND"Â ;; |
---|
4833 | Â Â Â Â Â *-*-hpux*) |
---|
4834 | Â Â Â Â Â Â pic_flag_for_symtable=" $pic_flag"Â ;; |
---|
4835 | Â Â Â Â Â *) |
---|
4836 |       $my_pic_p && pic_flag_for_symtable=" $pic_flag" |
---|
4837 | Â Â Â Â Â Â ;; |
---|
4838 | Â Â Â Â Â esac |
---|
4839 | Â Â Â Â Â ;; |
---|
4840 | Â Â Â Â esac |
---|
4841 | Â Â Â Â symtab_cflags= |
---|
4842 | Â Â Â Â for arg in $LTCFLAGS; do |
---|
4843 |      case $arg in |
---|
4844 | Â Â Â Â Â -pie | -fpie | -fPIE)Â ;; |
---|
4845 | Â Â Â Â Â *)Â func_append symtab_cflags " $arg"Â ;; |
---|
4846 | Â Â Â Â Â esac |
---|
4847 | Â Â Â Â done |
---|
4848 | |
---|
4849 | Â Â Â Â # Now compile the dynamic symbol file. |
---|
4850 | Â Â Â Â func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")'Â 'exit $?' |
---|
4851 | |
---|
4852 | Â Â Â Â # Clean up the generated files. |
---|
4853 | Â Â Â Â func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" "${nlist}I"' |
---|
4854 | |
---|
4855 | Â Â Â Â # Transform the symbol file into the correct name. |
---|
4856 | Â Â Â Â symfileobj=$output_objdir/${my_outputname}S.$objext |
---|
4857 |     case $host in |
---|
4858 | Â Â Â Â *cygwin* | *mingw* | *cegcc* ) |
---|
4859 |      if test -f "$output_objdir/$my_outputname.def"; then |
---|
4860 | Â Â Â Â Â Â compile_command=`$ECHOÂ "$compile_command"Â | $SEDÂ "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` |
---|
4861 | Â Â Â Â Â Â finalize_command=`$ECHOÂ "$finalize_command"Â | $SEDÂ "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` |
---|
4862 | Â Â Â Â Â else |
---|
4863 | Â Â Â Â Â Â compile_command=`$ECHOÂ "$compile_command"Â | $SEDÂ "s%@SYMFILE@%$symfileobj%"` |
---|
4864 | Â Â Â Â Â Â finalize_command=`$ECHOÂ "$finalize_command"Â | $SEDÂ "s%@SYMFILE@%$symfileobj%"` |
---|
4865 | Â Â Â Â Â fi |
---|
4866 | Â Â Â Â Â ;; |
---|
4867 | Â Â Â Â *) |
---|
4868 | Â Â Â Â Â compile_command=`$ECHOÂ "$compile_command"Â | $SEDÂ "s%@SYMFILE@%$symfileobj%"` |
---|
4869 | Â Â Â Â Â finalize_command=`$ECHOÂ "$finalize_command"Â | $SEDÂ "s%@SYMFILE@%$symfileobj%"` |
---|
4870 | Â Â Â Â Â ;; |
---|
4871 | Â Â Â Â esac |
---|
4872 | Â Â Â Â ;; |
---|
4873 | Â Â Â *) |
---|
4874 | Â Â Â Â func_fatal_error "unknown suffix for '$my_dlsyms'" |
---|
4875 | Â Â Â Â ;; |
---|
4876 | Â Â Â esac |
---|
4877 | Â Â else |
---|
4878 | Â Â Â # We keep going just in case the user didn't refer to |
---|
4879 |    # lt_preloaded_symbols. The linker will fail if global_symbol_pipe |
---|
4880 | Â Â Â # really was required. |
---|
4881 | |
---|
4882 | Â Â Â # Nullify the symbol file. |
---|
4883 | Â Â Â compile_command=`$ECHOÂ "$compile_command"Â | $SEDÂ "s% @SYMFILE@%%"` |
---|
4884 | Â Â Â finalize_command=`$ECHOÂ "$finalize_command"Â | $SEDÂ "s% @SYMFILE@%%"` |
---|
4885 | Â Â fi |
---|
4886 | } |
---|
4887 | |
---|
4888 | # func_cygming_gnu_implib_p ARG |
---|
4889 | # This predicate returns with zero status (TRUE) if |
---|
4890 | # ARG is a GNU/binutils-style import library. Returns |
---|
4891 | # with nonzero status (FALSE) otherwise. |
---|
4892 | func_cygming_gnu_implib_p () |
---|
4893 | { |
---|
4894 | Â $debug_cmd |
---|
4895 | |
---|
4896 | Â func_to_tool_file "$1"Â func_convert_file_msys_to_w32 |
---|
4897 |  func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` |
---|
4898 |  test -n "$func_cygming_gnu_implib_tmp" |
---|
4899 | } |
---|
4900 | |
---|
4901 | # func_cygming_ms_implib_p ARG |
---|
4902 | # This predicate returns with zero status (TRUE) if |
---|
4903 | # ARG is an MS-style import library. Returns |
---|
4904 | # with nonzero status (FALSE) otherwise. |
---|
4905 | func_cygming_ms_implib_p () |
---|
4906 | { |
---|
4907 | Â $debug_cmd |
---|
4908 | |
---|
4909 | Â func_to_tool_file "$1"Â func_convert_file_msys_to_w32 |
---|
4910 |  func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` |
---|
4911 |  test -n "$func_cygming_ms_implib_tmp" |
---|
4912 | } |
---|
4913 | |
---|
4914 | # func_win32_libid arg |
---|
4915 | # return the library type of file 'arg' |
---|
4916 | # |
---|
4917 | # Need a lot of goo to handle *both* DLLs and import libs |
---|
4918 | # Has to be a shell function in order to 'eat' the argument |
---|
4919 | # that is supplied when $file_magic_command is called. |
---|
4920 | # Despite the name, also deal with 64 bit binaries. |
---|
4921 | func_win32_libid () |
---|
4922 | { |
---|
4923 | Â $debug_cmd |
---|
4924 | |
---|
4925 | Â win32_libid_type=unknown |
---|
4926 | Â win32_fileres=`file -L $1Â 2>/dev/null` |
---|
4927 |  case $win32_fileres in |
---|
4928 | Â *ar\ archive\ import\ library*)Â # definitely import |
---|
4929 | Â Â win32_libid_type="x86 archive import" |
---|
4930 | Â Â ;; |
---|
4931 | Â *ar\ archive*)Â # could be an import, or static |
---|
4932 | Â Â # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. |
---|
4933 |   if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | |
---|
4934 | Â Â Â Â $EGREPÂ 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'Â >/dev/null; then |
---|
4935 |    case $nm_interface in |
---|
4936 | Â Â Â "MS dumpbin") |
---|
4937 | Â Â Â Â if func_cygming_ms_implib_p "$1"Â || |
---|
4938 | Â Â Â Â Â Â func_cygming_gnu_implib_p "$1" |
---|
4939 | Â Â Â Â then |
---|
4940 | Â Â Â Â Â win32_nmres=import |
---|
4941 | Â Â Â Â else |
---|
4942 | Â Â Â Â Â win32_nmres= |
---|
4943 | Â Â Â Â fi |
---|
4944 | Â Â Â Â ;; |
---|
4945 | Â Â Â *) |
---|
4946 | Â Â Â Â func_to_tool_file "$1"Â func_convert_file_msys_to_w32 |
---|
4947 |     win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | |
---|
4948 | Â Â Â Â Â $SEDÂ -n -e ' |
---|
4949 | Â Â Â Â Â Â 1,100{ |
---|
4950 | Â Â Â Â Â Â Â Â / I /{ |
---|
4951 | Â Â Â Â Â Â Â Â Â Â s|.*|import| |
---|
4952 | Â Â Â Â Â Â Â Â Â Â p |
---|
4953 | Â Â Â Â Â Â Â Â Â Â q |
---|
4954 | Â Â Â Â Â Â Â Â } |
---|
4955 | Â Â Â Â Â Â }'` |
---|
4956 | Â Â Â Â ;; |
---|
4957 | Â Â Â esac |
---|
4958 |    case $win32_nmres in |
---|
4959 | Â Â Â import*)Â win32_libid_type="x86 archive import";; |
---|
4960 | Â Â Â *)Â Â Â Â win32_libid_type="x86 archive static";; |
---|
4961 | Â Â Â esac |
---|
4962 | Â Â fi |
---|
4963 | Â Â ;; |
---|
4964 | Â *DLL*) |
---|
4965 | Â Â win32_libid_type="x86 DLL" |
---|
4966 | Â Â ;; |
---|
4967 | Â *executable*)Â # but shell scripts are "executable" too... |
---|
4968 |   case $win32_fileres in |
---|
4969 | Â Â *MS\ Windows\ PE\ Intel*) |
---|
4970 | Â Â Â win32_libid_type="x86 DLL" |
---|
4971 | Â Â Â ;; |
---|
4972 | Â Â esac |
---|
4973 | Â Â ;; |
---|
4974 | Â esac |
---|
4975 | Â $ECHOÂ "$win32_libid_type" |
---|
4976 | } |
---|
4977 | |
---|
4978 | # func_cygming_dll_for_implib ARG |
---|
4979 | # |
---|
4980 | # Platform-specific function to extract the |
---|
4981 | # name of the DLL associated with the specified |
---|
4982 | # import library ARG. |
---|
4983 | # Invoked by eval'ing the libtool variable |
---|
4984 | #Â Â $sharedlib_from_linklib_cmd |
---|
4985 | # Result is available in the variable |
---|
4986 | #Â Â $sharedlib_from_linklib_result |
---|
4987 | func_cygming_dll_for_implib () |
---|
4988 | { |
---|
4989 | Â $debug_cmd |
---|
4990 | |
---|
4991 | Â sharedlib_from_linklib_result=`$DLLTOOLÂ --identify-strict --identify "$1"` |
---|
4992 | } |
---|
4993 | |
---|
4994 | # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs |
---|
4995 | # |
---|
4996 | # The is the core of a fallback implementation of a |
---|
4997 | # platform-specific function to extract the name of the |
---|
4998 | # DLL associated with the specified import library LIBNAME. |
---|
4999 | # |
---|
5000 | # SECTION_NAME is either .idata$6 or .idata$7, depending |
---|
5001 | # on the platform and compiler that created the implib. |
---|
5002 | # |
---|
5003 | # Echos the name of the DLL associated with the |
---|
5004 | # specified import library. |
---|
5005 | func_cygming_dll_for_implib_fallback_core () |
---|
5006 | { |
---|
5007 | Â $debug_cmd |
---|
5008 | |
---|
5009 | Â match_literal=`$ECHOÂ "$1"Â | $SEDÂ "$sed_make_literal_regex"` |
---|
5010 | Â $OBJDUMPÂ -s --section "$1"Â "$2"Â 2>/dev/null | |
---|
5011 | Â Â $SEDÂ '/^Contents of section '"$match_literal"':/{ |
---|
5012 | Â Â Â # Place marker at beginning of archive member dllname section |
---|
5013 | Â Â Â s/.*/====MARK====/ |
---|
5014 | Â Â Â p |
---|
5015 | Â Â Â d |
---|
5016 | Â Â } |
---|
5017 | Â Â # These lines can sometimes be longer than 43 characters, but |
---|
5018 | Â Â # are always uninteresting |
---|
5019 | Â Â /:[Â ]*file format pe[i]\{,1\}-/d |
---|
5020 | Â Â /^In archive [^:]*:/d |
---|
5021 | Â Â # Ensure marker is printed |
---|
5022 | Â Â /^====MARK====/p |
---|
5023 | Â Â # Remove all lines with less than 43 characters |
---|
5024 | Â Â /^.\{43\}/!d |
---|
5025 | Â Â # From remaining lines, remove first 43 characters |
---|
5026 | Â Â s/^.\{43\}//'Â | |
---|
5027 | Â Â $SEDÂ -n ' |
---|
5028 | Â Â Â # Join marker and all lines until next marker into a single line |
---|
5029 | Â Â Â /^====MARK====/ b para |
---|
5030 | Â Â Â H |
---|
5031 | Â Â Â $ b para |
---|
5032 | Â Â Â b |
---|
5033 | Â Â Â :para |
---|
5034 | Â Â Â x |
---|
5035 | Â Â Â s/\n//g |
---|
5036 | Â Â Â # Remove the marker |
---|
5037 | Â Â Â s/^====MARK====// |
---|
5038 | Â Â Â # Remove trailing dots and whitespace |
---|
5039 | Â Â Â s/[\. \t]*$// |
---|
5040 | Â Â Â # Print |
---|
5041 | Â Â Â /./p'Â | |
---|
5042 | Â Â # we now have a list, one entry per line, of the stringified |
---|
5043 | Â Â # contents of the appropriate section of all members of the |
---|
5044 | Â Â # archive that possess that section. Heuristic: eliminate |
---|
5045 | Â Â # all those that have a first or second character that is |
---|
5046 | Â Â # a '.' (that is, objdump's representation of an unprintable |
---|
5047 | Â Â # character.) This should work for all archives with less than |
---|
5048 | Â Â # 0x302f exports -- but will fail for DLLs whose name actually |
---|
5049 | Â Â # begins with a literal '.' or a single character followed by |
---|
5050 | Â Â # a '.'. |
---|
5051 | Â Â # |
---|
5052 | Â Â # Of those that remain, print the first one. |
---|
5053 | Â Â $SEDÂ -e '/^\./d;/^.\./d;q' |
---|
5054 | } |
---|
5055 | |
---|
5056 | # func_cygming_dll_for_implib_fallback ARG |
---|
5057 | # Platform-specific function to extract the |
---|
5058 | # name of the DLL associated with the specified |
---|
5059 | # import library ARG. |
---|
5060 | # |
---|
5061 | # This fallback implementation is for use when $DLLTOOL |
---|
5062 | # does not support the --identify-strict option. |
---|
5063 | # Invoked by eval'ing the libtool variable |
---|
5064 | #Â Â $sharedlib_from_linklib_cmd |
---|
5065 | # Result is available in the variable |
---|
5066 | #Â Â $sharedlib_from_linklib_result |
---|
5067 | func_cygming_dll_for_implib_fallback () |
---|
5068 | { |
---|
5069 | Â $debug_cmd |
---|
5070 | |
---|
5071 | Â if func_cygming_gnu_implib_p "$1"; then |
---|
5072 | Â Â # binutils import library |
---|
5073 | Â Â sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7'Â "$1"` |
---|
5074 | Â elif func_cygming_ms_implib_p "$1"; then |
---|
5075 | Â Â # ms-generated import library |
---|
5076 | Â Â sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6'Â "$1"` |
---|
5077 | Â else |
---|
5078 | Â Â # unknown |
---|
5079 | Â Â sharedlib_from_linklib_result= |
---|
5080 | Â fi |
---|
5081 | } |
---|
5082 | |
---|
5083 | |
---|
5084 | # func_extract_an_archive dir oldlib |
---|
5085 | func_extract_an_archive () |
---|
5086 | { |
---|
5087 | Â Â $debug_cmd |
---|
5088 | |
---|
5089 | Â Â f_ex_an_ar_dir=$1; shift |
---|
5090 | Â Â f_ex_an_ar_oldlib=$1 |
---|
5091 |   if test yes = "$lock_old_archive_extraction"; then |
---|
5092 | Â Â Â lockfile=$f_ex_an_ar_oldlib.lock |
---|
5093 |    until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do |
---|
5094 | Â Â Â Â func_echo "Waiting for $lockfile to be removed" |
---|
5095 | Â Â Â Â sleep 2 |
---|
5096 | Â Â Â done |
---|
5097 | Â Â fi |
---|
5098 | Â Â func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")"Â \ |
---|
5099 | Â Â Â Â Â Â Â Â Â Â 'stat=$?; rm -f "$lockfile"; exit $stat' |
---|
5100 |   if test yes = "$lock_old_archive_extraction"; then |
---|
5101 |    $opt_dry_run || rm -f "$lockfile" |
---|
5102 | Â Â fi |
---|
5103 |   if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then |
---|
5104 | Â Â Â : |
---|
5105 | Â Â else |
---|
5106 | Â Â Â func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" |
---|
5107 | Â Â fi |
---|
5108 | } |
---|
5109 | |
---|
5110 | |
---|
5111 | # func_extract_archives gentop oldlib ... |
---|
5112 | func_extract_archives () |
---|
5113 | { |
---|
5114 | Â Â $debug_cmd |
---|
5115 | |
---|
5116 | Â Â my_gentop=$1; shift |
---|
5117 | Â Â my_oldlibs=${1+"$@"} |
---|
5118 | Â Â my_oldobjs= |
---|
5119 | Â Â my_xlib= |
---|
5120 | Â Â my_xabs= |
---|
5121 | Â Â my_xdir= |
---|
5122 | |
---|
5123 | Â Â for my_xlib in $my_oldlibs; do |
---|
5124 | Â Â Â # Extract the objects. |
---|
5125 |    case $my_xlib in |
---|
5126 |     [\\/]* | [A-Za-z]:[\\/]*) my_xabs=$my_xlib ;; |
---|
5127 | Â Â Â Â *)Â my_xabs=`pwd`"/$my_xlib"Â ;; |
---|
5128 | Â Â Â esac |
---|
5129 | Â Â Â func_basename "$my_xlib" |
---|
5130 | Â Â Â my_xlib=$func_basename_result |
---|
5131 | Â Â Â my_xlib_u=$my_xlib |
---|
5132 |    while :; do |
---|
5133 |     case " $extracted_archives " in |
---|
5134 | Â Â Â Â *" $my_xlib_u "*) |
---|
5135 |      func_arith $extracted_serial + 1 |
---|
5136 | Â Â Â Â Â extracted_serial=$func_arith_result |
---|
5137 |      my_xlib_u=lt$extracted_serial-$my_xlib ;; |
---|
5138 |     *) break ;; |
---|
5139 | Â Â Â Â esac |
---|
5140 | Â Â Â done |
---|
5141 | Â Â Â extracted_archives="$extracted_archives $my_xlib_u" |
---|
5142 | Â Â Â my_xdir=$my_gentop/$my_xlib_u |
---|
5143 | |
---|
5144 | Â Â Â func_mkdir_p "$my_xdir" |
---|
5145 | |
---|
5146 |    case $host in |
---|
5147 | Â Â Â *-darwin*) |
---|
5148 | Â Â Â Â func_verbose "Extracting $my_xabs" |
---|
5149 | Â Â Â Â # Do not bother doing anything if just a dry run |
---|
5150 |     $opt_dry_run || { |
---|
5151 | Â Â Â Â Â darwin_orig_dir=`pwd` |
---|
5152 |      cd $my_xdir || exit $? |
---|
5153 | Â Â Â Â Â darwin_archive=$my_xabs |
---|
5154 | Â Â Â Â Â darwin_curdir=`pwd` |
---|
5155 | Â Â Â Â Â func_basename "$darwin_archive" |
---|
5156 | Â Â Â Â Â darwin_base_archive=$func_basename_result |
---|
5157 | Â Â Â Â Â darwin_arches=`$LIPOÂ -info "$darwin_archive"Â 2>/dev/null | $GREPÂ Architectures 2>/dev/null ||Â true` |
---|
5158 |      if test -n "$darwin_arches"; then |
---|
5159 | Â Â Â Â Â Â darwin_arches=`$ECHOÂ "$darwin_arches"Â | $SEDÂ -e 's/.*are://'` |
---|
5160 | Â Â Â Â Â Â darwin_arch= |
---|
5161 | Â Â Â Â Â Â func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" |
---|
5162 |       for darwin_arch in $darwin_arches; do |
---|
5163 | Â Â Â Â Â Â Â func_mkdir_p "unfat-$$/$darwin_base_archive-$darwin_arch" |
---|
5164 |        $LIPO -thin $darwin_arch -output "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" "$darwin_archive" |
---|
5165 |        cd "unfat-$$/$darwin_base_archive-$darwin_arch" |
---|
5166 | Â Â Â Â Â Â Â func_extract_an_archive "`pwd`"Â "$darwin_base_archive" |
---|
5167 |        cd "$darwin_curdir" |
---|
5168 | Â Â Â Â Â Â Â $RMÂ "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" |
---|
5169 |       done # $darwin_arches |
---|
5170 | Â Â Â Â Â Â ## Okay now we've a bunch of thin objects, gotta fatten them up :) |
---|
5171 | Â Â Â Â Â Â darwin_filelist=`find unfat-$$Â -type f -name \*.o -print -o -name \*.lo -print | $SEDÂ -e "$sed_basename"Â | sort -u` |
---|
5172 | Â Â Â Â Â Â darwin_file= |
---|
5173 | Â Â Â Â Â Â darwin_files= |
---|
5174 | Â Â Â Â Â Â for darwin_file in $darwin_filelist; do |
---|
5175 |        darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` |
---|
5176 | Â Â Â Â Â Â Â $LIPOÂ -create -output "$darwin_file"Â $darwin_files |
---|
5177 |       done # $darwin_filelist |
---|
5178 | Â Â Â Â Â Â $RMÂ -rf unfat-$$ |
---|
5179 |       cd "$darwin_orig_dir" |
---|
5180 | Â Â Â Â Â else |
---|
5181 |       cd $darwin_orig_dir |
---|
5182 | Â Â Â Â Â Â func_extract_an_archive "$my_xdir"Â "$my_xabs" |
---|
5183 |      fi # $darwin_arches |
---|
5184 | Â Â Â Â }Â # !$opt_dry_run |
---|
5185 | Â Â Â Â ;; |
---|
5186 | Â Â Â *) |
---|
5187 | Â Â Â Â func_extract_an_archive "$my_xdir"Â "$my_xabs" |
---|
5188 | Â Â Â Â ;; |
---|
5189 | Â Â Â esac |
---|
5190 |    my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` |
---|
5191 | Â Â done |
---|
5192 | |
---|
5193 | Â Â func_extract_archives_result=$my_oldobjs |
---|
5194 | } |
---|
5195 | |
---|
5196 | |
---|
5197 | # func_emit_wrapper [arg=no] |
---|
5198 | # |
---|
5199 | # Emit a libtool wrapper script on stdout. |
---|
5200 | # Don't directly open a file because we may want to |
---|
5201 | # incorporate the script contents within a cygwin/mingw |
---|
5202 | # wrapper executable. Must ONLY be called from within |
---|
5203 | # func_mode_link because it depends on a number of variables |
---|
5204 | # set therein. |
---|
5205 | # |
---|
5206 | # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR |
---|
5207 | # variable will take. If 'yes', then the emitted script |
---|
5208 | # will assume that the directory where it is stored is |
---|
5209 | # the $objdir directory. This is a cygwin/mingw-specific |
---|
5210 | # behavior. |
---|
5211 | func_emit_wrapper () |
---|
5212 | { |
---|
5213 | Â Â Â Â func_emit_wrapper_arg1=${1-no} |
---|
5214 | |
---|
5215 | Â Â Â Â $ECHOÂ "\ |
---|
5216 | #! $SHELL |
---|
5217 | |
---|
5218 | # $output - temporary wrapper script for $objdir/$outputname |
---|
5219 | # Generated by $PROGRAM (GNU $PACKAGE) $VERSION |
---|
5220 | # |
---|
5221 | # The $output program cannot be directly executed until all the libtool |
---|
5222 | # libraries that it depends on are installed. |
---|
5223 | # |
---|
5224 | # This wrapper script should never be moved out of the build directory. |
---|
5225 | # If it is, it will not operate correctly. |
---|
5226 | |
---|
5227 | # Sed substitution that helps us do robust quoting. It backslashifies |
---|
5228 | # metacharacters that are still active within double-quoted strings. |
---|
5229 | sed_quote_subst='$sed_quote_subst' |
---|
5230 | |
---|
5231 | # Be Bourne compatible |
---|
5232 | if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then |
---|
5233 | Â emulate sh |
---|
5234 | Â NULLCMD=: |
---|
5235 | Â # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which |
---|
5236 |  # is contrary to our usage. Disable this feature. |
---|
5237 | Â alias -g '\${1+\"\$@\"}'='\"\$@\"' |
---|
5238 | Â setopt NO_GLOB_SUBST |
---|
5239 | else |
---|
5240 | Â case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac |
---|
5241 | fi |
---|
5242 | BIN_SH=xpg4; export BIN_SH # for Tru64 |
---|
5243 | DUALCASE=1; export DUALCASE # for MKS sh |
---|
5244 | |
---|
5245 | # The HP-UX ksh and POSIX shell print the target directory to stdout |
---|
5246 | # if CDPATH is set. |
---|
5247 | (unset CDPATH) >/dev/null 2>&1 && unset CDPATH |
---|
5248 | |
---|
5249 | relink_command=\"$relink_command\" |
---|
5250 | |
---|
5251 | # This environment variable determines our operation mode. |
---|
5252 | if test \"\$libtool_install_magic\" = \"$magic\"; then |
---|
5253 | Â # install mode needs the following variables: |
---|
5254 | Â generated_by_libtool_version='$macro_version' |
---|
5255 | Â notinst_deplibs='$notinst_deplibs' |
---|
5256 | else |
---|
5257 | Â # When we are sourced in execute mode, \$file and \$ECHO are already set. |
---|
5258 | Â if test \"\$libtool_execute_magic\" != \"$magic\"; then |
---|
5259 | Â Â file=\"\$0\"" |
---|
5260 | |
---|
5261 | Â Â qECHO=`$ECHOÂ "$ECHO"Â | $SEDÂ "$sed_quote_subst"` |
---|
5262 | Â Â $ECHOÂ "\ |
---|
5263 | |
---|
5264 | # A function that is used when there is no print builtin or printf. |
---|
5265 | func_fallback_echo () |
---|
5266 | { |
---|
5267 | Â eval 'cat <<_LTECHO_EOF |
---|
5268 | \$1 |
---|
5269 | _LTECHO_EOF' |
---|
5270 | } |
---|
5271 | Â Â ECHO=\"$qECHO\" |
---|
5272 | Â fi |
---|
5273 | |
---|
5274 | # Very basic option parsing. These options are (a) specific to |
---|
5275 | # the libtool wrapper, (b) are identical between the wrapper |
---|
5276 | # /script/ and the wrapper /executable/ that is used only on |
---|
5277 | # windows platforms, and (c) all begin with the string "--lt-" |
---|
5278 | # (application programs are unlikely to have options that match |
---|
5279 | # this pattern). |
---|
5280 | # |
---|
5281 | # There are only two supported options: --lt-debug and |
---|
5282 | # --lt-dump-script. There is, deliberately, no --lt-help. |
---|
5283 | # |
---|
5284 | # The first argument to this parsing function should be the |
---|
5285 | # script's $0 value, followed by "$@". |
---|
5286 | lt_option_debug= |
---|
5287 | func_parse_lt_options () |
---|
5288 | { |
---|
5289 | Â lt_script_arg0=\$0 |
---|
5290 | Â shift |
---|
5291 | Â for lt_opt |
---|
5292 | Â do |
---|
5293 | Â Â case \"\$lt_opt\" in |
---|
5294 | Â Â --lt-debug) lt_option_debug=1 ;; |
---|
5295 | Â Â --lt-dump-script) |
---|
5296 | Â Â Â Â lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` |
---|
5297 | Â Â Â Â test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. |
---|
5298 | Â Â Â Â lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` |
---|
5299 | Â Â Â Â cat \"\$lt_dump_D/\$lt_dump_F\" |
---|
5300 | Â Â Â Â exit 0 |
---|
5301 | Â Â Â ;; |
---|
5302 | Â Â --lt-*) |
---|
5303 | Â Â Â Â \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 |
---|
5304 | Â Â Â Â exit 1 |
---|
5305 | Â Â Â ;; |
---|
5306 | Â Â esac |
---|
5307 | Â done |
---|
5308 | |
---|
5309 | Â # Print the debug banner immediately: |
---|
5310 | Â if test -n \"\$lt_option_debug\"; then |
---|
5311 | Â Â echo \"$outputname:$output:\$LINENO: libtool wrapper (GNU $PACKAGE) $VERSION\" 1>&2 |
---|
5312 | Â fi |
---|
5313 | } |
---|
5314 | |
---|
5315 | # Used when --lt-debug. Prints its arguments to stdout |
---|
5316 | # (redirection is the responsibility of the caller) |
---|
5317 | func_lt_dump_args () |
---|
5318 | { |
---|
5319 | Â lt_dump_args_N=1; |
---|
5320 | Â for lt_arg |
---|
5321 | Â do |
---|
5322 | Â Â \$ECHO \"$outputname:$output:\$LINENO: newargv[\$lt_dump_args_N]: \$lt_arg\" |
---|
5323 | Â Â lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` |
---|
5324 | Â done |
---|
5325 | } |
---|
5326 | |
---|
5327 | # Core function for launching the target application |
---|
5328 | func_exec_program_core () |
---|
5329 | { |
---|
5330 | " |
---|
5331 |  case $host in |
---|
5332 | Â # Backslashes separate directories on plain windows |
---|
5333 | Â *-*-mingw | *-*-os2* | *-cegcc*) |
---|
5334 | Â Â $ECHOÂ "\ |
---|
5335 | Â Â Â if test -n \"\$lt_option_debug\"; then |
---|
5336 | Â Â Â Â \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir\\\\\$program\" 1>&2 |
---|
5337 | Â Â Â Â func_lt_dump_args \${1+\"\$@\"} 1>&2 |
---|
5338 | Â Â Â fi |
---|
5339 | Â Â Â exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} |
---|
5340 | " |
---|
5341 | Â Â ;; |
---|
5342 | |
---|
5343 | Â *) |
---|
5344 | Â Â $ECHOÂ "\ |
---|
5345 | Â Â Â if test -n \"\$lt_option_debug\"; then |
---|
5346 | Â Â Â Â \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir/\$program\" 1>&2 |
---|
5347 | Â Â Â Â func_lt_dump_args \${1+\"\$@\"} 1>&2 |
---|
5348 | Â Â Â fi |
---|
5349 | Â Â Â exec \"\$progdir/\$program\" \${1+\"\$@\"} |
---|
5350 | " |
---|
5351 | Â Â ;; |
---|
5352 | Â esac |
---|
5353 | Â $ECHOÂ "\ |
---|
5354 | Â Â Â \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 |
---|
5355 | Â Â Â exit 1 |
---|
5356 | } |
---|
5357 | |
---|
5358 | # A function to encapsulate launching the target application |
---|
5359 | # Strips options in the --lt-* namespace from \$@ and |
---|
5360 | # launches target application with the remaining arguments. |
---|
5361 | func_exec_program () |
---|
5362 | { |
---|
5363 | Â case \" \$* \" in |
---|
5364 | Â *\\ --lt-*) |
---|
5365 | Â Â for lt_wr_arg |
---|
5366 | Â Â do |
---|
5367 | Â Â Â case \$lt_wr_arg in |
---|
5368 | Â Â Â --lt-*) ;; |
---|
5369 | Â Â Â *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; |
---|
5370 | Â Â Â esac |
---|
5371 | Â Â Â shift |
---|
5372 | Â Â done ;; |
---|
5373 | Â esac |
---|
5374 | Â func_exec_program_core \${1+\"\$@\"} |
---|
5375 | } |
---|
5376 | |
---|
5377 | Â # Parse options |
---|
5378 | Â func_parse_lt_options \"\$0\" \${1+\"\$@\"} |
---|
5379 | |
---|
5380 | Â # Find the directory that this script lives in. |
---|
5381 | Â thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` |
---|
5382 | Â test \"x\$thisdir\" = \"x\$file\" && thisdir=. |
---|
5383 | |
---|
5384 | Â # Follow symbolic links until we get to the real thisdir. |
---|
5385 | Â file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` |
---|
5386 | Â while test -n \"\$file\"; do |
---|
5387 | Â Â destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` |
---|
5388 | |
---|
5389 | Â Â # If there was a directory component, then change thisdir. |
---|
5390 | Â Â if test \"x\$destdir\" != \"x\$file\"; then |
---|
5391 | Â Â Â case \"\$destdir\" in |
---|
5392 | Â Â Â [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; |
---|
5393 | Â Â Â *) thisdir=\"\$thisdir/\$destdir\" ;; |
---|
5394 | Â Â Â esac |
---|
5395 | Â Â fi |
---|
5396 | |
---|
5397 | Â Â file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` |
---|
5398 | Â Â file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` |
---|
5399 | Â done |
---|
5400 | |
---|
5401 | Â # Usually 'no', except on cygwin/mingw when embedded into |
---|
5402 | Â # the cwrapper. |
---|
5403 | Â WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 |
---|
5404 | Â if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then |
---|
5405 | Â Â # special case for '.' |
---|
5406 | Â Â if test \"\$thisdir\" = \".\"; then |
---|
5407 | Â Â Â thisdir=\`pwd\` |
---|
5408 | Â Â fi |
---|
5409 | Â Â # remove .libs from thisdir |
---|
5410 | Â Â case \"\$thisdir\" in |
---|
5411 | Â Â *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; |
---|
5412 | Â Â $objdir )Â Â thisdir=. ;; |
---|
5413 | Â Â esac |
---|
5414 | Â fi |
---|
5415 | |
---|
5416 | Â # Try to get the absolute directory name. |
---|
5417 | Â absdir=\`cd \"\$thisdir\" && pwd\` |
---|
5418 | Â test -n \"\$absdir\" && thisdir=\"\$absdir\" |
---|
5419 | " |
---|
5420 | |
---|
5421 |     if test yes = "$fast_install"; then |
---|
5422 | Â Â Â Â Â $ECHOÂ "\ |
---|
5423 | Â program=lt-'$outputname'$exeext |
---|
5424 | Â progdir=\"\$thisdir/$objdir\" |
---|
5425 | |
---|
5426 | Â if test ! -f \"\$progdir/\$program\" || |
---|
5427 | Â Â Â { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | $SED 1q\`; \\ |
---|
5428 | Â Â Â Â test \"X\$file\" != \"X\$progdir/\$program\"; }; then |
---|
5429 | |
---|
5430 | Â Â file=\"\$\$-\$program\" |
---|
5431 | |
---|
5432 | Â Â if test ! -d \"\$progdir\"; then |
---|
5433 | Â Â Â $MKDIR \"\$progdir\" |
---|
5434 | Â Â else |
---|
5435 | Â Â Â $RM \"\$progdir/\$file\" |
---|
5436 | Â Â fi" |
---|
5437 | |
---|
5438 | Â Â Â Â Â $ECHOÂ "\ |
---|
5439 | |
---|
5440 | Â Â # relink executable if necessary |
---|
5441 | Â Â if test -n \"\$relink_command\"; then |
---|
5442 | Â Â Â if relink_command_output=\`eval \$relink_command 2>&1\`; then : |
---|
5443 | Â Â Â else |
---|
5444 | Â Â Â Â \$ECHO \"\$relink_command_output\" >&2 |
---|
5445 | Â Â Â Â $RM \"\$progdir/\$file\" |
---|
5446 | Â Â Â Â exit 1 |
---|
5447 | Â Â Â fi |
---|
5448 | Â Â fi |
---|
5449 | |
---|
5450 | Â Â $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || |
---|
5451 | Â Â { $RM \"\$progdir/\$program\"; |
---|
5452 | Â Â Â $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } |
---|
5453 | Â Â $RM \"\$progdir/\$file\" |
---|
5454 | Â fi" |
---|
5455 | Â Â Â Â else |
---|
5456 | Â Â Â Â Â $ECHOÂ "\ |
---|
5457 | Â program='$outputname' |
---|
5458 | Â progdir=\"\$thisdir/$objdir\" |
---|
5459 | " |
---|
5460 | Â Â Â Â fi |
---|
5461 | |
---|
5462 | Â Â Â Â $ECHOÂ "\ |
---|
5463 | |
---|
5464 | Â if test -f \"\$progdir/\$program\"; then" |
---|
5465 | |
---|
5466 | Â Â Â Â # fixup the dll searchpath if we need to. |
---|
5467 | Â Â Â Â # |
---|
5468 |     # Fix the DLL searchpath if we need to. Do this before prepending |
---|
5469 | Â Â Â Â # to shlibpath, because on Windows, both are PATH and uninstalled |
---|
5470 | Â Â Â Â # libraries must come first. |
---|
5471 |     if test -n "$dllsearchpath"; then |
---|
5472 | Â Â Â Â Â $ECHOÂ "\ |
---|
5473 | Â Â # Add the dll search path components to the executable PATH |
---|
5474 | Â Â PATH=$dllsearchpath:\$PATH |
---|
5475 | " |
---|
5476 | Â Â Â Â fi |
---|
5477 | |
---|
5478 | Â Â Â Â # Export our shlibpath_var if we have one. |
---|
5479 |     if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then |
---|
5480 | Â Â Â Â Â $ECHOÂ "\ |
---|
5481 | Â Â # Add our own library path to $shlibpath_var |
---|
5482 | Â Â $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" |
---|
5483 | |
---|
5484 | Â Â # Some systems cannot cope with colon-terminated $shlibpath_var |
---|
5485 | Â Â # The second colon is a workaround for a bug in BeOS R4 sed |
---|
5486 | Â Â $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` |
---|
5487 | |
---|
5488 | Â Â export $shlibpath_var |
---|
5489 | " |
---|
5490 | Â Â Â Â fi |
---|
5491 | |
---|
5492 | Â Â Â Â $ECHOÂ "\ |
---|
5493 | Â Â if test \"\$libtool_execute_magic\" != \"$magic\"; then |
---|
5494 | Â Â Â # Run the actual program with our arguments. |
---|
5495 | Â Â Â func_exec_program \${1+\"\$@\"} |
---|
5496 | Â Â fi |
---|
5497 | Â else |
---|
5498 | Â Â # The program doesn't exist. |
---|
5499 | Â Â \$ECHO \"\$0: error: '\$progdir/\$program' does not exist\" 1>&2 |
---|
5500 | Â Â \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 |
---|
5501 | Â Â \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 |
---|
5502 | Â Â exit 1 |
---|
5503 | Â fi |
---|
5504 | fi\ |
---|
5505 | " |
---|
5506 | } |
---|
5507 | |
---|
5508 | |
---|
5509 | # func_emit_cwrapperexe_src |
---|
5510 | # emit the source code for a wrapper executable on stdout |
---|
5511 | # Must ONLY be called from within func_mode_link because |
---|
5512 | # it depends on a number of variable set therein. |
---|
5513 | func_emit_cwrapperexe_src () |
---|
5514 | { |
---|
5515 | Â Â Â Â cat <<EOF |
---|
5516 | |
---|
5517 | /* $cwrappersource - temporary wrapper executable for $objdir/$outputname |
---|
5518 | Â Â Generated by $PROGRAM (GNU $PACKAGE) $VERSION |
---|
5519 | |
---|
5520 | Â Â The $output program cannot be directly executed until all the libtool |
---|
5521 | Â Â libraries that it depends on are installed. |
---|
5522 | |
---|
5523 | Â Â This wrapper executable should never be moved out of the build directory. |
---|
5524 | Â Â If it is, it will not operate correctly. |
---|
5525 | */ |
---|
5526 | EOF |
---|
5527 | Â Â Â Â Â Â cat <<"EOF" |
---|
5528 | #ifdef _MSC_VER |
---|
5529 | # define _CRT_SECURE_NO_DEPRECATE 1 |
---|
5530 | #endif |
---|
5531 | #include <stdio.h> |
---|
5532 | #include <stdlib.h> |
---|
5533 | #ifdef _MSC_VER |
---|
5534 | # include <direct.h> |
---|
5535 | # include <process.h> |
---|
5536 | # include <io.h> |
---|
5537 | #else |
---|
5538 | # include <unistd.h> |
---|
5539 | # include <stdint.h> |
---|
5540 | # ifdef __CYGWIN__ |
---|
5541 | #Â include <io.h> |
---|
5542 | # endif |
---|
5543 | #endif |
---|
5544 | #include <malloc.h> |
---|
5545 | #include <stdarg.h> |
---|
5546 | #include <assert.h> |
---|
5547 | #include <string.h> |
---|
5548 | #include <ctype.h> |
---|
5549 | #include <errno.h> |
---|
5550 | #include <fcntl.h> |
---|
5551 | #include <sys/stat.h> |
---|
5552 | |
---|
5553 | #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0) |
---|
5554 | |
---|
5555 | /* declarations of non-ANSI functions */ |
---|
5556 | #if defined __MINGW32__ |
---|
5557 | # ifdef __STRICT_ANSI__ |
---|
5558 | int _putenv (const char *); |
---|
5559 | # endif |
---|
5560 | #elif defined __CYGWIN__ |
---|
5561 | # ifdef __STRICT_ANSI__ |
---|
5562 | char *realpath (const char *, char *); |
---|
5563 | int putenv (char *); |
---|
5564 | int setenv (const char *, const char *, int); |
---|
5565 | # endif |
---|
5566 | /* #elif defined other_platform || defined ... */ |
---|
5567 | #endif |
---|
5568 | |
---|
5569 | /* portability defines, excluding path handling macros */ |
---|
5570 | #if defined _MSC_VER |
---|
5571 | # define setmode _setmode |
---|
5572 | # define stat  _stat |
---|
5573 | # define chmod  _chmod |
---|
5574 | # define getcwd _getcwd |
---|
5575 | # define putenv _putenv |
---|
5576 | # define S_IXUSR _S_IEXEC |
---|
5577 | #elif defined __MINGW32__ |
---|
5578 | # define setmode _setmode |
---|
5579 | # define stat  _stat |
---|
5580 | # define chmod  _chmod |
---|
5581 | # define getcwd _getcwd |
---|
5582 | # define putenv _putenv |
---|
5583 | #elif defined __CYGWIN__ |
---|
5584 | # define HAVE_SETENV |
---|
5585 | # define FOPEN_WB "wb" |
---|
5586 | /* #elif defined other platforms ... */ |
---|
5587 | #endif |
---|
5588 | |
---|
5589 | #if defined PATH_MAX |
---|
5590 | # define LT_PATHMAX PATH_MAX |
---|
5591 | #elif defined MAXPATHLEN |
---|
5592 | # define LT_PATHMAX MAXPATHLEN |
---|
5593 | #else |
---|
5594 | # define LT_PATHMAX 1024 |
---|
5595 | #endif |
---|
5596 | |
---|
5597 | #ifndef S_IXOTH |
---|
5598 | # define S_IXOTH 0 |
---|
5599 | #endif |
---|
5600 | #ifndef S_IXGRP |
---|
5601 | # define S_IXGRP 0 |
---|
5602 | #endif |
---|
5603 | |
---|
5604 | /* path handling portability macros */ |
---|
5605 | #ifndef DIR_SEPARATOR |
---|
5606 | # define DIR_SEPARATOR '/' |
---|
5607 | # define PATH_SEPARATOR ':' |
---|
5608 | #endif |
---|
5609 | |
---|
5610 | #if defined _WIN32 || defined __MSDOS__ || defined __DJGPP__ || \ |
---|
5611 | Â defined __OS2__ |
---|
5612 | # define HAVE_DOS_BASED_FILE_SYSTEM |
---|
5613 | # define FOPEN_WB "wb" |
---|
5614 | # ifndef DIR_SEPARATOR_2 |
---|
5615 | #Â define DIR_SEPARATOR_2 '\\' |
---|
5616 | # endif |
---|
5617 | # ifndef PATH_SEPARATOR_2 |
---|
5618 | #Â define PATH_SEPARATOR_2 ';' |
---|
5619 | # endif |
---|
5620 | #endif |
---|
5621 | |
---|
5622 | #ifndef DIR_SEPARATOR_2 |
---|
5623 | # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) |
---|
5624 | #else /* DIR_SEPARATOR_2 */ |
---|
5625 | # define IS_DIR_SEPARATOR(ch) \ |
---|
5626 | Â Â Â Â (((ch)Â ==Â DIR_SEPARATOR)Â ||Â ((ch)Â ==Â DIR_SEPARATOR_2)) |
---|
5627 | #endif /* DIR_SEPARATOR_2 */ |
---|
5628 | |
---|
5629 | #ifndef PATH_SEPARATOR_2 |
---|
5630 | # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) |
---|
5631 | #else /* PATH_SEPARATOR_2 */ |
---|
5632 | # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) |
---|
5633 | #endif /* PATH_SEPARATOR_2 */ |
---|
5634 | |
---|
5635 | #ifndef FOPEN_WB |
---|
5636 | # define FOPEN_WB "w" |
---|
5637 | #endif |
---|
5638 | #ifndef _O_BINARY |
---|
5639 | # define _O_BINARY 0 |
---|
5640 | #endif |
---|
5641 | |
---|
5642 | #define XMALLOC(type, num)Â Â Â ((type *) xmalloc ((num) * sizeof(type))) |
---|
5643 | #define XFREE(stale) do { \ |
---|
5644 |  if (stale) { free (stale); stale = 0; } \ |
---|
5645 | } while (0) |
---|
5646 | |
---|
5647 | #if defined LT_DEBUGWRAPPER |
---|
5648 | static int lt_debug = 1; |
---|
5649 | #else |
---|
5650 | static int lt_debug = 0; |
---|
5651 | #endif |
---|
5652 | |
---|
5653 | const char *program_name =Â "libtool-wrapper"; /* in case xstrdup fails */ |
---|
5654 | |
---|
5655 | void *xmalloc (size_t num); |
---|
5656 | char *xstrdup (const char *string); |
---|
5657 | const char *base_name (const char *name); |
---|
5658 | char *find_executable (const char *wrapper); |
---|
5659 | char *chase_symlinks (const char *pathspec); |
---|
5660 | int make_executable (const char *path); |
---|
5661 | int check_executable (const char *path); |
---|
5662 | char *strendzap (char *str, const char *pat); |
---|
5663 | void lt_debugprintf (const char *file, int line, const char *fmt, ...); |
---|
5664 | void lt_fatal (const char *file, int line, const char *message, ...); |
---|
5665 | static const char *nonnull (const char *s); |
---|
5666 | static const char *nonempty (const char *s); |
---|
5667 | void lt_setenv (const char *name, const char *value); |
---|
5668 | char *lt_extend_str (const char *orig_value, const char *add, int to_end); |
---|
5669 | void lt_update_exe_path (const char *name, const char *value); |
---|
5670 | void lt_update_lib_path (const char *name, const char *value); |
---|
5671 | char **prepare_spawn (char **argv); |
---|
5672 | void lt_dump_script (FILE *f); |
---|
5673 | EOF |
---|
5674 | |
---|
5675 | Â Â Â Â Â Â cat <<EOF |
---|
5676 | #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5) |
---|
5677 | # define externally_visible volatile |
---|
5678 | #else |
---|
5679 | # define externally_visible __attribute__((externally_visible)) volatile |
---|
5680 | #endif |
---|
5681 | externally_visible const char * MAGIC_EXE = "$magic_exe"; |
---|
5682 | const char * LIB_PATH_VARNAME = "$shlibpath_var"; |
---|
5683 | EOF |
---|
5684 | |
---|
5685 |       if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then |
---|
5686 | Â Â Â Â Â Â Â func_to_host_path "$temp_rpath" |
---|
5687 | Â Â Â Â Â Â Â cat <<EOF |
---|
5688 | const char * LIB_PATH_VALUEÂ Â = "$func_to_host_path_result"; |
---|
5689 | EOF |
---|
5690 | Â Â Â Â Â Â else |
---|
5691 | Â Â Â Â Â Â Â cat <<"EOF" |
---|
5692 | const char * LIB_PATH_VALUEÂ Â =Â ""; |
---|
5693 | EOF |
---|
5694 | Â Â Â Â Â Â fi |
---|
5695 | |
---|
5696 |       if test -n "$dllsearchpath"; then |
---|
5697 | Â Â Â Â Â Â Â func_to_host_path "$dllsearchpath:" |
---|
5698 | Â Â Â Â Â Â Â cat <<EOF |
---|
5699 | const char * EXE_PATH_VARNAME = "PATH"; |
---|
5700 | const char * EXE_PATH_VALUEÂ Â = "$func_to_host_path_result"; |
---|
5701 | EOF |
---|
5702 | Â Â Â Â Â Â else |
---|
5703 | Â Â Â Â Â Â Â cat <<"EOF" |
---|
5704 | const char * EXE_PATH_VARNAMEÂ =Â ""; |
---|
5705 | const char * EXE_PATH_VALUEÂ Â =Â ""; |
---|
5706 | EOF |
---|
5707 | Â Â Â Â Â Â fi |
---|
5708 | |
---|
5709 |       if test yes = "$fast_install"; then |
---|
5710 | Â Â Â Â Â Â Â cat <<EOF |
---|
5711 | const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */ |
---|
5712 | EOF |
---|
5713 | Â Â Â Â Â Â else |
---|
5714 | Â Â Â Â Â Â Â cat <<EOF |
---|
5715 | const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */ |
---|
5716 | EOF |
---|
5717 | Â Â Â Â Â Â fi |
---|
5718 | |
---|
5719 | |
---|
5720 | Â Â Â Â Â Â cat <<"EOF" |
---|
5721 | |
---|
5722 | #define LTWRAPPER_OPTION_PREFIXÂ Â Â Â Â "--lt-" |
---|
5723 | |
---|
5724 | static const char *ltwrapper_option_prefix =Â LTWRAPPER_OPTION_PREFIX; |
---|
5725 | static const char *dumpscript_opt    = LTWRAPPER_OPTION_PREFIX "dump-script"; |
---|
5726 | static const char *debug_opt      = LTWRAPPER_OPTION_PREFIX "debug"; |
---|
5727 | |
---|
5728 | int |
---|
5729 | main (int argc, char *argv[]) |
---|
5730 | { |
---|
5731 | Â char **newargz; |
---|
5732 |  int newargc; |
---|
5733 | Â char *tmp_pathspec; |
---|
5734 | Â char *actual_cwrapper_path; |
---|
5735 | Â char *actual_cwrapper_name; |
---|
5736 | Â char *target_name; |
---|
5737 | Â char *lt_argv_zero; |
---|
5738 |  int rval = 127; |
---|
5739 | |
---|
5740 | Â int i; |
---|
5741 | |
---|
5742 |  program_name = (char *) xstrdup (base_name (argv[0])); |
---|
5743 |  newargz = XMALLOC (char *, (size_t) argc + 1); |
---|
5744 | |
---|
5745 | Â /* very simple arg parsing; don't want to rely on getopt |
---|
5746 | Â Â * also, copy all non cwrapper options to newargz, except |
---|
5747 | Â Â * argz[0], which is handled differently |
---|
5748 | Â Â */ |
---|
5749 | Â newargc=0; |
---|
5750 | Â for (i = 1; i < argc; i++) |
---|
5751 | Â Â { |
---|
5752 | Â Â Â if (STREQ (argv[i], dumpscript_opt)) |
---|
5753 | Â Â Â Â { |
---|
5754 | EOF |
---|
5755 | Â Â Â Â Â Â case $host in |
---|
5756 | Â Â Â Â Â Â Â *mingw* | *cygwin* ) |
---|
5757 | Â Â Â Â Â Â Â Â # make stdout use "unix" line endings |
---|
5758 | Â Â Â Â Â Â Â Â echo "Â Â Â Â Â setmode(1,_O_BINARY);" |
---|
5759 | Â Â Â Â Â Â Â Â ;; |
---|
5760 | Â Â Â Â Â Â Â esac |
---|
5761 | |
---|
5762 | Â Â Â Â Â Â cat <<"EOF" |
---|
5763 | Â Â Â Â Â lt_dump_script (stdout); |
---|
5764 | Â Â Â Â Â return 0; |
---|
5765 | Â Â Â Â } |
---|
5766 | Â Â Â if (STREQ (argv[i], debug_opt)) |
---|
5767 | Â Â Â Â { |
---|
5768 | Â Â Â Â Â lt_debug = 1; |
---|
5769 | Â Â Â Â Â continue; |
---|
5770 | Â Â Â Â } |
---|
5771 | Â Â Â if (STREQ (argv[i], ltwrapper_option_prefix)) |
---|
5772 | Â Â Â Â { |
---|
5773 | Â Â Â Â Â /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX |
---|
5774 | Â Â Â Â Â Â Â namespace, but it is not one of the ones we know about and |
---|
5775 | Â Â Â Â Â Â Â have already dealt with, above (inluding dump-script), then |
---|
5776 | Â Â Â Â Â Â Â report an error. Otherwise, targets might begin to believe |
---|
5777 | Â Â Â Â Â Â Â they are allowed to use options in the LTWRAPPER_OPTION_PREFIX |
---|
5778 | Â Â Â Â Â Â Â namespace. The first time any user complains about this, we'll |
---|
5779 | Â Â Â Â Â Â Â need to make LTWRAPPER_OPTION_PREFIX a configure-time option |
---|
5780 | Â Â Â Â Â Â Â or a configure.ac-settable value. |
---|
5781 | Â Â Â Â Â Â */ |
---|
5782 | Â Â Â Â Â lt_fatal (__FILE__, __LINE__, |
---|
5783 | Â Â Â Â Â Â Â Â Â Â "unrecognized %s option: '%s'", |
---|
5784 | Â Â Â Â Â Â Â Â Â Â ltwrapper_option_prefix, argv[i]); |
---|
5785 | Â Â Â Â } |
---|
5786 | Â Â Â /* otherwise ... */ |
---|
5787 | Â Â Â newargz[++newargc]Â =Â xstrdup (argv[i]); |
---|
5788 | Â Â } |
---|
5789 | Â newargz[++newargc]Â =Â NULL; |
---|
5790 | |
---|
5791 | EOF |
---|
5792 | Â Â Â Â Â Â cat <<EOF |
---|
5793 | Â /* The GNU banner must be the first non-error debug message */ |
---|
5794 | Â lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE) $VERSION\n"); |
---|
5795 | EOF |
---|
5796 | Â Â Â Â Â Â cat <<"EOF" |
---|
5797 | Â lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]); |
---|
5798 | Â lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name); |
---|
5799 | |
---|
5800 |  tmp_pathspec = find_executable (argv[0]); |
---|
5801 |  if (tmp_pathspec == NULL) |
---|
5802 | Â Â lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]); |
---|
5803 | Â lt_debugprintf (__FILE__, __LINE__, |
---|
5804 | Â Â Â Â Â Â Â Â Â "(main) found exe (before symlink chase) at: %s\n", |
---|
5805 | Â Â Â Â Â Â Â Â Â tmp_pathspec); |
---|
5806 | |
---|
5807 |  actual_cwrapper_path = chase_symlinks (tmp_pathspec); |
---|
5808 | Â lt_debugprintf (__FILE__, __LINE__, |
---|
5809 | Â Â Â Â Â Â Â Â Â "(main) found exe (after symlink chase) at: %s\n", |
---|
5810 | Â Â Â Â Â Â Â Â Â actual_cwrapper_path); |
---|
5811 | Â XFREE (tmp_pathspec); |
---|
5812 | |
---|
5813 |  actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path)); |
---|
5814 | Â strendzap (actual_cwrapper_path, actual_cwrapper_name); |
---|
5815 | |
---|
5816 | Â /* wrapper name transforms */ |
---|
5817 | Â strendzap (actual_cwrapper_name, ".exe"); |
---|
5818 |  tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1); |
---|
5819 | Â XFREE (actual_cwrapper_name); |
---|
5820 |  actual_cwrapper_name = tmp_pathspec; |
---|
5821 |  tmp_pathspec = 0; |
---|
5822 | |
---|
5823 | Â /* target_name transforms -- use actual target program name; might have lt- prefix */ |
---|
5824 |  target_name = xstrdup (base_name (TARGET_PROGRAM_NAME)); |
---|
5825 | Â strendzap (target_name, ".exe"); |
---|
5826 |  tmp_pathspec = lt_extend_str (target_name, ".exe", 1); |
---|
5827 | Â XFREE (target_name); |
---|
5828 |  target_name = tmp_pathspec; |
---|
5829 |  tmp_pathspec = 0; |
---|
5830 | |
---|
5831 | Â lt_debugprintf (__FILE__, __LINE__, |
---|
5832 | Â Â Â Â Â Â Â Â Â "(main) libtool target name: %s\n", |
---|
5833 | Â Â Â Â Â Â Â Â Â target_name); |
---|
5834 | EOF |
---|
5835 | |
---|
5836 | Â Â Â Â Â Â cat <<EOF |
---|
5837 | Â newargz[0] = |
---|
5838 | Â Â XMALLOC (char, (strlen (actual_cwrapper_path) + |
---|
5839 | Â Â Â Â Â Â Â Â Â Â strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1)); |
---|
5840 | Â strcpy (newargz[0], actual_cwrapper_path); |
---|
5841 | Â strcat (newargz[0], "$objdir"); |
---|
5842 | Â strcat (newargz[0], "/"); |
---|
5843 | EOF |
---|
5844 | |
---|
5845 | Â Â Â Â Â Â cat <<"EOF" |
---|
5846 | Â /* stop here, and copy so we don't have to do this twice */ |
---|
5847 | Â tmp_pathspec = xstrdup (newargz[0]); |
---|
5848 | |
---|
5849 | Â /* do NOT want the lt- prefix here, so use actual_cwrapper_name */ |
---|
5850 | Â strcat (newargz[0], actual_cwrapper_name); |
---|
5851 | |
---|
5852 | Â /* DO want the lt- prefix here if it exists, so use target_name */ |
---|
5853 | Â lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1); |
---|
5854 | Â XFREE (tmp_pathspec); |
---|
5855 | Â tmp_pathspec = NULL; |
---|
5856 | EOF |
---|
5857 | |
---|
5858 | Â Â Â Â Â Â case $host_os in |
---|
5859 | Â Â Â Â Â Â Â mingw*) |
---|
5860 | Â Â Â Â Â Â cat <<"EOF" |
---|
5861 | Â { |
---|
5862 | Â Â char* p; |
---|
5863 | Â Â while ((p = strchr (newargz[0], '\\')) != NULL) |
---|
5864 | Â Â Â { |
---|
5865 | Â Â Â Â *p = '/'; |
---|
5866 | Â Â Â } |
---|
5867 | Â Â while ((p = strchr (lt_argv_zero, '\\')) != NULL) |
---|
5868 | Â Â Â { |
---|
5869 | Â Â Â Â *p = '/'; |
---|
5870 | Â Â Â } |
---|
5871 | Â } |
---|
5872 | EOF |
---|
5873 | Â Â Â Â Â Â ;; |
---|
5874 | Â Â Â Â Â Â esac |
---|
5875 | |
---|
5876 | Â Â Â Â Â Â cat <<"EOF" |
---|
5877 | Â XFREE (target_name); |
---|
5878 | Â XFREE (actual_cwrapper_path); |
---|
5879 | Â XFREE (actual_cwrapper_name); |
---|
5880 | |
---|
5881 | Â lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */ |
---|
5882 | Â lt_setenv ("DUALCASE", "1");Â /* for MSK sh */ |
---|
5883 |  /* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must |
---|
5884 | Â Â Â be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath) |
---|
5885 | Â Â Â because on Windows, both *_VARNAMEs are PATH but uninstalled |
---|
5886 | Â Â Â libraries must come first. */ |
---|
5887 | Â lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE); |
---|
5888 | Â lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE); |
---|
5889 | |
---|
5890 | Â lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n", |
---|
5891 | Â Â Â Â Â Â Â Â Â nonnull (lt_argv_zero)); |
---|
5892 | Â for (i = 0; i < newargc; i++) |
---|
5893 | Â Â { |
---|
5894 | Â Â Â lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n", |
---|
5895 | Â Â Â Â Â Â Â Â Â Â Â i, nonnull (newargz[i])); |
---|
5896 | Â Â } |
---|
5897 | |
---|
5898 | EOF |
---|
5899 | |
---|
5900 | Â Â Â Â Â Â case $host_os in |
---|
5901 | Â Â Â Â Â Â Â mingw*) |
---|
5902 | Â Â Â Â Â Â Â Â cat <<"EOF" |
---|
5903 | Â /* execv doesn't actually work on mingw as expected on unix */ |
---|
5904 |  newargz = prepare_spawn (newargz); |
---|
5905 |  rval = (int) _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz); |
---|
5906 |  if (rval == -1) |
---|
5907 | Â Â { |
---|
5908 | Â Â Â /* failed to start process */ |
---|
5909 | Â Â Â lt_debugprintf (__FILE__, __LINE__, |
---|
5910 | Â Â Â Â Â Â Â Â Â Â Â "(main) failed to launch target \"%s\": %s\n", |
---|
5911 | Â Â Â Â Â Â Â Â Â Â Â lt_argv_zero, nonnull (strerror (errno))); |
---|
5912 | Â Â Â return 127; |
---|
5913 | Â Â } |
---|
5914 | Â return rval; |
---|
5915 | EOF |
---|
5916 | Â Â Â Â Â Â Â Â ;; |
---|
5917 | Â Â Â Â Â Â Â *) |
---|
5918 | Â Â Â Â Â Â Â Â cat <<"EOF" |
---|
5919 | Â execv (lt_argv_zero, newargz); |
---|
5920 | Â return rval; /* =127, but avoids unused variable warning */ |
---|
5921 | EOF |
---|
5922 | Â Â Â Â Â Â Â Â ;; |
---|
5923 | Â Â Â Â Â Â esac |
---|
5924 | |
---|
5925 | Â Â Â Â Â Â cat <<"EOF" |
---|
5926 | } |
---|
5927 | |
---|
5928 | void * |
---|
5929 | xmalloc (size_t num) |
---|
5930 | { |
---|
5931 | Â void *p =Â (void *)Â malloc (num); |
---|
5932 |  if (!p) |
---|
5933 | Â Â lt_fatal (__FILE__, __LINE__, "memory exhausted"); |
---|
5934 | |
---|
5935 | Â return p; |
---|
5936 | } |
---|
5937 | |
---|
5938 | char * |
---|
5939 | xstrdup (const char *string) |
---|
5940 | { |
---|
5941 | Â return string ? strcpy ((char *)Â xmalloc (strlen (string)Â + 1), |
---|
5942 | Â Â Â Â Â Â Â Â Â Â Â Â Â string)Â : NULL; |
---|
5943 | } |
---|
5944 | |
---|
5945 | const char * |
---|
5946 | base_name (const char *name) |
---|
5947 | { |
---|
5948 | Â const char *base; |
---|
5949 | |
---|
5950 | #if defined HAVE_DOS_BASED_FILE_SYSTEM |
---|
5951 | Â /* Skip over the disk name in MSDOS pathnames. */ |
---|
5952 |  if (isalpha ((unsigned char) name[0]) && name[1] == ':') |
---|
5953 | Â Â name +=Â 2; |
---|
5954 | #endif |
---|
5955 | |
---|
5956 |  for (base = name; *name; name++) |
---|
5957 |   if (IS_DIR_SEPARATOR (*name)) |
---|
5958 |    base = name + 1; |
---|
5959 | Â return base; |
---|
5960 | } |
---|
5961 | |
---|
5962 | int |
---|
5963 | check_executable (const char *path) |
---|
5964 | { |
---|
5965 | Â struct stat st; |
---|
5966 | |
---|
5967 | Â lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n", |
---|
5968 | Â Â Â Â Â Â Â Â Â nonempty (path)); |
---|
5969 |  if ((!path) || (!*path)) |
---|
5970 | Â Â return 0; |
---|
5971 | |
---|
5972 |  if ((stat (path, &st) >= 0) |
---|
5973 | Â Â Â &&Â (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) |
---|
5974 | Â Â return 1; |
---|
5975 | Â else |
---|
5976 | Â Â return 0; |
---|
5977 | } |
---|
5978 | |
---|
5979 | int |
---|
5980 | make_executable (const char *path) |
---|
5981 | { |
---|
5982 |  int rval = 0; |
---|
5983 | Â struct stat st; |
---|
5984 | |
---|
5985 | Â lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", |
---|
5986 | Â Â Â Â Â Â Â Â Â nonempty (path)); |
---|
5987 |  if ((!path) || (!*path)) |
---|
5988 | Â Â return 0; |
---|
5989 | |
---|
5990 |  if (stat (path, &st) >= 0) |
---|
5991 | Â Â { |
---|
5992 |    rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); |
---|
5993 | Â Â } |
---|
5994 | Â return rval; |
---|
5995 | } |
---|
5996 | |
---|
5997 | /* Searches for the full path of the wrapper. Returns |
---|
5998 | Â Â newly allocated full path name if found, NULL otherwise |
---|
5999 | Â Â Does not chase symlinks, even on platforms that support them. |
---|
6000 | */ |
---|
6001 | char * |
---|
6002 | find_executable (const char *wrapper) |
---|
6003 | { |
---|
6004 |  int has_slash = 0; |
---|
6005 | Â const char *p; |
---|
6006 | Â const char *p_next; |
---|
6007 | Â /* static buffer for getcwd */ |
---|
6008 | Â char tmp[LT_PATHMAX + 1]; |
---|
6009 | Â size_t tmp_len; |
---|
6010 | Â char *concat_name; |
---|
6011 | |
---|
6012 | Â lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", |
---|
6013 | Â Â Â Â Â Â Â Â Â nonempty (wrapper)); |
---|
6014 | |
---|
6015 |  if ((wrapper == NULL) || (*wrapper == '\0')) |
---|
6016 | Â Â return NULL; |
---|
6017 | |
---|
6018 | Â /* Absolute path? */ |
---|
6019 | #if defined HAVE_DOS_BASED_FILE_SYSTEM |
---|
6020 |  if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') |
---|
6021 | Â Â { |
---|
6022 |    concat_name = xstrdup (wrapper); |
---|
6023 |    if (check_executable (concat_name)) |
---|
6024 | Â Â Â Â return concat_name; |
---|
6025 | Â Â Â XFREE (concat_name); |
---|
6026 | Â Â } |
---|
6027 | Â else |
---|
6028 | Â Â { |
---|
6029 | #endif |
---|
6030 |    if (IS_DIR_SEPARATOR (wrapper[0])) |
---|
6031 | Â Â Â Â { |
---|
6032 |      concat_name = xstrdup (wrapper); |
---|
6033 |      if (check_executable (concat_name)) |
---|
6034 | Â Â Â Â Â Â return concat_name; |
---|
6035 | Â Â Â Â Â XFREE (concat_name); |
---|
6036 | Â Â Â Â } |
---|
6037 | #if defined HAVE_DOS_BASED_FILE_SYSTEM |
---|
6038 | Â Â } |
---|
6039 | #endif |
---|
6040 | |
---|
6041 |  for (p = wrapper; *p; p++) |
---|
6042 |   if (*p == '/') |
---|
6043 | Â Â Â { |
---|
6044 |     has_slash = 1; |
---|
6045 | Â Â Â Â break; |
---|
6046 | Â Â Â } |
---|
6047 |  if (!has_slash) |
---|
6048 | Â Â { |
---|
6049 | Â Â Â /* no slashes; search PATH */ |
---|
6050 | Â Â Â const char *path =Â getenv ("PATH"); |
---|
6051 |    if (path != NULL) |
---|
6052 | Â Â Â Â { |
---|
6053 |      for (p = path; *p; p = p_next) |
---|
6054 | Â Â Â Â Â Â { |
---|
6055 | Â Â Â Â Â Â Â const char *q; |
---|
6056 | Â Â Â Â Â Â Â size_t p_len; |
---|
6057 |        for (q = p; *q; q++) |
---|
6058 |         if (IS_PATH_SEPARATOR (*q)) |
---|
6059 | Â Â Â Â Â Â Â Â Â break; |
---|
6060 |        p_len = (size_t) (q - p); |
---|
6061 |        p_next = (*q == '\0' ? q : q + 1); |
---|
6062 |        if (p_len == 0) |
---|
6063 | Â Â Â Â Â Â Â Â { |
---|
6064 | Â Â Â Â Â Â Â Â Â /* empty path: current directory */ |
---|
6065 |          if (getcwd (tmp, LT_PATHMAX) == NULL) |
---|
6066 | Â Â Â Â Â Â Â Â Â Â lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", |
---|
6067 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â nonnull (strerror (errno))); |
---|
6068 |          tmp_len = strlen (tmp); |
---|
6069 |          concat_name = |
---|
6070 | Â Â Â Â Â Â Â Â Â Â XMALLOC (char, tmp_len + 1 + strlen (wrapper)Â + 1); |
---|
6071 | Â Â Â Â Â Â Â Â Â memcpy (concat_name, tmp, tmp_len); |
---|
6072 | Â Â Â Â Â Â Â Â Â concat_name[tmp_len]Â =Â '/'; |
---|
6073 | Â Â Â Â Â Â Â Â Â strcpy (concat_name + tmp_len + 1, wrapper); |
---|
6074 | Â Â Â Â Â Â Â Â } |
---|
6075 | Â Â Â Â Â Â Â else |
---|
6076 | Â Â Â Â Â Â Â Â { |
---|
6077 |          concat_name = |
---|
6078 | Â Â Â Â Â Â Â Â Â Â XMALLOC (char, p_len + 1 + strlen (wrapper)Â + 1); |
---|
6079 | Â Â Â Â Â Â Â Â Â memcpy (concat_name, p, p_len); |
---|
6080 | Â Â Â Â Â Â Â Â Â concat_name[p_len]Â =Â '/'; |
---|
6081 | Â Â Â Â Â Â Â Â Â strcpy (concat_name + p_len + 1, wrapper); |
---|
6082 | Â Â Â Â Â Â Â Â } |
---|
6083 |        if (check_executable (concat_name)) |
---|
6084 | Â Â Â Â Â Â Â Â return concat_name; |
---|
6085 | Â Â Â Â Â Â Â XFREE (concat_name); |
---|
6086 | Â Â Â Â Â Â } |
---|
6087 | Â Â Â Â } |
---|
6088 | Â Â Â /* not found in PATH; assume curdir */ |
---|
6089 | Â Â } |
---|
6090 | Â /* Relative path | not found in path: prepend cwd */ |
---|
6091 |  if (getcwd (tmp, LT_PATHMAX) == NULL) |
---|
6092 | Â Â lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", |
---|
6093 | Â Â Â Â Â Â Â nonnull (strerror (errno))); |
---|
6094 |  tmp_len = strlen (tmp); |
---|
6095 |  concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); |
---|
6096 | Â memcpy (concat_name, tmp, tmp_len); |
---|
6097 | Â concat_name[tmp_len]Â =Â '/'; |
---|
6098 | Â strcpy (concat_name + tmp_len + 1, wrapper); |
---|
6099 | |
---|
6100 |  if (check_executable (concat_name)) |
---|
6101 | Â Â return concat_name; |
---|
6102 | Â XFREE (concat_name); |
---|
6103 | Â return NULL; |
---|
6104 | } |
---|
6105 | |
---|
6106 | char * |
---|
6107 | chase_symlinks (const char *pathspec) |
---|
6108 | { |
---|
6109 | #ifndef S_ISLNK |
---|
6110 | Â return xstrdup (pathspec); |
---|
6111 | #else |
---|
6112 | Â char buf[LT_PATHMAX]; |
---|
6113 | Â struct stat s; |
---|
6114 | Â char *tmp_pathspec =Â xstrdup (pathspec); |
---|
6115 | Â char *p; |
---|
6116 |  int has_symlinks = 0; |
---|
6117 |  while (strlen (tmp_pathspec) && !has_symlinks) |
---|
6118 | Â Â { |
---|
6119 | Â Â Â lt_debugprintf (__FILE__, __LINE__, |
---|
6120 | Â Â Â Â Â Â Â Â Â Â Â "checking path component for symlinks: %s\n", |
---|
6121 | Â Â Â Â Â Â Â Â Â Â Â tmp_pathspec); |
---|
6122 |    if (lstat (tmp_pathspec, &s) == 0) |
---|
6123 | Â Â Â Â { |
---|
6124 |      if (S_ISLNK (s.st_mode) != 0) |
---|
6125 | Â Â Â Â Â Â { |
---|
6126 |        has_symlinks = 1; |
---|
6127 | Â Â Â Â Â Â Â break; |
---|
6128 | Â Â Â Â Â Â } |
---|
6129 | |
---|
6130 | Â Â Â Â Â /* search backwards for last DIR_SEPARATOR */ |
---|
6131 |      p = tmp_pathspec + strlen (tmp_pathspec) - 1; |
---|
6132 |      while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) |
---|
6133 | Â Â Â Â Â Â p--; |
---|
6134 |      if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) |
---|
6135 | Â Â Â Â Â Â { |
---|
6136 | Â Â Â Â Â Â Â /* no more DIR_SEPARATORS left */ |
---|
6137 | Â Â Â Â Â Â Â break; |
---|
6138 | Â Â Â Â Â Â } |
---|
6139 | Â Â Â Â Â *p =Â '\0'; |
---|
6140 | Â Â Â Â } |
---|
6141 | Â Â Â else |
---|
6142 | Â Â Â Â { |
---|
6143 | Â Â Â Â Â lt_fatal (__FILE__, __LINE__, |
---|
6144 | Â Â Â Â Â Â Â Â Â Â "error accessing file \"%s\": %s", |
---|
6145 | Â Â Â Â Â Â Â Â Â Â tmp_pathspec, nonnull (strerror (errno))); |
---|
6146 | Â Â Â Â } |
---|
6147 | Â Â } |
---|
6148 | Â XFREE (tmp_pathspec); |
---|
6149 | |
---|
6150 |  if (!has_symlinks) |
---|
6151 | Â Â { |
---|
6152 | Â Â Â return xstrdup (pathspec); |
---|
6153 | Â Â } |
---|
6154 | |
---|
6155 |  tmp_pathspec = realpath (pathspec, buf); |
---|
6156 |  if (tmp_pathspec == 0) |
---|
6157 | Â Â { |
---|
6158 | Â Â Â lt_fatal (__FILE__, __LINE__, |
---|
6159 | Â Â Â Â Â Â Â Â "could not follow symlinks for %s", pathspec); |
---|
6160 | Â Â } |
---|
6161 | Â return xstrdup (tmp_pathspec); |
---|
6162 | #endif |
---|
6163 | } |
---|
6164 | |
---|
6165 | char * |
---|
6166 | strendzap (char *str, const char *pat) |
---|
6167 | { |
---|
6168 | Â size_t len, patlen; |
---|
6169 | |
---|
6170 | Â assert (str !=Â NULL); |
---|
6171 | Â assert (pat !=Â NULL); |
---|
6172 | |
---|
6173 |  len = strlen (str); |
---|
6174 |  patlen = strlen (pat); |
---|
6175 | |
---|
6176 |  if (patlen <= len) |
---|
6177 | Â Â { |
---|
6178 | Â Â Â str +=Â len - patlen; |
---|
6179 |    if (STREQ (str, pat)) |
---|
6180 | Â Â Â Â *str =Â '\0'; |
---|
6181 | Â Â } |
---|
6182 | Â return str; |
---|
6183 | } |
---|
6184 | |
---|
6185 | void |
---|
6186 | lt_debugprintf (const char *file, int line, const char *fmt, ...) |
---|
6187 | { |
---|
6188 | Â va_list args; |
---|
6189 |  if (lt_debug) |
---|
6190 | Â Â { |
---|
6191 | Â Â Â (void)Â fprintf (stderr, "%s:%s:%d: ", program_name, file, line); |
---|
6192 | Â Â Â va_start (args, fmt); |
---|
6193 | Â Â Â (void)Â vfprintf (stderr, fmt, args); |
---|
6194 | Â Â Â va_end (args); |
---|
6195 | Â Â } |
---|
6196 | } |
---|
6197 | |
---|
6198 | static void |
---|
6199 | lt_error_core (int exit_status, const char *file, |
---|
6200 | Â Â Â Â Â Â Â Â int line, const char *mode, |
---|
6201 | Â Â Â Â Â Â Â Â const char *message, va_list ap) |
---|
6202 | { |
---|
6203 | Â fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); |
---|
6204 | Â vfprintf (stderr, message, ap); |
---|
6205 | Â fprintf (stderr, ".\n"); |
---|
6206 | |
---|
6207 |  if (exit_status >= 0) |
---|
6208 |   exit (exit_status); |
---|
6209 | } |
---|
6210 | |
---|
6211 | void |
---|
6212 | lt_fatal (const char *file, int line, const char *message, ...) |
---|
6213 | { |
---|
6214 | Â va_list ap; |
---|
6215 | Â va_start (ap, message); |
---|
6216 | Â lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); |
---|
6217 | Â va_end (ap); |
---|
6218 | } |
---|
6219 | |
---|
6220 | static const char * |
---|
6221 | nonnull (const char *s) |
---|
6222 | { |
---|
6223 | Â return s ? s : "(null)"; |
---|
6224 | } |
---|
6225 | |
---|
6226 | static const char * |
---|
6227 | nonempty (const char *s) |
---|
6228 | { |
---|
6229 |  return (s && !*s) ? "(empty)" : nonnull (s); |
---|
6230 | } |
---|
6231 | |
---|
6232 | void |
---|
6233 | lt_setenv (const char *name, const char *value) |
---|
6234 | { |
---|
6235 | Â lt_debugprintf (__FILE__, __LINE__, |
---|
6236 | Â Â Â Â Â Â Â Â Â "(lt_setenv) setting '%s' to '%s'\n", |
---|
6237 | Â Â Â Â Â Â Â Â Â nonnull (name), nonnull (value)); |
---|
6238 | Â { |
---|
6239 | #ifdef HAVE_SETENV |
---|
6240 | Â Â /* always make a copy, for consistency with !HAVE_SETENV */ |
---|
6241 | Â Â char *str =Â xstrdup (value); |
---|
6242 | Â Â setenv (name, str, 1); |
---|
6243 | #else |
---|
6244 |   size_t len = strlen (name) + 1 + strlen (value) + 1; |
---|
6245 | Â Â char *str =Â XMALLOC (char, len); |
---|
6246 | Â Â sprintf (str, "%s=%s", name, value); |
---|
6247 |   if (putenv (str) != EXIT_SUCCESS) |
---|
6248 | Â Â Â { |
---|
6249 | Â Â Â Â XFREE (str); |
---|
6250 | Â Â Â } |
---|
6251 | #endif |
---|
6252 | Â } |
---|
6253 | } |
---|
6254 | |
---|
6255 | char * |
---|
6256 | lt_extend_str (const char *orig_value, const char *add, int to_end) |
---|
6257 | { |
---|
6258 | Â char *new_value; |
---|
6259 |  if (orig_value && *orig_value) |
---|
6260 | Â Â { |
---|
6261 |    size_t orig_value_len = strlen (orig_value); |
---|
6262 |    size_t add_len = strlen (add); |
---|
6263 |    new_value = XMALLOC (char, add_len + orig_value_len + 1); |
---|
6264 |    if (to_end) |
---|
6265 | Â Â Â Â { |
---|
6266 | Â Â Â Â Â strcpy (new_value, orig_value); |
---|
6267 | Â Â Â Â Â strcpy (new_value + orig_value_len, add); |
---|
6268 | Â Â Â Â } |
---|
6269 | Â Â Â else |
---|
6270 | Â Â Â Â { |
---|
6271 | Â Â Â Â Â strcpy (new_value, add); |
---|
6272 | Â Â Â Â Â strcpy (new_value + add_len, orig_value); |
---|
6273 | Â Â Â Â } |
---|
6274 | Â Â } |
---|
6275 | Â else |
---|
6276 | Â Â { |
---|
6277 |    new_value = xstrdup (add); |
---|
6278 | Â Â } |
---|
6279 | Â return new_value; |
---|
6280 | } |
---|
6281 | |
---|
6282 | void |
---|
6283 | lt_update_exe_path (const char *name, const char *value) |
---|
6284 | { |
---|
6285 | Â lt_debugprintf (__FILE__, __LINE__, |
---|
6286 | Â Â Â Â Â Â Â Â Â "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", |
---|
6287 | Â Â Â Â Â Â Â Â Â nonnull (name), nonnull (value)); |
---|
6288 | |
---|
6289 |  if (name && *name && value && *value) |
---|
6290 | Â Â { |
---|
6291 | Â Â Â char *new_value =Â lt_extend_str (getenv (name), value, 0); |
---|
6292 | Â Â Â /* some systems can't cope with a ':'-terminated path #'Â */ |
---|
6293 |    size_t len = strlen (new_value); |
---|
6294 |    while ((len > 0) && IS_PATH_SEPARATOR (new_value[len-1])) |
---|
6295 | Â Â Â Â { |
---|
6296 | Â Â Â Â Â new_value[--len]Â =Â '\0'; |
---|
6297 | Â Â Â Â } |
---|
6298 | Â Â Â lt_setenv (name, new_value); |
---|
6299 | Â Â Â XFREE (new_value); |
---|
6300 | Â Â } |
---|
6301 | } |
---|
6302 | |
---|
6303 | void |
---|
6304 | lt_update_lib_path (const char *name, const char *value) |
---|
6305 | { |
---|
6306 | Â lt_debugprintf (__FILE__, __LINE__, |
---|
6307 | Â Â Â Â Â Â Â Â Â "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", |
---|
6308 | Â Â Â Â Â Â Â Â Â nonnull (name), nonnull (value)); |
---|
6309 | |
---|
6310 |  if (name && *name && value && *value) |
---|
6311 | Â Â { |
---|
6312 | Â Â Â char *new_value =Â lt_extend_str (getenv (name), value, 0); |
---|
6313 | Â Â Â lt_setenv (name, new_value); |
---|
6314 | Â Â Â XFREE (new_value); |
---|
6315 | Â Â } |
---|
6316 | } |
---|
6317 | |
---|
6318 | EOF |
---|
6319 |       case $host_os in |
---|
6320 | Â Â Â Â Â Â Â mingw*) |
---|
6321 | Â Â Â Â Â Â Â Â cat <<"EOF" |
---|
6322 | |
---|
6323 | /* Prepares an argument vector before calling spawn(). |
---|
6324 | Â Â Note that spawn()Â does not by itself call the command interpreter |
---|
6325 | Â Â Â (getenv ("COMSPEC")Â !=Â NULL ? getenv ("COMSPEC")Â : |
---|
6326 | Â Â Â ({Â OSVERSIONINFO v; v.dwOSVersionInfoSize =Â sizeof(OSVERSIONINFO); |
---|
6327 | Â Â Â Â Â GetVersionEx(&v); |
---|
6328 | Â Â Â Â Â v.dwPlatformId ==Â VER_PLATFORM_WIN32_NT; |
---|
6329 | Â Â Â })Â ? "cmd.exe"Â : "command.com"). |
---|
6330 | Â Â Instead it simply concatenates the arguments, separated by ' ', and calls |
---|
6331 |   CreateProcess(). We must quote the arguments since Win32 CreateProcess() |
---|
6332 | Â Â interprets characters like ' ', '\t', '\\', '"'Â (but not '<'Â and '>')Â in a |
---|
6333 | Â Â special way: |
---|
6334 | Â Â - Space and tab are interpreted as delimiters. They are not treated as |
---|
6335 | Â Â Â delimiters if they are surrounded by double quotes: "...". |
---|
6336 | Â Â - Unescaped double quotes are removed from the input. Their only effect is |
---|
6337 | Â Â Â that within double quotes, space and tab are treated like normal |
---|
6338 | Â Â Â characters. |
---|
6339 | Â Â - Backslashes not followed by double quotes are not special. |
---|
6340 | Â Â - But 2*n+1 backslashes followed by a double quote become |
---|
6341 | Â Â Â n backslashes followed by a double quote (n >=Â 0): |
---|
6342 | Â Â Â Â \"Â -> " |
---|
6343 | Â Â Â Â \\\" -> \" |
---|
6344 | Â Â Â Â \\\\\" -> \\" |
---|
6345 | Â */ |
---|
6346 | #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" |
---|
6347 | #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" |
---|
6348 | char ** |
---|
6349 | prepare_spawn (char **argv) |
---|
6350 | { |
---|
6351 | Â size_t argc; |
---|
6352 | Â char **new_argv; |
---|
6353 | Â size_t i; |
---|
6354 | |
---|
6355 |  /* Count number of arguments. */ |
---|
6356 |  for (argc = 0; argv[argc] != NULL; argc++) |
---|
6357 | Â Â ; |
---|
6358 | |
---|
6359 |  /* Allocate new argument vector. */ |
---|
6360 |  new_argv = XMALLOC (char *, argc + 1); |
---|
6361 | |
---|
6362 |  /* Put quoted arguments into the new argument vector. */ |
---|
6363 |  for (i = 0; i < argc; i++) |
---|
6364 | Â Â { |
---|
6365 | Â Â Â const char *string =Â argv[i]; |
---|
6366 | |
---|
6367 |    if (string[0] == '\0') |
---|
6368 | Â Â Â Â new_argv[i]Â =Â xstrdup ("\"\""); |
---|
6369 |    else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) |
---|
6370 | Â Â Â Â { |
---|
6371 |      int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); |
---|
6372 | Â Â Â Â Â size_t length; |
---|
6373 | Â Â Â Â Â unsigned int backslashes; |
---|
6374 | Â Â Â Â Â const char *s; |
---|
6375 | Â Â Â Â Â char *quoted_string; |
---|
6376 | Â Â Â Â Â char *p; |
---|
6377 | |
---|
6378 |      length = 0; |
---|
6379 |      backslashes = 0; |
---|
6380 |      if (quote_around) |
---|
6381 | Â Â Â Â Â Â length++; |
---|
6382 |      for (s = string; *s != '\0'; s++) |
---|
6383 | Â Â Â Â Â Â { |
---|
6384 |        char c = *s; |
---|
6385 |        if (c == '"') |
---|
6386 | Â Â Â Â Â Â Â Â length +=Â backslashes + 1; |
---|
6387 | Â Â Â Â Â Â Â length++; |
---|
6388 |        if (c == '\\') |
---|
6389 | Â Â Â Â Â Â Â Â backslashes++; |
---|
6390 | Â Â Â Â Â Â Â else |
---|
6391 |         backslashes = 0; |
---|
6392 | Â Â Â Â Â Â } |
---|
6393 |      if (quote_around) |
---|
6394 | Â Â Â Â Â Â length +=Â backslashes + 1; |
---|
6395 | |
---|
6396 |      quoted_string = XMALLOC (char, length + 1); |
---|
6397 | |
---|
6398 |      p = quoted_string; |
---|
6399 |      backslashes = 0; |
---|
6400 |      if (quote_around) |
---|
6401 | Â Â Â Â Â Â *p++ =Â '"'; |
---|
6402 |      for (s = string; *s != '\0'; s++) |
---|
6403 | Â Â Â Â Â Â { |
---|
6404 |        char c = *s; |
---|
6405 |        if (c == '"') |
---|
6406 | Â Â Â Â Â Â Â Â { |
---|
6407 | Â Â Â Â Â Â Â Â Â unsigned int j; |
---|
6408 |          for (j = backslashes + 1; j > 0; j--) |
---|
6409 | Â Â Â Â Â Â Â Â Â Â *p++ =Â '\\'; |
---|
6410 | Â Â Â Â Â Â Â Â } |
---|
6411 | Â Â Â Â Â Â Â *p++ =Â c; |
---|
6412 |        if (c == '\\') |
---|
6413 | Â Â Â Â Â Â Â Â backslashes++; |
---|
6414 | Â Â Â Â Â Â Â else |
---|
6415 |         backslashes = 0; |
---|
6416 | Â Â Â Â Â Â } |
---|
6417 |      if (quote_around) |
---|
6418 | Â Â Â Â Â Â { |
---|
6419 | Â Â Â Â Â Â Â unsigned int j; |
---|
6420 |        for (j = backslashes; j > 0; j--) |
---|
6421 | Â Â Â Â Â Â Â Â *p++ =Â '\\'; |
---|
6422 | Â Â Â Â Â Â Â *p++ =Â '"'; |
---|
6423 | Â Â Â Â Â Â } |
---|
6424 | Â Â Â Â Â *p =Â '\0'; |
---|
6425 | |
---|
6426 | Â Â Â Â Â new_argv[i]Â =Â quoted_string; |
---|
6427 | Â Â Â Â } |
---|
6428 | Â Â Â else |
---|
6429 | Â Â Â Â new_argv[i]Â =Â (char *)Â string; |
---|
6430 | Â Â } |
---|
6431 | Â new_argv[argc]Â =Â NULL; |
---|
6432 | |
---|
6433 | Â return new_argv; |
---|
6434 | } |
---|
6435 | EOF |
---|
6436 | Â Â Â Â Â Â Â Â ;; |
---|
6437 | Â Â Â Â Â Â esac |
---|
6438 | |
---|
6439 | Â Â Â Â Â Â cat <<"EOF" |
---|
6440 | void lt_dump_script (FILE* f) |
---|
6441 | { |
---|
6442 | EOF |
---|
6443 | Â Â Â Â Â Â func_emit_wrapper yes | |
---|
6444 | Â Â Â Â Â Â Â $SEDÂ -n -e ' |
---|
6445 | s/^\(.\{79\}\)\(..*\)/\1\ |
---|
6446 | \2/ |
---|
6447 | h |
---|
6448 | s/\([\\"]\)/\\\1/g |
---|
6449 | s/$/\\n/ |
---|
6450 | s/\([^\n]*\).*/Â fputs ("\1", f);/p |
---|
6451 | g |
---|
6452 | D' |
---|
6453 | Â Â Â Â Â Â cat <<"EOF" |
---|
6454 | } |
---|
6455 | EOF |
---|
6456 | } |
---|
6457 | # end: func_emit_cwrapperexe_src |
---|
6458 | |
---|
6459 | # func_win32_import_lib_p ARG |
---|
6460 | # True if ARG is an import lib, as indicated by $file_magic_cmd |
---|
6461 | func_win32_import_lib_p () |
---|
6462 | { |
---|
6463 | Â Â $debug_cmd |
---|
6464 | |
---|
6465 |   case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in |
---|
6466 | Â Â *import*)Â : ;; |
---|
6467 |   *) false ;; |
---|
6468 | Â Â esac |
---|
6469 | } |
---|
6470 | |
---|
6471 | # func_suncc_cstd_abi |
---|
6472 | # !!ONLY CALL THIS FOR SUN CC AFTER $compile_command IS FULLY EXPANDED!! |
---|
6473 | # Several compiler flags select an ABI that is incompatible with the |
---|
6474 | # Cstd library. Avoid specifying it if any are in CXXFLAGS. |
---|
6475 | func_suncc_cstd_abi () |
---|
6476 | { |
---|
6477 | Â Â $debug_cmd |
---|
6478 | |
---|
6479 |   case " $compile_command " in |
---|
6480 | Â Â *" -compat=g "*|*\ -std=c++[0-9][0-9]\ *|*" -library=stdcxx4 "*|*" -library=stlport4 "*) |
---|
6481 | Â Â Â suncc_use_cstd_abi=no |
---|
6482 | Â Â Â ;; |
---|
6483 | Â Â *) |
---|
6484 | Â Â Â suncc_use_cstd_abi=yes |
---|
6485 | Â Â Â ;; |
---|
6486 | Â Â esac |
---|
6487 | } |
---|
6488 | |
---|
6489 | # func_mode_link arg... |
---|
6490 | func_mode_link () |
---|
6491 | { |
---|
6492 | Â Â $debug_cmd |
---|
6493 | |
---|
6494 |   case $host in |
---|
6495 | Â Â *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) |
---|
6496 | Â Â Â # It is impossible to link a dll without this setting, and |
---|
6497 | Â Â Â # we shouldn't force the makefile maintainer to figure out |
---|
6498 | Â Â Â # what system we are compiling for in order to pass an extra |
---|
6499 | Â Â Â # flag for every libtool invocation. |
---|
6500 | Â Â Â # allow_undefined=no |
---|
6501 | |
---|
6502 | Â Â Â # FIXME: Unfortunately, there are problems with the above when trying |
---|
6503 | Â Â Â # to make a dll that has undefined symbols, in which case not |
---|
6504 |    # even a static library is built. For now, we need to specify |
---|
6505 | Â Â Â # -no-undefined on the libtool link line when we can be certain |
---|
6506 | Â Â Â # that all symbols are satisfied, otherwise we get a static library. |
---|
6507 | Â Â Â allow_undefined=yes |
---|
6508 | Â Â Â ;; |
---|
6509 | Â Â *) |
---|
6510 | Â Â Â allow_undefined=yes |
---|
6511 | Â Â Â ;; |
---|
6512 | Â Â esac |
---|
6513 | Â Â libtool_args=$nonopt |
---|
6514 | Â Â base_compile="$nonopt $@" |
---|
6515 | Â Â compile_command=$nonopt |
---|
6516 | Â Â finalize_command=$nonopt |
---|
6517 | |
---|
6518 | Â Â compile_rpath= |
---|
6519 | Â Â finalize_rpath= |
---|
6520 | Â Â compile_shlibpath= |
---|
6521 | Â Â finalize_shlibpath= |
---|
6522 | Â Â convenience= |
---|
6523 | Â Â old_convenience= |
---|
6524 | Â Â deplibs= |
---|
6525 | Â Â old_deplibs= |
---|
6526 | Â Â compiler_flags= |
---|
6527 | Â Â linker_flags= |
---|
6528 | Â Â dllsearchpath= |
---|
6529 | Â Â lib_search_path=`pwd` |
---|
6530 | Â Â inst_prefix_dir= |
---|
6531 | Â Â new_inherited_linker_flags= |
---|
6532 | |
---|
6533 | Â Â avoid_version=no |
---|
6534 | Â Â bindir= |
---|
6535 | Â Â dlfiles= |
---|
6536 | Â Â dlprefiles= |
---|
6537 | Â Â dlself=no |
---|
6538 | Â Â export_dynamic=no |
---|
6539 | Â Â export_symbols= |
---|
6540 | Â Â export_symbols_regex= |
---|
6541 | Â Â generated= |
---|
6542 | Â Â libobjs= |
---|
6543 | Â Â ltlibs= |
---|
6544 | Â Â module=no |
---|
6545 | Â Â no_install=no |
---|
6546 | Â Â objs= |
---|
6547 | Â Â os2dllname= |
---|
6548 | Â Â non_pic_objects= |
---|
6549 | Â Â precious_files_regex= |
---|
6550 | Â Â prefer_static_libs=no |
---|
6551 | Â Â preload=false |
---|
6552 | Â Â prev= |
---|
6553 | Â Â prevarg= |
---|
6554 | Â Â release= |
---|
6555 | Â Â rpath= |
---|
6556 | Â Â xrpath= |
---|
6557 | Â Â perm_rpath= |
---|
6558 | Â Â temp_rpath= |
---|
6559 | Â Â thread_safe=no |
---|
6560 | Â Â vinfo= |
---|
6561 | Â Â vinfo_number=no |
---|
6562 | Â Â weak_libs= |
---|
6563 | Â Â single_module=$wl-single_module |
---|
6564 | Â Â func_infer_tag $base_compile |
---|
6565 | |
---|
6566 | Â Â # We need to know -static, to get the right output filenames. |
---|
6567 | Â Â for arg |
---|
6568 | Â Â do |
---|
6569 |    case $arg in |
---|
6570 | Â Â Â -shared) |
---|
6571 | Â Â Â Â test yes !=Â "$build_libtool_libs"Â \ |
---|
6572 | Â Â Â Â Â &&Â func_fatal_configuration "cannot build a shared library" |
---|
6573 | Â Â Â Â build_old_libs=no |
---|
6574 | Â Â Â Â break |
---|
6575 | Â Â Â Â ;; |
---|
6576 | Â Â Â -all-static | -static | -static-libtool-libs) |
---|
6577 |     case $arg in |
---|
6578 | Â Â Â Â -all-static) |
---|
6579 |      if test yes = "$build_libtool_libs" && test -z "$link_static_flag"; then |
---|
6580 | Â Â Â Â Â Â func_warning "complete static linking is impossible in this configuration" |
---|
6581 | Â Â Â Â Â fi |
---|
6582 |      if test -n "$link_static_flag"; then |
---|
6583 | Â Â Â Â Â Â dlopen_self=$dlopen_self_static |
---|
6584 | Â Â Â Â Â fi |
---|
6585 | Â Â Â Â Â prefer_static_libs=yes |
---|
6586 | Â Â Â Â Â ;; |
---|
6587 | Â Â Â Â -static) |
---|
6588 |      if test -z "$pic_flag" && test -n "$link_static_flag"; then |
---|
6589 | Â Â Â Â Â Â dlopen_self=$dlopen_self_static |
---|
6590 | Â Â Â Â Â fi |
---|
6591 | Â Â Â Â Â prefer_static_libs=built |
---|
6592 | Â Â Â Â Â ;; |
---|
6593 | Â Â Â Â -static-libtool-libs) |
---|
6594 |      if test -z "$pic_flag" && test -n "$link_static_flag"; then |
---|
6595 | Â Â Â Â Â Â dlopen_self=$dlopen_self_static |
---|
6596 | Â Â Â Â Â fi |
---|
6597 | Â Â Â Â Â prefer_static_libs=yes |
---|
6598 | Â Â Â Â Â ;; |
---|
6599 | Â Â Â Â esac |
---|
6600 | Â Â Â Â build_libtool_libs=no |
---|
6601 | Â Â Â Â build_old_libs=yes |
---|
6602 | Â Â Â Â break |
---|
6603 | Â Â Â Â ;; |
---|
6604 | Â Â Â esac |
---|
6605 | Â Â done |
---|
6606 | |
---|
6607 | Â Â # See if our shared archives depend on static archives. |
---|
6608 |   test -n "$old_archive_from_new_cmds" && build_old_libs=yes |
---|
6609 | |
---|
6610 | Â Â # Go through the arguments, transforming them on the way. |
---|
6611 |   while test "$#" -gt 0; do |
---|
6612 | Â Â Â arg=$1 |
---|
6613 | Â Â Â shift |
---|
6614 | Â Â Â func_quote_for_eval "$arg" |
---|
6615 | Â Â Â qarg=$func_quote_for_eval_unquoted_result |
---|
6616 | Â Â Â func_append libtool_args " $func_quote_for_eval_result" |
---|
6617 | |
---|
6618 | Â Â Â # If the previous option needs an argument, assign it. |
---|
6619 |    if test -n "$prev"; then |
---|
6620 |     case $prev in |
---|
6621 | Â Â Â Â output) |
---|
6622 | Â Â Â Â Â func_append compile_command " @OUTPUT@" |
---|
6623 | Â Â Â Â Â func_append finalize_command " @OUTPUT@" |
---|
6624 | Â Â Â Â Â ;; |
---|
6625 | Â Â Â Â esac |
---|
6626 | |
---|
6627 |     case $prev in |
---|
6628 | Â Â Â Â bindir) |
---|
6629 | Â Â Â Â Â bindir=$arg |
---|
6630 | Â Â Â Â Â prev= |
---|
6631 | Â Â Â Â Â continue |
---|
6632 | Â Â Â Â Â ;; |
---|
6633 | Â Â Â Â dlfiles|dlprefiles) |
---|
6634 |      $preload || { |
---|
6635 | Â Â Â Â Â Â # Add the symbol object into the linking commands. |
---|
6636 | Â Â Â Â Â Â func_append compile_command " @SYMFILE@" |
---|
6637 | Â Â Â Â Â Â func_append finalize_command " @SYMFILE@" |
---|
6638 | Â Â Â Â Â Â preload=: |
---|
6639 | Â Â Â Â Â } |
---|
6640 |      case $arg in |
---|
6641 | Â Â Â Â Â *.la | *.lo)Â ;;Â # We handle these cases below. |
---|
6642 | Â Â Â Â Â force) |
---|
6643 |       if test no = "$dlself"; then |
---|
6644 | Â Â Â Â Â Â Â dlself=needless |
---|
6645 | Â Â Â Â Â Â Â export_dynamic=yes |
---|
6646 | Â Â Â Â Â Â fi |
---|
6647 | Â Â Â Â Â Â prev= |
---|
6648 | Â Â Â Â Â Â continue |
---|
6649 | Â Â Â Â Â Â ;; |
---|
6650 | Â Â Â Â Â self) |
---|
6651 |       if test dlprefiles = "$prev"; then |
---|
6652 | Â Â Â Â Â Â Â dlself=yes |
---|
6653 |       elif test dlfiles = "$prev" && test yes != "$dlopen_self"; then |
---|
6654 | Â Â Â Â Â Â Â dlself=yes |
---|
6655 | Â Â Â Â Â Â else |
---|
6656 | Â Â Â Â Â Â Â dlself=needless |
---|
6657 | Â Â Â Â Â Â Â export_dynamic=yes |
---|
6658 | Â Â Â Â Â Â fi |
---|
6659 | Â Â Â Â Â Â prev= |
---|
6660 | Â Â Â Â Â Â continue |
---|
6661 | Â Â Â Â Â Â ;; |
---|
6662 | Â Â Â Â Â *) |
---|
6663 |       if test dlfiles = "$prev"; then |
---|
6664 | Â Â Â Â Â Â Â func_append dlfiles " $arg" |
---|
6665 | Â Â Â Â Â Â else |
---|
6666 | Â Â Â Â Â Â Â func_append dlprefiles " $arg" |
---|
6667 | Â Â Â Â Â Â fi |
---|
6668 | Â Â Â Â Â Â prev= |
---|
6669 | Â Â Â Â Â Â continue |
---|
6670 | Â Â Â Â Â Â ;; |
---|
6671 | Â Â Â Â Â esac |
---|
6672 | Â Â Â Â Â ;; |
---|
6673 | Â Â Â Â expsyms) |
---|
6674 | Â Â Â Â Â export_symbols=$arg |
---|
6675 |      test -f "$arg" \ |
---|
6676 | Â Â Â Â Â Â ||Â func_fatal_error "symbol file '$arg' does not exist" |
---|
6677 | Â Â Â Â Â prev= |
---|
6678 | Â Â Â Â Â continue |
---|
6679 | Â Â Â Â Â ;; |
---|
6680 | Â Â Â Â expsyms_regex) |
---|
6681 | Â Â Â Â Â export_symbols_regex=$arg |
---|
6682 | Â Â Â Â Â prev= |
---|
6683 | Â Â Â Â Â continue |
---|
6684 | Â Â Â Â Â ;; |
---|
6685 | Â Â Â Â framework) |
---|
6686 |      case $host in |
---|
6687 | Â Â Â Â Â Â *-*-darwin*) |
---|
6688 |        case "$deplibs " in |
---|
6689 | Â Â Â Â Â Â Â Â *" $qarg.ltframework "*)Â ;; |
---|
6690 | Â Â Â Â Â Â Â Â *)Â func_append deplibs " $qarg.ltframework"Â # this is fixed later |
---|
6691 | Â Â Â Â Â Â Â Â Â Â ;; |
---|
6692 | Â Â Â Â Â Â Â esac |
---|
6693 | Â Â Â Â Â Â Â ;; |
---|
6694 | Â Â Â Â Â esac |
---|
6695 | Â Â Â Â Â prev= |
---|
6696 | Â Â Â Â Â continue |
---|
6697 | Â Â Â Â Â ;; |
---|
6698 | Â Â Â Â inst_prefix) |
---|
6699 | Â Â Â Â Â inst_prefix_dir=$arg |
---|
6700 | Â Â Â Â Â prev= |
---|
6701 | Â Â Â Â Â continue |
---|
6702 | Â Â Â Â Â ;; |
---|
6703 | Â Â Â Â mllvm) |
---|
6704 | Â Â Â Â Â # Clang does not use LLVM to link, so we can simply discard any |
---|
6705 | Â Â Â Â Â # '-mllvm $arg' options when doing the link step. |
---|
6706 | Â Â Â Â Â prev= |
---|
6707 | Â Â Â Â Â continue |
---|
6708 | Â Â Â Â Â ;; |
---|
6709 | Â Â Â Â objectlist) |
---|
6710 |      if test -f "$arg"; then |
---|
6711 | Â Â Â Â Â Â save_arg=$arg |
---|
6712 | Â Â Â Â Â Â moreargs= |
---|
6713 | Â Â Â Â Â Â for fil in `cat "$save_arg"` |
---|
6714 | Â Â Â Â Â Â do |
---|
6715 | #Â Â Â Â Â Â Â func_append moreargs " $fil" |
---|
6716 | Â Â Â Â Â Â Â arg=$fil |
---|
6717 | Â Â Â Â Â Â Â # A libtool-controlled object. |
---|
6718 | |
---|
6719 | Â Â Â Â Â Â Â # Check to see that this really is a libtool object. |
---|
6720 | Â Â Â Â Â Â Â if func_lalib_unsafe_p "$arg"; then |
---|
6721 | Â Â Â Â Â Â Â Â pic_object= |
---|
6722 | Â Â Â Â Â Â Â Â non_pic_object= |
---|
6723 | |
---|
6724 | Â Â Â Â Â Â Â Â # Read the .lo file |
---|
6725 | Â Â Â Â Â Â Â Â func_source "$arg" |
---|
6726 | |
---|
6727 |         if test -z "$pic_object" || |
---|
6728 |           test -z "$non_pic_object" || |
---|
6729 |           test none = "$pic_object" && |
---|
6730 |           test none = "$non_pic_object"; then |
---|
6731 | Â Â Â Â Â Â Â Â Â func_fatal_error "cannot find name of object for '$arg'" |
---|
6732 | Â Â Â Â Â Â Â Â fi |
---|
6733 | |
---|
6734 | Â Â Â Â Â Â Â Â # Extract subdirectory from the argument. |
---|
6735 | Â Â Â Â Â Â Â Â func_dirname "$arg"Â "/"Â "" |
---|
6736 | Â Â Â Â Â Â Â Â xdir=$func_dirname_result |
---|
6737 | |
---|
6738 | Â Â Â Â Â Â Â Â if test none !=Â "$pic_object"; then |
---|
6739 | Â Â Â Â Â Â Â Â Â # Prepend the subdirectory the object is found in. |
---|
6740 | Â Â Â Â Â Â Â Â Â pic_object=$xdir$pic_object |
---|
6741 | |
---|
6742 |          if test dlfiles = "$prev"; then |
---|
6743 |           if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then |
---|
6744 | Â Â Â Â Â Â Â Â Â Â Â func_append dlfiles " $pic_object" |
---|
6745 | Â Â Â Â Â Â Â Â Â Â Â prev= |
---|
6746 | Â Â Â Â Â Â Â Â Â Â Â continue |
---|
6747 | Â Â Â Â Â Â Â Â Â Â else |
---|
6748 | Â Â Â Â Â Â Â Â Â Â Â # If libtool objects are unsupported, then we need to preload. |
---|
6749 | Â Â Â Â Â Â Â Â Â Â Â prev=dlprefiles |
---|
6750 | Â Â Â Â Â Â Â Â Â Â fi |
---|
6751 | Â Â Â Â Â Â Â Â Â fi |
---|
6752 | |
---|
6753 |          # CHECK ME: I think I busted this. -Ossama |
---|
6754 |          if test dlprefiles = "$prev"; then |
---|
6755 | Â Â Â Â Â Â Â Â Â Â # Preload the old-style object. |
---|
6756 | Â Â Â Â Â Â Â Â Â Â func_append dlprefiles " $pic_object" |
---|
6757 | Â Â Â Â Â Â Â Â Â Â prev= |
---|
6758 | Â Â Â Â Â Â Â Â Â fi |
---|
6759 | |
---|
6760 | Â Â Â Â Â Â Â Â Â # A PIC object. |
---|
6761 | Â Â Â Â Â Â Â Â Â func_append libobjs " $pic_object" |
---|
6762 | Â Â Â Â Â Â Â Â Â arg=$pic_object |
---|
6763 | Â Â Â Â Â Â Â Â fi |
---|
6764 | |
---|
6765 | Â Â Â Â Â Â Â Â # Non-PIC object. |
---|
6766 | Â Â Â Â Â Â Â Â if test none !=Â "$non_pic_object"; then |
---|
6767 | Â Â Â Â Â Â Â Â Â # Prepend the subdirectory the object is found in. |
---|
6768 | Â Â Â Â Â Â Â Â Â non_pic_object=$xdir$non_pic_object |
---|
6769 | |
---|
6770 | Â Â Â Â Â Â Â Â Â # A standard non-PIC object |
---|
6771 | Â Â Â Â Â Â Â Â Â func_append non_pic_objects " $non_pic_object" |
---|
6772 |          if test -z "$pic_object" || test none = "$pic_object"; then |
---|
6773 | Â Â Â Â Â Â Â Â Â Â arg=$non_pic_object |
---|
6774 | Â Â Â Â Â Â Â Â Â fi |
---|
6775 | Â Â Â Â Â Â Â Â else |
---|
6776 | Â Â Â Â Â Â Â Â Â # If the PIC object exists, use it instead. |
---|
6777 | Â Â Â Â Â Â Â Â Â # $xdir was prepended to $pic_object above. |
---|
6778 | Â Â Â Â Â Â Â Â Â non_pic_object=$pic_object |
---|
6779 | Â Â Â Â Â Â Â Â Â func_append non_pic_objects " $non_pic_object" |
---|
6780 | Â Â Â Â Â Â Â Â fi |
---|
6781 | Â Â Â Â Â Â Â else |
---|
6782 | Â Â Â Â Â Â Â Â # Only an error if not doing a dry-run. |
---|
6783 |         if $opt_dry_run; then |
---|
6784 | Â Â Â Â Â Â Â Â Â # Extract subdirectory from the argument. |
---|
6785 | Â Â Â Â Â Â Â Â Â func_dirname "$arg"Â "/"Â "" |
---|
6786 | Â Â Â Â Â Â Â Â Â xdir=$func_dirname_result |
---|
6787 | |
---|
6788 | Â Â Â Â Â Â Â Â Â func_lo2o "$arg" |
---|
6789 | Â Â Â Â Â Â Â Â Â pic_object=$xdir$objdir/$func_lo2o_result |
---|
6790 | Â Â Â Â Â Â Â Â Â non_pic_object=$xdir$func_lo2o_result |
---|
6791 | Â Â Â Â Â Â Â Â Â func_append libobjs " $pic_object" |
---|
6792 | Â Â Â Â Â Â Â Â Â func_append non_pic_objects " $non_pic_object" |
---|
6793 | Â Â Â Â Â Â Â Â else |
---|
6794 | Â Â Â Â Â Â Â Â Â func_fatal_error "'$arg' is not a valid libtool object" |
---|
6795 | Â Â Â Â Â Â Â Â fi |
---|
6796 | Â Â Â Â Â Â Â fi |
---|
6797 | Â Â Â Â Â Â done |
---|
6798 | Â Â Â Â Â else |
---|
6799 | Â Â Â Â Â Â func_fatal_error "link input file '$arg' does not exist" |
---|
6800 | Â Â Â Â Â fi |
---|
6801 | Â Â Â Â Â arg=$save_arg |
---|
6802 | Â Â Â Â Â prev= |
---|
6803 | Â Â Â Â Â continue |
---|
6804 | Â Â Â Â Â ;; |
---|
6805 | Â Â Â Â os2dllname) |
---|
6806 | Â Â Â Â Â os2dllname=$arg |
---|
6807 | Â Â Â Â Â prev= |
---|
6808 | Â Â Â Â Â continue |
---|
6809 | Â Â Â Â Â ;; |
---|
6810 | Â Â Â Â precious_regex) |
---|
6811 | Â Â Â Â Â precious_files_regex=$arg |
---|
6812 | Â Â Â Â Â prev= |
---|
6813 | Â Â Â Â Â continue |
---|
6814 | Â Â Â Â Â ;; |
---|
6815 | Â Â Â Â release) |
---|
6816 | Â Â Â Â Â release=-$arg |
---|
6817 | Â Â Â Â Â prev= |
---|
6818 | Â Â Â Â Â continue |
---|
6819 | Â Â Â Â Â ;; |
---|
6820 | Â Â Â Â rpath | xrpath) |
---|
6821 | Â Â Â Â Â # We need an absolute path. |
---|
6822 |      case $arg in |
---|
6823 | Â Â Â Â Â [\\/]* | [A-Za-z]:[\\/]*)Â ;; |
---|
6824 | Â Â Â Â Â *) |
---|
6825 | Â Â Â Â Â Â func_fatal_error "only absolute run-paths are allowed" |
---|
6826 | Â Â Â Â Â Â ;; |
---|
6827 | Â Â Â Â Â esac |
---|
6828 |      if test rpath = "$prev"; then |
---|
6829 |       case "$rpath " in |
---|
6830 | Â Â Â Â Â Â *" $arg "*)Â ;; |
---|
6831 | Â Â Â Â Â Â *)Â func_append rpath " $arg"Â ;; |
---|
6832 | Â Â Â Â Â Â esac |
---|
6833 | Â Â Â Â Â else |
---|
6834 |       case "$xrpath " in |
---|
6835 | Â Â Â Â Â Â *" $arg "*)Â ;; |
---|
6836 | Â Â Â Â Â Â *)Â func_append xrpath " $arg"Â ;; |
---|
6837 | Â Â Â Â Â Â esac |
---|
6838 | Â Â Â Â Â fi |
---|
6839 | Â Â Â Â Â prev= |
---|
6840 | Â Â Â Â Â continue |
---|
6841 | Â Â Â Â Â ;; |
---|
6842 | Â Â Â Â shrext) |
---|
6843 | Â Â Â Â Â shrext_cmds=$arg |
---|
6844 | Â Â Â Â Â prev= |
---|
6845 | Â Â Â Â Â continue |
---|
6846 | Â Â Â Â Â ;; |
---|
6847 | Â Â Â Â weak) |
---|
6848 | Â Â Â Â Â func_append weak_libs " $arg" |
---|
6849 | Â Â Â Â Â prev= |
---|
6850 | Â Â Â Â Â continue |
---|
6851 | Â Â Â Â Â ;; |
---|
6852 | Â Â Â Â xcclinker) |
---|
6853 | Â Â Â Â Â func_append linker_flags " $qarg" |
---|
6854 | Â Â Â Â Â func_append compiler_flags " $qarg" |
---|
6855 | Â Â Â Â Â prev= |
---|
6856 | Â Â Â Â Â func_append compile_command " $qarg" |
---|
6857 | Â Â Â Â Â func_append finalize_command " $qarg" |
---|
6858 | Â Â Â Â Â continue |
---|
6859 | Â Â Â Â Â ;; |
---|
6860 | Â Â Â Â xcompiler) |
---|
6861 | Â Â Â Â Â func_append compiler_flags " $qarg" |
---|
6862 | Â Â Â Â Â prev= |
---|
6863 | Â Â Â Â Â func_append compile_command " $qarg" |
---|
6864 | Â Â Â Â Â func_append finalize_command " $qarg" |
---|
6865 | Â Â Â Â Â continue |
---|
6866 | Â Â Â Â Â ;; |
---|
6867 | Â Â Â Â xlinker) |
---|
6868 | Â Â Â Â Â func_append linker_flags " $qarg" |
---|
6869 | Â Â Â Â Â func_append compiler_flags " $wl$qarg" |
---|
6870 | Â Â Â Â Â prev= |
---|
6871 | Â Â Â Â Â func_append compile_command " $wl$qarg" |
---|
6872 | Â Â Â Â Â func_append finalize_command " $wl$qarg" |
---|
6873 | Â Â Â Â Â continue |
---|
6874 | Â Â Â Â Â ;; |
---|
6875 | Â Â Â Â *) |
---|
6876 |      eval "$prev=\"\$arg\"" |
---|
6877 | Â Â Â Â Â prev= |
---|
6878 | Â Â Â Â Â continue |
---|
6879 | Â Â Â Â Â ;; |
---|
6880 | Â Â Â Â esac |
---|
6881 |    fi # test -n "$prev" |
---|
6882 | |
---|
6883 | Â Â Â prevarg=$arg |
---|
6884 | |
---|
6885 |    case $arg in |
---|
6886 | Â Â Â -all-static) |
---|
6887 |     if test -n "$link_static_flag"; then |
---|
6888 | Â Â Â Â Â # See comment for -static flag below, for more details. |
---|
6889 | Â Â Â Â Â func_append compile_command " $link_static_flag" |
---|
6890 | Â Â Â Â Â func_append finalize_command " $link_static_flag" |
---|
6891 | Â Â Â Â fi |
---|
6892 | Â Â Â Â continue |
---|
6893 | Â Â Â Â ;; |
---|
6894 | |
---|
6895 | Â Â Â -allow-undefined) |
---|
6896 | Â Â Â Â # FIXME: remove this flag sometime in the future. |
---|
6897 | Â Â Â Â func_fatal_error "'-allow-undefined' must not be used because it is the default" |
---|
6898 | Â Â Â Â ;; |
---|
6899 | |
---|
6900 | Â Â Â -avoid-version) |
---|
6901 | Â Â Â Â avoid_version=yes |
---|
6902 | Â Â Â Â continue |
---|
6903 | Â Â Â Â ;; |
---|
6904 | |
---|
6905 | Â Â Â -bindir) |
---|
6906 | Â Â Â Â prev=bindir |
---|
6907 | Â Â Â Â continue |
---|
6908 | Â Â Â Â ;; |
---|
6909 | |
---|
6910 | Â Â Â -dlopen) |
---|
6911 | Â Â Â Â prev=dlfiles |
---|
6912 | Â Â Â Â continue |
---|
6913 | Â Â Â Â ;; |
---|
6914 | |
---|
6915 | Â Â Â -dlpreopen) |
---|
6916 | Â Â Â Â prev=dlprefiles |
---|
6917 | Â Â Â Â continue |
---|
6918 | Â Â Â Â ;; |
---|
6919 | |
---|
6920 | Â Â Â -export-dynamic) |
---|
6921 | Â Â Â Â export_dynamic=yes |
---|
6922 | Â Â Â Â continue |
---|
6923 | Â Â Â Â ;; |
---|
6924 | |
---|
6925 | Â Â Â -export-symbols | -export-symbols-regex) |
---|
6926 |     if test -n "$export_symbols" || test -n "$export_symbols_regex"; then |
---|
6927 | Â Â Â Â Â func_fatal_error "more than one -exported-symbols argument is not allowed" |
---|
6928 | Â Â Â Â fi |
---|
6929 | Â Â Â Â if test X-export-symbols =Â "X$arg"; then |
---|
6930 | Â Â Â Â Â prev=expsyms |
---|
6931 | Â Â Â Â else |
---|
6932 | Â Â Â Â Â prev=expsyms_regex |
---|
6933 | Â Â Â Â fi |
---|
6934 | Â Â Â Â continue |
---|
6935 | Â Â Â Â ;; |
---|
6936 | |
---|
6937 | Â Â Â -framework) |
---|
6938 | Â Â Â Â prev=framework |
---|
6939 | Â Â Â Â continue |
---|
6940 | Â Â Â Â ;; |
---|
6941 | |
---|
6942 | Â Â Â -inst-prefix-dir) |
---|
6943 | Â Â Â Â prev=inst_prefix |
---|
6944 | Â Â Â Â continue |
---|
6945 | Â Â Â Â ;; |
---|
6946 | |
---|
6947 | Â Â Â # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* |
---|
6948 | Â Â Â # so, if we see these flags be careful not to treat them like -L |
---|
6949 | Â Â Â -L[A-Z][A-Z]*:*) |
---|
6950 |     case $with_gcc/$host in |
---|
6951 | Â Â Â Â no/*-*-irix* | /*-*-irix*) |
---|
6952 | Â Â Â Â Â func_append compile_command " $arg" |
---|
6953 | Â Â Â Â Â func_append finalize_command " $arg" |
---|
6954 | Â Â Â Â Â ;; |
---|
6955 | Â Â Â Â esac |
---|
6956 | Â Â Â Â continue |
---|
6957 | Â Â Â Â ;; |
---|
6958 | |
---|
6959 | Â Â Â -L*) |
---|
6960 | Â Â Â Â func_stripname "-L"Â ''Â "$arg" |
---|
6961 |     if test -z "$func_stripname_result"; then |
---|
6962 |      if test "$#" -gt 0; then |
---|
6963 | Â Â Â Â Â Â func_fatal_error "require no space between '-L' and '$1'" |
---|
6964 | Â Â Â Â Â else |
---|
6965 | Â Â Â Â Â Â func_fatal_error "need path for '-L' option" |
---|
6966 | Â Â Â Â Â fi |
---|
6967 | Â Â Â Â fi |
---|
6968 | Â Â Â Â func_resolve_sysroot "$func_stripname_result" |
---|
6969 | Â Â Â Â dir=$func_resolve_sysroot_result |
---|
6970 | Â Â Â Â # We need an absolute path. |
---|
6971 |     case $dir in |
---|
6972 | Â Â Â Â [\\/]* | [A-Za-z]:[\\/]*)Â ;; |
---|
6973 | Â Â Â Â *) |
---|
6974 |      absdir=`cd "$dir" && pwd` |
---|
6975 |      test -z "$absdir" && \ |
---|
6976 | Â Â Â Â Â Â func_fatal_error "cannot determine absolute directory name of '$dir'" |
---|
6977 | Â Â Â Â Â dir=$absdir |
---|
6978 | Â Â Â Â Â ;; |
---|
6979 | Â Â Â Â esac |
---|
6980 |     case "$deplibs " in |
---|
6981 | Â Â Â Â *" -L$dir "* | *" $arg "*) |
---|
6982 | Â Â Â Â Â # Will only happen for absolute or sysroot arguments |
---|
6983 | Â Â Â Â Â ;; |
---|
6984 | Â Â Â Â *) |
---|
6985 | Â Â Â Â Â # Preserve sysroot, but never include relative directories |
---|
6986 |      case $dir in |
---|
6987 | Â Â Â Â Â Â [\\/]* | [A-Za-z]:[\\/]* | =*)Â func_append deplibs " $arg"Â ;; |
---|
6988 | Â Â Â Â Â Â *)Â func_append deplibs " -L$dir"Â ;; |
---|
6989 | Â Â Â Â Â esac |
---|
6990 | Â Â Â Â Â func_append lib_search_path " $dir" |
---|
6991 | Â Â Â Â Â ;; |
---|
6992 | Â Â Â Â esac |
---|
6993 |     case $host in |
---|
6994 | Â Â Â Â *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) |
---|
6995 | Â Â Â Â Â testbindir=`$ECHOÂ "$dir"Â | $SEDÂ 's*/lib$*/bin*'` |
---|
6996 |      case :$dllsearchpath: in |
---|
6997 | Â Â Â Â Â *":$dir:"*)Â ;; |
---|
6998 | Â Â Â Â Â ::)Â dllsearchpath=$dir;; |
---|
6999 | Â Â Â Â Â *)Â func_append dllsearchpath ":$dir";; |
---|
7000 | Â Â Â Â Â esac |
---|
7001 |      case :$dllsearchpath: in |
---|
7002 | Â Â Â Â Â *":$testbindir:"*)Â ;; |
---|
7003 | Â Â Â Â Â ::)Â dllsearchpath=$testbindir;; |
---|
7004 | Â Â Â Â Â *)Â func_append dllsearchpath ":$testbindir";; |
---|
7005 | Â Â Â Â Â esac |
---|
7006 | Â Â Â Â Â ;; |
---|
7007 | Â Â Â Â esac |
---|
7008 | Â Â Â Â continue |
---|
7009 | Â Â Â Â ;; |
---|
7010 | |
---|
7011 | Â Â Â -l*) |
---|
7012 | Â Â Â Â if test X-lc =Â "X$arg"Â ||Â test X-lm =Â "X$arg"; then |
---|
7013 |      case $host in |
---|
7014 | Â Â Â Â Â *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) |
---|
7015 | Â Â Â Â Â Â # These systems don't actually have a C or math library (as such) |
---|
7016 | Â Â Â Â Â Â continue |
---|
7017 | Â Â Â Â Â Â ;; |
---|
7018 | Â Â Â Â Â *-*-os2*) |
---|
7019 | Â Â Â Â Â Â # These systems don't actually have a C library (as such) |
---|
7020 | Â Â Â Â Â Â test X-lc =Â "X$arg"Â &&Â continue |
---|
7021 | Â Â Â Â Â Â ;; |
---|
7022 | Â Â Â Â Â *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*) |
---|
7023 | Â Â Â Â Â Â # Do not include libc due to us having libc/libc_r. |
---|
7024 | Â Â Â Â Â Â test X-lc =Â "X$arg"Â &&Â continue |
---|
7025 | Â Â Â Â Â Â ;; |
---|
7026 | Â Â Â Â Â *-*-rhapsody* | *-*-darwin1.[012]) |
---|
7027 | Â Â Â Â Â Â # Rhapsody C and math libraries are in the System framework |
---|
7028 | Â Â Â Â Â Â func_append deplibs " System.ltframework" |
---|
7029 | Â Â Â Â Â Â continue |
---|
7030 | Â Â Â Â Â Â ;; |
---|
7031 | Â Â Â Â Â *-*-sco3.2v5* | *-*-sco5v6*) |
---|
7032 | Â Â Â Â Â Â # Causes problems with __ctype |
---|
7033 | Â Â Â Â Â Â test X-lc =Â "X$arg"Â &&Â continue |
---|
7034 | Â Â Â Â Â Â ;; |
---|
7035 | Â Â Â Â Â *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) |
---|
7036 | Â Â Â Â Â Â # Compiler inserts libc in the correct place for threads to work |
---|
7037 | Â Â Â Â Â Â test X-lc =Â "X$arg"Â &&Â continue |
---|
7038 | Â Â Â Â Â Â ;; |
---|
7039 | Â Â Â Â Â esac |
---|
7040 | Â Â Â Â elif test X-lc_r =Â "X$arg"; then |
---|
7041 |      case $host in |
---|
7042 | Â Â Â Â Â *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*) |
---|
7043 | Â Â Â Â Â Â # Do not include libc_r directly, use -pthread flag. |
---|
7044 | Â Â Â Â Â Â continue |
---|
7045 | Â Â Â Â Â Â ;; |
---|
7046 | Â Â Â Â Â esac |
---|
7047 | Â Â Â Â fi |
---|
7048 | Â Â Â Â func_append deplibs " $arg" |
---|
7049 | Â Â Â Â continue |
---|
7050 | Â Â Â Â ;; |
---|
7051 | |
---|
7052 | Â Â Â -mllvm) |
---|
7053 | Â Â Â Â prev=mllvm |
---|
7054 | Â Â Â Â continue |
---|
7055 | Â Â Â Â ;; |
---|
7056 | |
---|
7057 | Â Â Â -module) |
---|
7058 | Â Â Â Â module=yes |
---|
7059 | Â Â Â Â continue |
---|
7060 | Â Â Â Â ;; |
---|
7061 | |
---|
7062 | Â Â Â # Tru64 UNIX uses -model [arg] to determine the layout of C++ |
---|
7063 | Â Â Â # classes, name mangling, and exception handling. |
---|
7064 | Â Â Â # Darwin uses the -arch flag to determine output architecture. |
---|
7065 | Â Â Â -model|-arch|-isysroot|--sysroot) |
---|
7066 | Â Â Â Â func_append compiler_flags " $arg" |
---|
7067 | Â Â Â Â func_append compile_command " $arg" |
---|
7068 | Â Â Â Â func_append finalize_command " $arg" |
---|
7069 | Â Â Â Â prev=xcompiler |
---|
7070 | Â Â Â Â continue |
---|
7071 | Â Â Â Â ;; |
---|
7072 | |
---|
7073 | Â Â Â -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ |
---|
7074 | Â Â Â |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) |
---|
7075 | Â Â Â Â func_append compiler_flags " $arg" |
---|
7076 | Â Â Â Â func_append compile_command " $arg" |
---|
7077 | Â Â Â Â func_append finalize_command " $arg" |
---|
7078 |     case "$new_inherited_linker_flags " in |
---|
7079 | Â Â Â Â Â Â *" $arg "*)Â ;; |
---|
7080 | Â Â Â Â Â Â * )Â func_append new_inherited_linker_flags " $arg"Â ;; |
---|
7081 | Â Â Â Â esac |
---|
7082 | Â Â Â Â continue |
---|
7083 | Â Â Â Â ;; |
---|
7084 | |
---|
7085 | Â Â Â -multi_module) |
---|
7086 | Â Â Â Â single_module=$wl-multi_module |
---|
7087 | Â Â Â Â continue |
---|
7088 | Â Â Â Â ;; |
---|
7089 | |
---|
7090 | Â Â Â -no-fast-install) |
---|
7091 | Â Â Â Â fast_install=no |
---|
7092 | Â Â Â Â continue |
---|
7093 | Â Â Â Â ;; |
---|
7094 | |
---|
7095 | Â Â Â -no-install) |
---|
7096 |     case $host in |
---|
7097 | Â Â Â Â *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) |
---|
7098 | Â Â Â Â Â # The PATH hackery in wrapper scripts is required on Windows |
---|
7099 | Â Â Â Â Â # and Darwin in order for the loader to find any dlls it needs. |
---|
7100 | Â Â Â Â Â func_warning "'-no-install' is ignored for $host" |
---|
7101 | Â Â Â Â Â func_warning "assuming '-no-fast-install' instead" |
---|
7102 | Â Â Â Â Â fast_install=no |
---|
7103 | Â Â Â Â Â ;; |
---|
7104 | Â Â Â Â *)Â no_install=yes ;; |
---|
7105 | Â Â Â Â esac |
---|
7106 | Â Â Â Â continue |
---|
7107 | Â Â Â Â ;; |
---|
7108 | |
---|
7109 | Â Â Â -no-undefined) |
---|
7110 | Â Â Â Â allow_undefined=no |
---|
7111 | Â Â Â Â continue |
---|
7112 | Â Â Â Â ;; |
---|
7113 | |
---|
7114 | Â Â Â -objectlist) |
---|
7115 | Â Â Â Â prev=objectlist |
---|
7116 | Â Â Â Â continue |
---|
7117 | Â Â Â Â ;; |
---|
7118 | |
---|
7119 | Â Â Â -os2dllname) |
---|
7120 | Â Â Â Â prev=os2dllname |
---|
7121 | Â Â Â Â continue |
---|
7122 | Â Â Â Â ;; |
---|
7123 | |
---|
7124 | Â Â Â -o)Â prev=output ;; |
---|
7125 | |
---|
7126 | Â Â Â -precious-files-regex) |
---|
7127 | Â Â Â Â prev=precious_regex |
---|
7128 | Â Â Â Â continue |
---|
7129 | Â Â Â Â ;; |
---|
7130 | |
---|
7131 | Â Â Â -release) |
---|
7132 | Â Â Â Â prev=release |
---|
7133 | Â Â Â Â continue |
---|
7134 | Â Â Â Â ;; |
---|
7135 | |
---|
7136 | Â Â Â -rpath) |
---|
7137 | Â Â Â Â prev=rpath |
---|
7138 | Â Â Â Â continue |
---|
7139 | Â Â Â Â ;; |
---|
7140 | |
---|
7141 | Â Â Â -R) |
---|
7142 | Â Â Â Â prev=xrpath |
---|
7143 | Â Â Â Â continue |
---|
7144 | Â Â Â Â ;; |
---|
7145 | |
---|
7146 | Â Â Â -R*) |
---|
7147 | Â Â Â Â func_stripname '-R'Â ''Â "$arg" |
---|
7148 | Â Â Â Â dir=$func_stripname_result |
---|
7149 | Â Â Â Â # We need an absolute path. |
---|
7150 |     case $dir in |
---|
7151 | Â Â Â Â [\\/]* | [A-Za-z]:[\\/]*)Â ;; |
---|
7152 | Â Â Â Â =*) |
---|
7153 | Â Â Â Â Â func_stripname '='Â ''Â "$dir" |
---|
7154 | Â Â Â Â Â dir=$lt_sysroot$func_stripname_result |
---|
7155 | Â Â Â Â Â ;; |
---|
7156 | Â Â Â Â *) |
---|
7157 | Â Â Â Â Â func_fatal_error "only absolute run-paths are allowed" |
---|
7158 | Â Â Â Â Â ;; |
---|
7159 | Â Â Â Â esac |
---|
7160 |     case "$xrpath " in |
---|
7161 | Â Â Â Â *" $dir "*)Â ;; |
---|
7162 | Â Â Â Â *)Â func_append xrpath " $dir"Â ;; |
---|
7163 | Â Â Â Â esac |
---|
7164 | Â Â Â Â continue |
---|
7165 | Â Â Â Â ;; |
---|
7166 | |
---|
7167 | Â Â Â -shared) |
---|
7168 | Â Â Â Â # The effects of -shared are defined in a previous loop. |
---|
7169 | Â Â Â Â continue |
---|
7170 | Â Â Â Â ;; |
---|
7171 | |
---|
7172 | Â Â Â -shrext) |
---|
7173 | Â Â Â Â prev=shrext |
---|
7174 | Â Â Â Â continue |
---|
7175 | Â Â Â Â ;; |
---|
7176 | |
---|
7177 | Â Â Â -static | -static-libtool-libs) |
---|
7178 | Â Â Â Â # The effects of -static are defined in a previous loop. |
---|
7179 | Â Â Â Â # We used to do the same as -all-static on platforms that |
---|
7180 | Â Â Â Â # didn't have a PIC flag, but the assumption that the effects |
---|
7181 |     # would be equivalent was wrong. It would break on at least |
---|
7182 | Â Â Â Â # Digital Unix and AIX. |
---|
7183 | Â Â Â Â continue |
---|
7184 | Â Â Â Â ;; |
---|
7185 | |
---|
7186 | Â Â Â -thread-safe) |
---|
7187 | Â Â Â Â thread_safe=yes |
---|
7188 | Â Â Â Â continue |
---|
7189 | Â Â Â Â ;; |
---|
7190 | |
---|
7191 | Â Â Â -version-info) |
---|
7192 | Â Â Â Â prev=vinfo |
---|
7193 | Â Â Â Â continue |
---|
7194 | Â Â Â Â ;; |
---|
7195 | |
---|
7196 | Â Â Â -version-number) |
---|
7197 | Â Â Â Â prev=vinfo |
---|
7198 | Â Â Â Â vinfo_number=yes |
---|
7199 | Â Â Â Â continue |
---|
7200 | Â Â Â Â ;; |
---|
7201 | |
---|
7202 | Â Â Â -weak) |
---|
7203 | Â Â Â Â prev=weak |
---|
7204 | Â Â Â Â continue |
---|
7205 | Â Â Â Â ;; |
---|
7206 | |
---|
7207 | Â Â Â -Wc,*) |
---|
7208 | Â Â Â Â func_stripname '-Wc,'Â ''Â "$arg" |
---|
7209 | Â Â Â Â args=$func_stripname_result |
---|
7210 | Â Â Â Â arg= |
---|
7211 | Â Â Â Â save_ifs=$IFS; IFS=, |
---|
7212 | Â Â Â Â for flag in $args; do |
---|
7213 | Â Â Â Â Â IFS=$save_ifs |
---|
7214 | Â Â Â Â Â func_quote_for_eval "$flag" |
---|
7215 | Â Â Â Â Â func_append arg " $func_quote_for_eval_result" |
---|
7216 | Â Â Â Â Â func_append compiler_flags " $func_quote_for_eval_result" |
---|
7217 | Â Â Â Â done |
---|
7218 | Â Â Â Â IFS=$save_ifs |
---|
7219 | Â Â Â Â func_stripname ' 'Â ''Â "$arg" |
---|
7220 | Â Â Â Â arg=$func_stripname_result |
---|
7221 | Â Â Â Â ;; |
---|
7222 | |
---|
7223 | Â Â Â -Wl,*) |
---|
7224 | Â Â Â Â func_stripname '-Wl,'Â ''Â "$arg" |
---|
7225 | Â Â Â Â args=$func_stripname_result |
---|
7226 | Â Â Â Â arg= |
---|
7227 | Â Â Â Â save_ifs=$IFS; IFS=, |
---|
7228 | Â Â Â Â for flag in $args; do |
---|
7229 | Â Â Â Â Â IFS=$save_ifs |
---|
7230 | Â Â Â Â Â func_quote_for_eval "$flag" |
---|
7231 | Â Â Â Â Â func_append arg " $wl$func_quote_for_eval_result" |
---|
7232 | Â Â Â Â Â func_append compiler_flags " $wl$func_quote_for_eval_result" |
---|
7233 | Â Â Â Â Â func_append linker_flags " $func_quote_for_eval_result" |
---|
7234 | Â Â Â Â done |
---|
7235 | Â Â Â Â IFS=$save_ifs |
---|
7236 | Â Â Â Â func_stripname ' 'Â ''Â "$arg" |
---|
7237 | Â Â Â Â arg=$func_stripname_result |
---|
7238 | Â Â Â Â ;; |
---|
7239 | |
---|
7240 | Â Â Â -Xcompiler) |
---|
7241 | Â Â Â Â prev=xcompiler |
---|
7242 | Â Â Â Â continue |
---|
7243 | Â Â Â Â ;; |
---|
7244 | |
---|
7245 | Â Â Â -Xlinker) |
---|
7246 | Â Â Â Â prev=xlinker |
---|
7247 | Â Â Â Â continue |
---|
7248 | Â Â Â Â ;; |
---|
7249 | |
---|
7250 | Â Â Â -XCClinker) |
---|
7251 | Â Â Â Â prev=xcclinker |
---|
7252 | Â Â Â Â continue |
---|
7253 | Â Â Â Â ;; |
---|
7254 | |
---|
7255 | Â Â Â # -msg_* for osf cc |
---|
7256 | Â Â Â -msg_*) |
---|
7257 | Â Â Â Â func_quote_for_eval "$arg" |
---|
7258 | Â Â Â Â arg=$func_quote_for_eval_result |
---|
7259 | Â Â Â Â ;; |
---|
7260 | |
---|
7261 | Â Â Â # Flags to be passed through unchanged, with rationale: |
---|
7262 | Â Â Â # -64, -mips[0-9]Â Â Â enable 64-bit mode for the SGI compiler |
---|
7263 | Â Â Â # -r[0-9][0-9]*Â Â Â Â specify processor for the SGI compiler |
---|
7264 | Â Â Â # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler |
---|
7265 | Â Â Â # +DA*, +DD*Â Â Â Â Â Â enable 64-bit mode for the HP compiler |
---|
7266 | Â Â Â # -q*Â Â Â Â Â Â Â Â Â compiler args for the IBM compiler |
---|
7267 | Â Â Â # -m*, -t[45]*, -txscale* architecture-specific flags for GCC |
---|
7268 |    # -F/path       path to uninstalled frameworks, gcc on darwin |
---|
7269 | Â Â Â # -p, -pg, --coverage, -fprofile-*Â profiling flags for GCC |
---|
7270 | Â Â Â # -fstack-protector*Â Â stack protector flags for GCC |
---|
7271 |    # @file        GCC response files |
---|
7272 | Â Â Â # -tp=*Â Â Â Â Â Â Â Â Portland pgcc target processor selection |
---|
7273 | Â Â Â # --sysroot=*Â Â Â Â Â for sysroot support |
---|
7274 | Â Â Â # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization |
---|
7275 | Â Â Â # -stdlib=*Â Â Â Â Â Â select c++ std lib with clang |
---|
7276 | Â Â Â -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ |
---|
7277 | Â Â Â -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ |
---|
7278 | Â Â Â -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*) |
---|
7279 | Â Â Â Â func_quote_for_eval "$arg" |
---|
7280 | Â Â Â Â arg=$func_quote_for_eval_result |
---|
7281 | Â Â Â Â func_append compile_command " $arg" |
---|
7282 | Â Â Â Â func_append finalize_command " $arg" |
---|
7283 | Â Â Â Â func_append compiler_flags " $arg" |
---|
7284 | Â Â Â Â continue |
---|
7285 | Â Â Â Â ;; |
---|
7286 | |
---|
7287 | Â Â Â -Z*) |
---|
7288 | Â Â Â Â if test os2Â =Â "`expr $host : '.*\(os2\)'`"; then |
---|
7289 | Â Â Â Â Â # OS/2 uses -Zxxx to specify OS/2-specific options |
---|
7290 | Â Â Â Â Â compiler_flags="$compiler_flags $arg" |
---|
7291 | Â Â Â Â Â func_append compile_command " $arg" |
---|
7292 | Â Â Â Â Â func_append finalize_command " $arg" |
---|
7293 |      case $arg in |
---|
7294 | Â Â Â Â Â -Zlinker | -Zstack) |
---|
7295 | Â Â Â Â Â Â prev=xcompiler |
---|
7296 | Â Â Â Â Â Â ;; |
---|
7297 | Â Â Â Â Â esac |
---|
7298 | Â Â Â Â Â continue |
---|
7299 | Â Â Â Â else |
---|
7300 | Â Â Â Â Â # Otherwise treat like 'Some other compiler flag' below |
---|
7301 | Â Â Â Â Â func_quote_for_eval "$arg" |
---|
7302 | Â Â Â Â Â arg=$func_quote_for_eval_result |
---|
7303 | Â Â Â Â fi |
---|
7304 | Â Â Â Â ;; |
---|
7305 | |
---|
7306 | Â Â Â # Some other compiler flag. |
---|
7307 | Â Â Â -* | +*) |
---|
7308 | Â Â Â Â func_quote_for_eval "$arg" |
---|
7309 | Â Â Â Â arg=$func_quote_for_eval_result |
---|
7310 | Â Â Â Â ;; |
---|
7311 | |
---|
7312 | Â Â Â *.$objext) |
---|
7313 | Â Â Â Â # A standard object. |
---|
7314 | Â Â Â Â func_append objs " $arg" |
---|
7315 | Â Â Â Â ;; |
---|
7316 | |
---|
7317 | Â Â Â *.lo) |
---|
7318 | Â Â Â Â # A libtool-controlled object. |
---|
7319 | |
---|
7320 | Â Â Â Â # Check to see that this really is a libtool object. |
---|
7321 | Â Â Â Â if func_lalib_unsafe_p "$arg"; then |
---|
7322 | Â Â Â Â Â pic_object= |
---|
7323 | Â Â Â Â Â non_pic_object= |
---|
7324 | |
---|
7325 | Â Â Â Â Â # Read the .lo file |
---|
7326 | Â Â Â Â Â func_source "$arg" |
---|
7327 | |
---|
7328 |      if test -z "$pic_object" || |
---|
7329 |        test -z "$non_pic_object" || |
---|
7330 |        test none = "$pic_object" && |
---|
7331 |        test none = "$non_pic_object"; then |
---|
7332 | Â Â Â Â Â Â func_fatal_error "cannot find name of object for '$arg'" |
---|
7333 | Â Â Â Â Â fi |
---|
7334 | |
---|
7335 | Â Â Â Â Â # Extract subdirectory from the argument. |
---|
7336 | Â Â Â Â Â func_dirname "$arg"Â "/"Â "" |
---|
7337 | Â Â Â Â Â xdir=$func_dirname_result |
---|
7338 | |
---|
7339 |      test none = "$pic_object" || { |
---|
7340 | Â Â Â Â Â Â # Prepend the subdirectory the object is found in. |
---|
7341 | Â Â Â Â Â Â pic_object=$xdir$pic_object |
---|
7342 | |
---|
7343 |       if test dlfiles = "$prev"; then |
---|
7344 |        if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then |
---|
7345 | Â Â Â Â Â Â Â Â func_append dlfiles " $pic_object" |
---|
7346 | Â Â Â Â Â Â Â Â prev= |
---|
7347 | Â Â Â Â Â Â Â Â continue |
---|
7348 | Â Â Â Â Â Â Â else |
---|
7349 | Â Â Â Â Â Â Â Â # If libtool objects are unsupported, then we need to preload. |
---|
7350 | Â Â Â Â Â Â Â Â prev=dlprefiles |
---|
7351 | Â Â Â Â Â Â Â fi |
---|
7352 | Â Â Â Â Â Â fi |
---|
7353 | |
---|
7354 |       # CHECK ME: I think I busted this. -Ossama |
---|
7355 |       if test dlprefiles = "$prev"; then |
---|
7356 | Â Â Â Â Â Â Â # Preload the old-style object. |
---|
7357 | Â Â Â Â Â Â Â func_append dlprefiles " $pic_object" |
---|
7358 | Â Â Â Â Â Â Â prev= |
---|
7359 | Â Â Â Â Â Â fi |
---|
7360 | |
---|
7361 | Â Â Â Â Â Â # A PIC object. |
---|
7362 | Â Â Â Â Â Â func_append libobjs " $pic_object" |
---|
7363 | Â Â Â Â Â Â arg=$pic_object |
---|
7364 | Â Â Â Â Â } |
---|
7365 | |
---|
7366 | Â Â Â Â Â # Non-PIC object. |
---|
7367 | Â Â Â Â Â if test none !=Â "$non_pic_object"; then |
---|
7368 | Â Â Â Â Â Â # Prepend the subdirectory the object is found in. |
---|
7369 | Â Â Â Â Â Â non_pic_object=$xdir$non_pic_object |
---|
7370 | |
---|
7371 | Â Â Â Â Â Â # A standard non-PIC object |
---|
7372 | Â Â Â Â Â Â func_append non_pic_objects " $non_pic_object" |
---|
7373 |       if test -z "$pic_object" || test none = "$pic_object"; then |
---|
7374 | Â Â Â Â Â Â Â arg=$non_pic_object |
---|
7375 | Â Â Â Â Â Â fi |
---|
7376 | Â Â Â Â Â else |
---|
7377 | Â Â Â Â Â Â # If the PIC object exists, use it instead. |
---|
7378 | Â Â Â Â Â Â # $xdir was prepended to $pic_object above. |
---|
7379 | Â Â Â Â Â Â non_pic_object=$pic_object |
---|
7380 | Â Â Â Â Â Â func_append non_pic_objects " $non_pic_object" |
---|
7381 | Â Â Â Â Â fi |
---|
7382 | Â Â Â Â else |
---|
7383 | Â Â Â Â Â # Only an error if not doing a dry-run. |
---|
7384 |      if $opt_dry_run; then |
---|
7385 | Â Â Â Â Â Â # Extract subdirectory from the argument. |
---|
7386 | Â Â Â Â Â Â func_dirname "$arg"Â "/"Â "" |
---|
7387 | Â Â Â Â Â Â xdir=$func_dirname_result |
---|
7388 | |
---|
7389 | Â Â Â Â Â Â func_lo2o "$arg" |
---|
7390 | Â Â Â Â Â Â pic_object=$xdir$objdir/$func_lo2o_result |
---|
7391 | Â Â Â Â Â Â non_pic_object=$xdir$func_lo2o_result |
---|
7392 | Â Â Â Â Â Â func_append libobjs " $pic_object" |
---|
7393 | Â Â Â Â Â Â func_append non_pic_objects " $non_pic_object" |
---|
7394 | Â Â Â Â Â else |
---|
7395 | Â Â Â Â Â Â func_fatal_error "'$arg' is not a valid libtool object" |
---|
7396 | Â Â Â Â Â fi |
---|
7397 | Â Â Â Â fi |
---|
7398 | Â Â Â Â ;; |
---|
7399 | |
---|
7400 | Â Â Â *.$libext) |
---|
7401 | Â Â Â Â # An archive. |
---|
7402 | Â Â Â Â func_append deplibs " $arg" |
---|
7403 | Â Â Â Â func_append old_deplibs " $arg" |
---|
7404 | Â Â Â Â continue |
---|
7405 | Â Â Â Â ;; |
---|
7406 | |
---|
7407 | Â Â Â *.la) |
---|
7408 | Â Â Â Â # A libtool-controlled library. |
---|
7409 | |
---|
7410 | Â Â Â Â func_resolve_sysroot "$arg" |
---|
7411 |     if test dlfiles = "$prev"; then |
---|
7412 | Â Â Â Â Â # This library was specified with -dlopen. |
---|
7413 | Â Â Â Â Â func_append dlfiles " $func_resolve_sysroot_result" |
---|
7414 | Â Â Â Â Â prev= |
---|
7415 |     elif test dlprefiles = "$prev"; then |
---|
7416 | Â Â Â Â Â # The library was specified with -dlpreopen. |
---|
7417 | Â Â Â Â Â func_append dlprefiles " $func_resolve_sysroot_result" |
---|
7418 | Â Â Â Â Â prev= |
---|
7419 | Â Â Â Â else |
---|
7420 | Â Â Â Â Â func_append deplibs " $func_resolve_sysroot_result" |
---|
7421 | Â Â Â Â fi |
---|
7422 | Â Â Â Â continue |
---|
7423 | Â Â Â Â ;; |
---|
7424 | |
---|
7425 | Â Â Â # Some other compiler argument. |
---|
7426 | Â Â Â *) |
---|
7427 | Â Â Â Â # Unknown arguments in both finalize_command and compile_command need |
---|
7428 | Â Â Â Â # to be aesthetically quoted because they are evaled later. |
---|
7429 | Â Â Â Â func_quote_for_eval "$arg" |
---|
7430 | Â Â Â Â arg=$func_quote_for_eval_result |
---|
7431 | Â Â Â Â ;; |
---|
7432 |    esac # arg |
---|
7433 | |
---|
7434 | Â Â Â # Now actually substitute the argument into the commands. |
---|
7435 |    if test -n "$arg"; then |
---|
7436 | Â Â Â Â func_append compile_command " $arg" |
---|
7437 | Â Â Â Â func_append finalize_command " $arg" |
---|
7438 | Â Â Â fi |
---|
7439 |   done # argument parsing loop |
---|
7440 | |
---|
7441 |   test -n "$prev" && \ |
---|
7442 | Â Â Â func_fatal_help "the '$prevarg' option requires an argument" |
---|
7443 | |
---|
7444 |   if test yes = "$export_dynamic" && test -n "$export_dynamic_flag_spec"; then |
---|
7445 | Â Â Â eval arg=\"$export_dynamic_flag_spec\" |
---|
7446 | Â Â Â func_append compile_command " $arg" |
---|
7447 | Â Â Â func_append finalize_command " $arg" |
---|
7448 | Â Â fi |
---|
7449 | |
---|
7450 | Â Â oldlibs= |
---|
7451 | Â Â # calculate the name of the file, without its directory |
---|
7452 | Â Â func_basename "$output" |
---|
7453 | Â Â outputname=$func_basename_result |
---|
7454 | Â Â libobjs_save=$libobjs |
---|
7455 | |
---|
7456 |   if test -n "$shlibpath_var"; then |
---|
7457 | Â Â Â # get the directories listed in $shlibpath_var |
---|
7458 | Â Â Â eval shlib_search_path=\`\$ECHO \"\$$shlibpath_var\"Â \|Â \$SED \'s/:/ /g\'\` |
---|
7459 | Â Â else |
---|
7460 | Â Â Â shlib_search_path= |
---|
7461 | Â Â fi |
---|
7462 | Â Â eval sys_lib_search_path=\"$sys_lib_search_path_spec\" |
---|
7463 | Â Â eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" |
---|
7464 | |
---|
7465 | Â Â # Definition is injected by LT_CONFIG during libtool generation. |
---|
7466 | Â Â func_munge_path_list sys_lib_dlsearch_path "$LT_SYS_LIBRARY_PATH" |
---|
7467 | |
---|
7468 | Â Â func_dirname "$output"Â "/"Â "" |
---|
7469 | Â Â output_objdir=$func_dirname_result$objdir |
---|
7470 | Â Â func_to_tool_file "$output_objdir/" |
---|
7471 | Â Â tool_output_objdir=$func_to_tool_file_result |
---|
7472 | Â Â # Create the object directory. |
---|
7473 | Â Â func_mkdir_p "$output_objdir" |
---|
7474 | |
---|
7475 | Â Â # Determine the type of output |
---|
7476 |   case $output in |
---|
7477 | Â Â "") |
---|
7478 | Â Â Â func_fatal_help "you must specify an output file" |
---|
7479 | Â Â Â ;; |
---|
7480 | Â Â *.$libext)Â linkmode=oldlib ;; |
---|
7481 | Â Â *.lo | *.$objext)Â linkmode=obj ;; |
---|
7482 | Â Â *.la)Â linkmode=lib ;; |
---|
7483 | Â Â *)Â linkmode=prog ;; # Anything else should be a program. |
---|
7484 | Â Â esac |
---|
7485 | |
---|
7486 | Â Â specialdeplibs= |
---|
7487 | |
---|
7488 | Â Â libs= |
---|
7489 | Â Â # Find all interdependent deplibs by searching for libraries |
---|
7490 | Â Â # that are linked more than once (e.g. -la -lb -la) |
---|
7491 | Â Â for deplib in $deplibs; do |
---|
7492 |    if $opt_preserve_dup_deps; then |
---|
7493 |     case "$libs " in |
---|
7494 | Â Â Â Â *" $deplib "*)Â func_append specialdeplibs " $deplib"Â ;; |
---|
7495 | Â Â Â Â esac |
---|
7496 | Â Â Â fi |
---|
7497 | Â Â Â func_append libs " $deplib" |
---|
7498 | Â Â done |
---|
7499 | |
---|
7500 |   if test lib = "$linkmode"; then |
---|
7501 | Â Â Â libs="$predeps $libs $compiler_lib_search_path $postdeps" |
---|
7502 | |
---|
7503 | Â Â Â # Compute libraries that are listed more than once in $predeps |
---|
7504 | Â Â Â # $postdeps and mark them as special (i.e., whose duplicates are |
---|
7505 | Â Â Â # not to be eliminated). |
---|
7506 | Â Â Â pre_post_deps= |
---|
7507 |    if $opt_duplicate_compiler_generated_deps; then |
---|
7508 |     for pre_post_dep in $predeps $postdeps; do |
---|
7509 |      case "$pre_post_deps " in |
---|
7510 | Â Â Â Â Â *" $pre_post_dep "*)Â func_append specialdeplibs " $pre_post_deps"Â ;; |
---|
7511 | Â Â Â Â Â esac |
---|
7512 | Â Â Â Â Â func_append pre_post_deps " $pre_post_dep" |
---|
7513 | Â Â Â Â done |
---|
7514 | Â Â Â fi |
---|
7515 | Â Â Â pre_post_deps= |
---|
7516 | Â Â fi |
---|
7517 | |
---|
7518 | Â Â deplibs= |
---|
7519 | Â Â newdependency_libs= |
---|
7520 | Â Â newlib_search_path= |
---|
7521 | Â Â need_relink=no # whether we're linking any uninstalled libtool libraries |
---|
7522 | Â Â notinst_deplibs=Â # not-installed libtool libraries |
---|
7523 | Â Â notinst_path=Â # paths that contain not-installed libtool libraries |
---|
7524 | |
---|
7525 |   case $linkmode in |
---|
7526 | Â Â lib) |
---|
7527 | Â Â Â Â passes="conv dlpreopen link" |
---|
7528 |     for file in $dlfiles $dlprefiles; do |
---|
7529 |      case $file in |
---|
7530 | Â Â Â Â Â *.la)Â ;; |
---|
7531 | Â Â Â Â Â *) |
---|
7532 | Â Â Â Â Â Â func_fatal_help "libraries can '-dlopen' only libtool libraries: $file" |
---|
7533 | Â Â Â Â Â Â ;; |
---|
7534 | Â Â Â Â Â esac |
---|
7535 | Â Â Â Â done |
---|
7536 | Â Â Â Â ;; |
---|
7537 | Â Â prog) |
---|
7538 | Â Â Â Â compile_deplibs= |
---|
7539 | Â Â Â Â finalize_deplibs= |
---|
7540 | Â Â Â Â alldeplibs=false |
---|
7541 | Â Â Â Â newdlfiles= |
---|
7542 | Â Â Â Â newdlprefiles= |
---|
7543 | Â Â Â Â passes="conv scan dlopen dlpreopen link" |
---|
7544 | Â Â Â Â ;; |
---|
7545 | Â Â *)Â passes="conv" |
---|
7546 | Â Â Â Â ;; |
---|
7547 | Â Â esac |
---|
7548 | |
---|
7549 | Â Â for pass in $passes; do |
---|
7550 | Â Â Â # The preopen pass in lib mode reverses $deplibs; put it back here |
---|
7551 | Â Â Â # so that -L comes before libs that need it for instance... |
---|
7552 | Â Â Â if test lib,link =Â "$linkmode,$pass"; then |
---|
7553 | Â Â Â Â ## FIXME: Find the place where the list is rebuilt in the wrong |
---|
7554 | Â Â Â Â ##Â Â Â Â order, and fix it there properly |
---|
7555 | Â Â Â Â tmp_deplibs= |
---|
7556 | Â Â Â Â for deplib in $deplibs; do |
---|
7557 | Â Â Â Â Â tmp_deplibs="$deplib $tmp_deplibs" |
---|
7558 | Â Â Â Â done |
---|
7559 | Â Â Â Â deplibs=$tmp_deplibs |
---|
7560 | Â Â Â fi |
---|
7561 | |
---|
7562 | Â Â Â if test lib,link =Â "$linkmode,$pass"Â || |
---|
7563 | Â Â Â Â Â test prog,scan =Â "$linkmode,$pass"; then |
---|
7564 | Â Â Â Â libs=$deplibs |
---|
7565 | Â Â Â Â deplibs= |
---|
7566 | Â Â Â fi |
---|
7567 |    if test prog = "$linkmode"; then |
---|
7568 |     case $pass in |
---|
7569 |     dlopen) libs=$dlfiles ;; |
---|
7570 |     dlpreopen) libs=$dlprefiles ;; |
---|
7571 | Â Â Â Â link)Â libs="$deplibs %DEPLIBS% $dependency_libs"Â ;; |
---|
7572 | Â Â Â Â esac |
---|
7573 | Â Â Â fi |
---|
7574 | Â Â Â if test lib,dlpreopen =Â "$linkmode,$pass"; then |
---|
7575 | Â Â Â Â # Collect and forward deplibs of preopened libtool libs |
---|
7576 | Â Â Â Â for lib in $dlprefiles; do |
---|
7577 | Â Â Â Â Â # Ignore non-libtool-libs |
---|
7578 | Â Â Â Â Â dependency_libs= |
---|
7579 | Â Â Â Â Â func_resolve_sysroot "$lib" |
---|
7580 |      case $lib in |
---|
7581 | Â Â Â Â Â *.la)Â func_source "$func_resolve_sysroot_result"Â ;; |
---|
7582 | Â Â Â Â Â esac |
---|
7583 | |
---|
7584 | Â Â Â Â Â # Collect preopened libtool deplibs, except any this library |
---|
7585 | Â Â Â Â Â # has declared as weak libs |
---|
7586 | Â Â Â Â Â for deplib in $dependency_libs; do |
---|
7587 | Â Â Â Â Â Â func_basename "$deplib" |
---|
7588 | Â Â Â Â Â Â deplib_base=$func_basename_result |
---|
7589 |       case " $weak_libs " in |
---|
7590 | Â Â Â Â Â Â *" $deplib_base "*)Â ;; |
---|
7591 | Â Â Â Â Â Â *)Â func_append deplibs " $deplib"Â ;; |
---|
7592 | Â Â Â Â Â Â esac |
---|
7593 | Â Â Â Â Â done |
---|
7594 | Â Â Â Â done |
---|
7595 | Â Â Â Â libs=$dlprefiles |
---|
7596 | Â Â Â fi |
---|
7597 |    if test dlopen = "$pass"; then |
---|
7598 | Â Â Â Â # Collect dlpreopened libraries |
---|
7599 | Â Â Â Â save_deplibs=$deplibs |
---|
7600 | Â Â Â Â deplibs= |
---|
7601 | Â Â Â fi |
---|
7602 | |
---|
7603 | Â Â Â for deplib in $libs; do |
---|
7604 | Â Â Â Â lib= |
---|
7605 | Â Â Â Â found=false |
---|
7606 |     case $deplib in |
---|
7607 | Â Â Â Â -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ |
---|
7608 | Â Â Â Â |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) |
---|
7609 | Â Â Â Â Â if test prog,link =Â "$linkmode,$pass"; then |
---|
7610 | Â Â Â Â Â Â compile_deplibs="$deplib $compile_deplibs" |
---|
7611 | Â Â Â Â Â Â finalize_deplibs="$deplib $finalize_deplibs" |
---|
7612 | Â Â Â Â Â else |
---|
7613 | Â Â Â Â Â Â func_append compiler_flags " $deplib" |
---|
7614 |       if test lib = "$linkmode"; then |
---|
7615 |         case "$new_inherited_linker_flags " in |
---|
7616 | Â Â Â Â Â Â Â Â Â Â *" $deplib "*)Â ;; |
---|
7617 | Â Â Â Â Â Â Â Â Â Â * )Â func_append new_inherited_linker_flags " $deplib"Â ;; |
---|
7618 | Â Â Â Â Â Â Â Â esac |
---|
7619 | Â Â Â Â Â Â fi |
---|
7620 | Â Â Â Â Â fi |
---|
7621 | Â Â Â Â Â continue |
---|
7622 | Â Â Â Â Â ;; |
---|
7623 | Â Â Â Â -l*) |
---|
7624 | Â Â Â Â Â if test lib !=Â "$linkmode"Â &&Â test prog !=Â "$linkmode"; then |
---|
7625 | Â Â Â Â Â Â func_warning "'-l' is ignored for archives/objects" |
---|
7626 | Â Â Â Â Â Â continue |
---|
7627 | Â Â Â Â Â fi |
---|
7628 | Â Â Â Â Â func_stripname '-l'Â ''Â "$deplib" |
---|
7629 | Â Â Â Â Â name=$func_stripname_result |
---|
7630 |      if test lib = "$linkmode"; then |
---|
7631 | Â Â Â Â Â Â searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" |
---|
7632 | Â Â Â Â Â else |
---|
7633 | Â Â Â Â Â Â searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" |
---|
7634 | Â Â Â Â Â fi |
---|
7635 | Â Â Â Â Â for searchdir in $searchdirs; do |
---|
7636 |       for search_ext in .la $std_shrext .so .a; do |
---|
7637 | Â Â Â Â Â Â Â # Search the libtool library |
---|
7638 | Â Â Â Â Â Â Â lib=$searchdir/lib$name$search_ext |
---|
7639 |        if test -f "$lib"; then |
---|
7640 |         if test .la = "$search_ext"; then |
---|
7641 | Â Â Â Â Â Â Â Â Â found=: |
---|
7642 | Â Â Â Â Â Â Â Â else |
---|
7643 | Â Â Â Â Â Â Â Â Â found=false |
---|
7644 | Â Â Â Â Â Â Â Â fi |
---|
7645 | Â Â Â Â Â Â Â Â break 2 |
---|
7646 | Â Â Â Â Â Â Â fi |
---|
7647 | Â Â Â Â Â Â done |
---|
7648 | Â Â Â Â Â done |
---|
7649 |      if $found; then |
---|
7650 | Â Â Â Â Â Â # deplib is a libtool library |
---|
7651 | Â Â Â Â Â Â # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, |
---|
7652 | Â Â Â Â Â Â # We need to do some special things here, and not later. |
---|
7653 |       if test yes = "$allow_libtool_libs_with_static_runtimes"; then |
---|
7654 |        case " $predeps $postdeps " in |
---|
7655 | Â Â Â Â Â Â Â *" $deplib "*) |
---|
7656 | Â Â Â Â Â Â Â Â if func_lalib_p "$lib"; then |
---|
7657 | Â Â Â Â Â Â Â Â Â library_names= |
---|
7658 | Â Â Â Â Â Â Â Â Â old_library= |
---|
7659 | Â Â Â Â Â Â Â Â Â func_source "$lib" |
---|
7660 |          for l in $old_library $library_names; do |
---|
7661 | Â Â Â Â Â Â Â Â Â Â ll=$l |
---|
7662 | Â Â Â Â Â Â Â Â Â done |
---|
7663 |          if test "X$ll" = "X$old_library"; then # only static version available |
---|
7664 | Â Â Â Â Â Â Â Â Â Â found=false |
---|
7665 | Â Â Â Â Â Â Â Â Â Â func_dirname "$lib"Â ""Â "." |
---|
7666 | Â Â Â Â Â Â Â Â Â Â ladir=$func_dirname_result |
---|
7667 | Â Â Â Â Â Â Â Â Â Â lib=$ladir/$old_library |
---|
7668 | Â Â Â Â Â Â Â Â Â Â if test prog,link =Â "$linkmode,$pass"; then |
---|
7669 | Â Â Â Â Â Â Â Â Â Â Â compile_deplibs="$deplib $compile_deplibs" |
---|
7670 | Â Â Â Â Â Â Â Â Â Â Â finalize_deplibs="$deplib $finalize_deplibs" |
---|
7671 | Â Â Â Â Â Â Â Â Â Â else |
---|
7672 | Â Â Â Â Â Â Â Â Â Â Â deplibs="$deplib $deplibs" |
---|
7673 |            test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs" |
---|
7674 | Â Â Â Â Â Â Â Â Â Â fi |
---|
7675 | Â Â Â Â Â Â Â Â Â Â continue |
---|
7676 | Â Â Â Â Â Â Â Â Â fi |
---|
7677 | Â Â Â Â Â Â Â Â fi |
---|
7678 | Â Â Â Â Â Â Â Â ;; |
---|
7679 | Â Â Â Â Â Â Â *)Â ;; |
---|
7680 | Â Â Â Â Â Â Â esac |
---|
7681 | Â Â Â Â Â Â fi |
---|
7682 | Â Â Â Â Â else |
---|
7683 | Â Â Â Â Â Â # deplib doesn't seem to be a libtool library |
---|
7684 | Â Â Â Â Â Â if test prog,link =Â "$linkmode,$pass"; then |
---|
7685 | Â Â Â Â Â Â Â compile_deplibs="$deplib $compile_deplibs" |
---|
7686 | Â Â Â Â Â Â Â finalize_deplibs="$deplib $finalize_deplibs" |
---|
7687 | Â Â Â Â Â Â else |
---|
7688 | Â Â Â Â Â Â Â deplibs="$deplib $deplibs" |
---|
7689 |        test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs" |
---|
7690 | Â Â Â Â Â Â fi |
---|
7691 | Â Â Â Â Â Â continue |
---|
7692 | Â Â Â Â Â fi |
---|
7693 | Â Â Â Â Â ;; # -l |
---|
7694 | Â Â Â Â *.ltframework) |
---|
7695 | Â Â Â Â Â if test prog,link =Â "$linkmode,$pass"; then |
---|
7696 | Â Â Â Â Â Â compile_deplibs="$deplib $compile_deplibs" |
---|
7697 | Â Â Â Â Â Â finalize_deplibs="$deplib $finalize_deplibs" |
---|
7698 | Â Â Â Â Â else |
---|
7699 | Â Â Â Â Â Â deplibs="$deplib $deplibs" |
---|
7700 |       if test lib = "$linkmode"; then |
---|
7701 |         case "$new_inherited_linker_flags " in |
---|
7702 | Â Â Â Â Â Â Â Â Â Â *" $deplib "*)Â ;; |
---|
7703 | Â Â Â Â Â Â Â Â Â Â * )Â func_append new_inherited_linker_flags " $deplib"Â ;; |
---|
7704 | Â Â Â Â Â Â Â Â esac |
---|
7705 | Â Â Â Â Â Â fi |
---|
7706 | Â Â Â Â Â fi |
---|
7707 | Â Â Â Â Â continue |
---|
7708 | Â Â Â Â Â ;; |
---|
7709 | Â Â Â Â -L*) |
---|
7710 |      case $linkmode in |
---|
7711 | Â Â Â Â Â lib) |
---|
7712 | Â Â Â Â Â Â deplibs="$deplib $deplibs" |
---|
7713 |       test conv = "$pass" && continue |
---|
7714 | Â Â Â Â Â Â newdependency_libs="$deplib $newdependency_libs" |
---|
7715 | Â Â Â Â Â Â func_stripname '-L'Â ''Â "$deplib" |
---|
7716 | Â |
---|