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 Debian-2.4.6-15"
|
---|
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='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=2015-10-07.11; # 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 | _G_rc_run_hooks=false
|
---|
1534 |
|
---|
1535 | case " $hookable_fns " in
|
---|
1536 | *" $1 "*) ;;
|
---|
1537 | *) func_fatal_error "'$1' does not support hook funcions.n" ;;
|
---|
1538 | esac
|
---|
1539 |
|
---|
1540 | eval _G_hook_fns=\$$1_hooks; shift
|
---|
1541 |
|
---|
1542 | for _G_hook in $_G_hook_fns; do
|
---|
1543 | if eval $_G_hook '"$@"'; then
|
---|
1544 | # store returned options list back into positional
|
---|
1545 | # parameters for next 'cmd' execution.
|
---|
1546 | eval _G_hook_result=\$${_G_hook}_result
|
---|
1547 | eval set dummy "$_G_hook_result"; shift
|
---|
1548 | _G_rc_run_hooks=:
|
---|
1549 | fi
|
---|
1550 | done
|
---|
1551 |
|
---|
1552 | $_G_rc_run_hooks && func_run_hooks_result=$_G_hook_result
|
---|
1553 | }
|
---|
1554 |
|
---|
1555 |
|
---|
1556 |
|
---|
1557 | ## --------------- ##
|
---|
1558 | ## Option parsing. ##
|
---|
1559 | ## --------------- ##
|
---|
1560 |
|
---|
1561 | # In order to add your own option parsing hooks, you must accept the
|
---|
1562 | # full positional parameter list in your hook function, you may remove/edit
|
---|
1563 | # any options that you action, and then pass back the remaining unprocessed
|
---|
1564 | # options in '<hooked_function_name>_result', escaped suitably for
|
---|
1565 | # 'eval'. In this case you also must return $EXIT_SUCCESS to let the
|
---|
1566 | # hook's caller know that it should pay attention to
|
---|
1567 | # '<hooked_function_name>_result'. Returning $EXIT_FAILURE signalizes that
|
---|
1568 | # arguments are left untouched by the hook and therefore caller will ignore the
|
---|
1569 | # result variable.
|
---|
1570 | #
|
---|
1571 | # Like this:
|
---|
1572 | #
|
---|
1573 | # my_options_prep ()
|
---|
1574 | # {
|
---|
1575 | # $debug_cmd
|
---|
1576 | #
|
---|
1577 | # # Extend the existing usage message.
|
---|
1578 | # usage_message=$usage_message'
|
---|
1579 | # -s, --silent don'\''t print informational messages
|
---|
1580 | # '
|
---|
1581 | # # No change in '$@' (ignored completely by this hook). There is
|
---|
1582 | # # no need to do the equivalent (but slower) action:
|
---|
1583 | # # func_quote_for_eval ${1+"$@"}
|
---|
1584 | # # my_options_prep_result=$func_quote_for_eval_result
|
---|
1585 | # false
|
---|
1586 | # }
|
---|
1587 | # func_add_hook func_options_prep my_options_prep
|
---|
1588 | #
|
---|
1589 | #
|
---|
1590 | # my_silent_option ()
|
---|
1591 | # {
|
---|
1592 | # $debug_cmd
|
---|
1593 | #
|
---|
1594 | # args_changed=false
|
---|
1595 | #
|
---|
1596 | # # Note that for efficiency, we parse as many options as we can
|
---|
1597 | # # recognise in a loop before passing the remainder back to the
|
---|
1598 | # # caller on the first unrecognised argument we encounter.
|
---|
1599 | # while test $# -gt 0; do
|
---|
1600 | # opt=$1; shift
|
---|
1601 | # case $opt in
|
---|
1602 | # --silent|-s) opt_silent=:
|
---|
1603 | # args_changed=:
|
---|
1604 | # ;;
|
---|
1605 | # # Separate non-argument short options:
|
---|
1606 | # -s*) func_split_short_opt "$_G_opt"
|
---|
1607 | # set dummy "$func_split_short_opt_name" \
|
---|
1608 | # "-$func_split_short_opt_arg" ${1+"$@"}
|
---|
1609 | # shift
|
---|
1610 | # args_changed=:
|
---|
1611 | # ;;
|
---|
1612 | # *) # Make sure the first unrecognised option "$_G_opt"
|
---|
1613 | # # is added back to "$@", we could need that later
|
---|
1614 | # # if $args_changed is true.
|
---|
1615 | # set dummy "$_G_opt" ${1+"$@"}; shift; break ;;
|
---|
1616 | # esac
|
---|
1617 | # done
|
---|
1618 | #
|
---|
1619 | # if $args_changed; then
|
---|
1620 | # func_quote_for_eval ${1+"$@"}
|
---|
1621 | # my_silent_option_result=$func_quote_for_eval_result
|
---|
1622 | # fi
|
---|
1623 | #
|
---|
1624 | # $args_changed
|
---|
1625 | # }
|
---|
1626 | # func_add_hook func_parse_options my_silent_option
|
---|
1627 | #
|
---|
1628 | #
|
---|
1629 | # my_option_validation ()
|
---|
1630 | # {
|
---|
1631 | # $debug_cmd
|
---|
1632 | #
|
---|
1633 | # $opt_silent && $opt_verbose && func_fatal_help "\
|
---|
1634 | # '--silent' and '--verbose' options are mutually exclusive."
|
---|
1635 | #
|
---|
1636 | # false
|
---|
1637 | # }
|
---|
1638 | # func_add_hook func_validate_options my_option_validation
|
---|
1639 | #
|
---|
1640 | # You'll also need to manually amend $usage_message to reflect the extra
|
---|
1641 | # options you parse. It's preferable to append if you can, so that
|
---|
1642 | # multiple option parsing hooks can be added safely.
|
---|
1643 |
|
---|
1644 |
|
---|
1645 | # func_options_finish [ARG]...
|
---|
1646 | # ----------------------------
|
---|
1647 | # Finishing the option parse loop (call 'func_options' hooks ATM).
|
---|
1648 | func_options_finish ()
|
---|
1649 | {
|
---|
1650 | $debug_cmd
|
---|
1651 |
|
---|
1652 | _G_func_options_finish_exit=false
|
---|
1653 | if func_run_hooks func_options ${1+"$@"}; then
|
---|
1654 | func_options_finish_result=$func_run_hooks_result
|
---|
1655 | _G_func_options_finish_exit=:
|
---|
1656 | fi
|
---|
1657 |
|
---|
1658 | $_G_func_options_finish_exit
|
---|
1659 | }
|
---|
1660 |
|
---|
1661 |
|
---|
1662 | # func_options [ARG]...
|
---|
1663 | # ---------------------
|
---|
1664 | # All the functions called inside func_options are hookable. See the
|
---|
1665 | # individual implementations for details.
|
---|
1666 | func_hookable func_options
|
---|
1667 | func_options ()
|
---|
1668 | {
|
---|
1669 | $debug_cmd
|
---|
1670 |
|
---|
1671 | _G_rc_options=false
|
---|
1672 |
|
---|
1673 | for my_func in options_prep parse_options validate_options options_finish
|
---|
1674 | do
|
---|
1675 | if eval func_$my_func '${1+"$@"}'; then
|
---|
1676 | eval _G_res_var='$'"func_${my_func}_result"
|
---|
1677 | eval set dummy "$_G_res_var" ; shift
|
---|
1678 | _G_rc_options=:
|
---|
1679 | fi
|
---|
1680 | done
|
---|
1681 |
|
---|
1682 | # Save modified positional parameters for caller. As a top-level
|
---|
1683 | # options-parser function we always need to set the 'func_options_result'
|
---|
1684 | # variable (regardless the $_G_rc_options value).
|
---|
1685 | if $_G_rc_options; then
|
---|
1686 | func_options_result=$_G_res_var
|
---|
1687 | else
|
---|
1688 | func_quote_for_eval ${1+"$@"}
|
---|
1689 | func_options_result=$func_quote_for_eval_result
|
---|
1690 | fi
|
---|
1691 |
|
---|
1692 | $_G_rc_options
|
---|
1693 | }
|
---|
1694 |
|
---|
1695 |
|
---|
1696 | # func_options_prep [ARG]...
|
---|
1697 | # --------------------------
|
---|
1698 | # All initialisations required before starting the option parse loop.
|
---|
1699 | # Note that when calling hook functions, we pass through the list of
|
---|
1700 | # positional parameters. If a hook function modifies that list, and
|
---|
1701 | # needs to propagate that back to rest of this script, then the complete
|
---|
1702 | # modified list must be put in 'func_run_hooks_result' before
|
---|
1703 | # returning $EXIT_SUCCESS (otherwise $EXIT_FAILURE is returned).
|
---|
1704 | func_hookable func_options_prep
|
---|
1705 | func_options_prep ()
|
---|
1706 | {
|
---|
1707 | $debug_cmd
|
---|
1708 |
|
---|
1709 | # Option defaults:
|
---|
1710 | opt_verbose=false
|
---|
1711 | opt_warning_types=
|
---|
1712 |
|
---|
1713 | _G_rc_options_prep=false
|
---|
1714 | if func_run_hooks func_options_prep ${1+"$@"}; then
|
---|
1715 | _G_rc_options_prep=:
|
---|
1716 | # save modified positional parameters for caller
|
---|
1717 | func_options_prep_result=$func_run_hooks_result
|
---|
1718 | fi
|
---|
1719 |
|
---|
1720 | $_G_rc_options_prep
|
---|
1721 | }
|
---|
1722 |
|
---|
1723 |
|
---|
1724 | # func_parse_options [ARG]...
|
---|
1725 | # ---------------------------
|
---|
1726 | # The main option parsing loop.
|
---|
1727 | func_hookable func_parse_options
|
---|
1728 | func_parse_options ()
|
---|
1729 | {
|
---|
1730 | $debug_cmd
|
---|
1731 |
|
---|
1732 | func_parse_options_result=
|
---|
1733 |
|
---|
1734 | _G_rc_parse_options=false
|
---|
1735 | # this just eases exit handling
|
---|
1736 | while test $# -gt 0; do
|
---|
1737 | # Defer to hook functions for initial option parsing, so they
|
---|
1738 | # get priority in the event of reusing an option name.
|
---|
1739 | if func_run_hooks func_parse_options ${1+"$@"}; then
|
---|
1740 | eval set dummy "$func_run_hooks_result"; shift
|
---|
1741 | _G_rc_parse_options=:
|
---|
1742 | fi
|
---|
1743 |
|
---|
1744 | # Break out of the loop if we already parsed every option.
|
---|
1745 | test $# -gt 0 || break
|
---|
1746 |
|
---|
1747 | _G_match_parse_options=:
|
---|
1748 | _G_opt=$1
|
---|
1749 | shift
|
---|
1750 | case $_G_opt in
|
---|
1751 | --debug|-x) debug_cmd='set -x'
|
---|
1752 | func_echo "enabling shell trace mode"
|
---|
1753 | $debug_cmd
|
---|
1754 | ;;
|
---|
1755 |
|
---|
1756 | --no-warnings|--no-warning|--no-warn)
|
---|
1757 | set dummy --warnings none ${1+"$@"}
|
---|
1758 | shift
|
---|
1759 | ;;
|
---|
1760 |
|
---|
1761 | --warnings|--warning|-W)
|
---|
1762 | if test $# = 0 && func_missing_arg $_G_opt; then
|
---|
1763 | _G_rc_parse_options=:
|
---|
1764 | break
|
---|
1765 | fi
|
---|
1766 | case " $warning_categories $1" in
|
---|
1767 | *" $1 "*)
|
---|
1768 | # trailing space prevents matching last $1 above
|
---|
1769 | func_append_uniq opt_warning_types " $1"
|
---|
1770 | ;;
|
---|
1771 | *all)
|
---|
1772 | opt_warning_types=$warning_categories
|
---|
1773 | ;;
|
---|
1774 | *none)
|
---|
1775 | opt_warning_types=none
|
---|
1776 | warning_func=:
|
---|
1777 | ;;
|
---|
1778 | *error)
|
---|
1779 | opt_warning_types=$warning_categories
|
---|
1780 | warning_func=func_fatal_error
|
---|
1781 | ;;
|
---|
1782 | *)
|
---|
1783 | func_fatal_error \
|
---|
1784 | "unsupported warning category: '$1'"
|
---|
1785 | ;;
|
---|
1786 | esac
|
---|
1787 | shift
|
---|
1788 | ;;
|
---|
1789 |
|
---|
1790 | --verbose|-v) opt_verbose=: ;;
|
---|
1791 | --version) func_version ;;
|
---|
1792 | -\?|-h) func_usage ;;
|
---|
1793 | --help) func_help ;;
|
---|
1794 |
|
---|
1795 | # Separate optargs to long options (plugins may need this):
|
---|
1796 | --*=*) func_split_equals "$_G_opt"
|
---|
1797 | set dummy "$func_split_equals_lhs" \
|
---|
1798 | "$func_split_equals_rhs" ${1+"$@"}
|
---|
1799 | shift
|
---|
1800 | ;;
|
---|
1801 |
|
---|
1802 | # Separate optargs to short options:
|
---|
1803 | -W*)
|
---|
1804 | func_split_short_opt "$_G_opt"
|
---|
1805 | set dummy "$func_split_short_opt_name" \
|
---|
1806 | "$func_split_short_opt_arg" ${1+"$@"}
|
---|
1807 | shift
|
---|
1808 | ;;
|
---|
1809 |
|
---|
1810 | # Separate non-argument short options:
|
---|
1811 | -\?*|-h*|-v*|-x*)
|
---|
1812 | func_split_short_opt "$_G_opt"
|
---|
1813 | set dummy "$func_split_short_opt_name" \
|
---|
1814 | "-$func_split_short_opt_arg" ${1+"$@"}
|
---|
1815 | shift
|
---|
1816 | ;;
|
---|
1817 |
|
---|
1818 | --) _G_rc_parse_options=: ; break ;;
|
---|
1819 | -*) func_fatal_help "unrecognised option: '$_G_opt'" ;;
|
---|
1820 | *) set dummy "$_G_opt" ${1+"$@"}; shift
|
---|
1821 | _G_match_parse_options=false
|
---|
1822 | break
|
---|
1823 | ;;
|
---|
1824 | esac
|
---|
1825 |
|
---|
1826 | $_G_match_parse_options && _G_rc_parse_options=:
|
---|
1827 | done
|
---|
1828 |
|
---|
1829 |
|
---|
1830 | if $_G_rc_parse_options; then
|
---|
1831 | # save modified positional parameters for caller
|
---|
1832 | func_quote_for_eval ${1+"$@"}
|
---|
1833 | func_parse_options_result=$func_quote_for_eval_result
|
---|
1834 | fi
|
---|
1835 |
|
---|
1836 | $_G_rc_parse_options
|
---|
1837 | }
|
---|
1838 |
|
---|
1839 |
|
---|
1840 | # func_validate_options [ARG]...
|
---|
1841 | # ------------------------------
|
---|
1842 | # Perform any sanity checks on option settings and/or unconsumed
|
---|
1843 | # arguments.
|
---|
1844 | func_hookable func_validate_options
|
---|
1845 | func_validate_options ()
|
---|
1846 | {
|
---|
1847 | $debug_cmd
|
---|
1848 |
|
---|
1849 | _G_rc_validate_options=false
|
---|
1850 |
|
---|
1851 | # Display all warnings if -W was not given.
|
---|
1852 | test -n "$opt_warning_types" || opt_warning_types=" $warning_categories"
|
---|
1853 |
|
---|
1854 | if func_run_hooks func_validate_options ${1+"$@"}; then
|
---|
1855 | # save modified positional parameters for caller
|
---|
1856 | func_validate_options_result=$func_run_hooks_result
|
---|
1857 | _G_rc_validate_options=:
|
---|
1858 | fi
|
---|
1859 |
|
---|
1860 | # Bail if the options were screwed!
|
---|
1861 | $exit_cmd $EXIT_FAILURE
|
---|
1862 |
|
---|
1863 | $_G_rc_validate_options
|
---|
1864 | }
|
---|
1865 |
|
---|
1866 |
|
---|
1867 |
|
---|
1868 | ## ----------------- ##
|
---|
1869 | ## Helper functions. ##
|
---|
1870 | ## ----------------- ##
|
---|
1871 |
|
---|
1872 | # This section contains the helper functions used by the rest of the
|
---|
1873 | # hookable option parser framework in ascii-betical order.
|
---|
1874 |
|
---|
1875 |
|
---|
1876 | # func_fatal_help ARG...
|
---|
1877 | # ----------------------
|
---|
1878 | # Echo program name prefixed message to standard error, followed by
|
---|
1879 | # a help hint, and exit.
|
---|
1880 | func_fatal_help ()
|
---|
1881 | {
|
---|
1882 | $debug_cmd
|
---|
1883 |
|
---|
1884 | eval \$ECHO \""Usage: $usage"\"
|
---|
1885 | eval \$ECHO \""$fatal_help"\"
|
---|
1886 | func_error ${1+"$@"}
|
---|
1887 | exit $EXIT_FAILURE
|
---|
1888 | }
|
---|
1889 |
|
---|
1890 |
|
---|
1891 | # func_help
|
---|
1892 | # ---------
|
---|
1893 | # Echo long help message to standard output and exit.
|
---|
1894 | func_help ()
|
---|
1895 | {
|
---|
1896 | $debug_cmd
|
---|
1897 |
|
---|
1898 | func_usage_message
|
---|
1899 | $ECHO "$long_help_message"
|
---|
1900 | exit 0
|
---|
1901 | }
|
---|
1902 |
|
---|
1903 |
|
---|
1904 | # func_missing_arg ARGNAME
|
---|
1905 | # ------------------------
|
---|
1906 | # Echo program name prefixed message to standard error and set global
|
---|
1907 | # exit_cmd.
|
---|
1908 | func_missing_arg ()
|
---|
1909 | {
|
---|
1910 | $debug_cmd
|
---|
1911 |
|
---|
1912 | func_error "Missing argument for '$1'."
|
---|
1913 | exit_cmd=exit
|
---|
1914 | }
|
---|
1915 |
|
---|
1916 |
|
---|
1917 | # func_split_equals STRING
|
---|
1918 | # ------------------------
|
---|
1919 | # Set func_split_equals_lhs and func_split_equals_rhs shell variables after
|
---|
1920 | # splitting STRING at the '=' sign.
|
---|
1921 | test -z "$_G_HAVE_XSI_OPS" \
|
---|
1922 | && (eval 'x=a/b/c;
|
---|
1923 | test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
|
---|
1924 | && _G_HAVE_XSI_OPS=yes
|
---|
1925 |
|
---|
1926 | if test yes = "$_G_HAVE_XSI_OPS"
|
---|
1927 | then
|
---|
1928 | # This is an XSI compatible shell, allowing a faster implementation...
|
---|
1929 | eval 'func_split_equals ()
|
---|
1930 | {
|
---|
1931 | $debug_cmd
|
---|
1932 |
|
---|
1933 | func_split_equals_lhs=${1%%=*}
|
---|
1934 | func_split_equals_rhs=${1#*=}
|
---|
1935 | test "x$func_split_equals_lhs" = "x$1" \
|
---|
1936 | && func_split_equals_rhs=
|
---|
1937 | }'
|
---|
1938 | else
|
---|
1939 | # ...otherwise fall back to using expr, which is often a shell builtin.
|
---|
1940 | func_split_equals ()
|
---|
1941 | {
|
---|
1942 | $debug_cmd
|
---|
1943 |
|
---|
1944 | func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'`
|
---|
1945 | func_split_equals_rhs=
|
---|
1946 | test "x$func_split_equals_lhs" = "x$1" \
|
---|
1947 | || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'`
|
---|
1948 | }
|
---|
1949 | fi #func_split_equals
|
---|
1950 |
|
---|
1951 |
|
---|
1952 | # func_split_short_opt SHORTOPT
|
---|
1953 | # -----------------------------
|
---|
1954 | # Set func_split_short_opt_name and func_split_short_opt_arg shell
|
---|
1955 | # variables after splitting SHORTOPT after the 2nd character.
|
---|
1956 | if test yes = "$_G_HAVE_XSI_OPS"
|
---|
1957 | then
|
---|
1958 | # This is an XSI compatible shell, allowing a faster implementation...
|
---|
1959 | eval 'func_split_short_opt ()
|
---|
1960 | {
|
---|
1961 | $debug_cmd
|
---|
1962 |
|
---|
1963 | func_split_short_opt_arg=${1#??}
|
---|
1964 | func_split_short_opt_name=${1%"$func_split_short_opt_arg"}
|
---|
1965 | }'
|
---|
1966 | else
|
---|
1967 | # ...otherwise fall back to using expr, which is often a shell builtin.
|
---|
1968 | func_split_short_opt ()
|
---|
1969 | {
|
---|
1970 | $debug_cmd
|
---|
1971 |
|
---|
1972 | func_split_short_opt_name=`expr "x$1" : 'x-\(.\)'`
|
---|
1973 | func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'`
|
---|
1974 | }
|
---|
1975 | fi #func_split_short_opt
|
---|
1976 |
|
---|
1977 |
|
---|
1978 | # func_usage
|
---|
1979 | # ----------
|
---|
1980 | # Echo short help message to standard output and exit.
|
---|
1981 | func_usage ()
|
---|
1982 | {
|
---|
1983 | $debug_cmd
|
---|
1984 |
|
---|
1985 | func_usage_message
|
---|
1986 | $ECHO "Run '$progname --help |${PAGER-more}' for full usage"
|
---|
1987 | exit 0
|
---|
1988 | }
|
---|
1989 |
|
---|
1990 |
|
---|
1991 | # func_usage_message
|
---|
1992 | # ------------------
|
---|
1993 | # Echo short help message to standard output.
|
---|
1994 | func_usage_message ()
|
---|
1995 | {
|
---|
1996 | $debug_cmd
|
---|
1997 |
|
---|
1998 | eval \$ECHO \""Usage: $usage"\"
|
---|
1999 | echo
|
---|
2000 | $SED -n 's|^# ||
|
---|
2001 | /^Written by/{
|
---|
2002 | x;p;x
|
---|
2003 | }
|
---|
2004 | h
|
---|
2005 | /^Written by/q' < "$progpath"
|
---|
2006 | echo
|
---|
2007 | eval \$ECHO \""$usage_message"\"
|
---|
2008 | }
|
---|
2009 |
|
---|
2010 |
|
---|
2011 | # func_version
|
---|
2012 | # ------------
|
---|
2013 | # Echo version message to standard output and exit.
|
---|
2014 | func_version ()
|
---|
2015 | {
|
---|
2016 | $debug_cmd
|
---|
2017 |
|
---|
2018 | printf '%s\n' "$progname $scriptversion"
|
---|
2019 | $SED -n '
|
---|
2020 | /(C)/!b go
|
---|
2021 | :more
|
---|
2022 | /\./!{
|
---|
2023 | N
|
---|
2024 | s|\n# | |
|
---|
2025 | b more
|
---|
2026 | }
|
---|
2027 | :go
|
---|
2028 | /^# Written by /,/# warranty; / {
|
---|
2029 | s|^# ||
|
---|
2030 | s|^# *$||
|
---|
2031 | s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2|
|
---|
2032 | p
|
---|
2033 | }
|
---|
2034 | /^# Written by / {
|
---|
2035 | s|^# ||
|
---|
2036 | p
|
---|
2037 | }
|
---|
2038 | /^warranty; /q' < "$progpath"
|
---|
2039 |
|
---|
2040 | exit $?
|
---|
2041 | }
|
---|
2042 |
|
---|
2043 |
|
---|
2044 | # Local variables:
|
---|
2045 | # mode: shell-script
|
---|
2046 | # sh-indentation: 2
|
---|
2047 | # eval: (add-hook 'before-save-hook 'time-stamp)
|
---|
2048 | # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
|
---|
2049 | # time-stamp-time-zone: "UTC"
|
---|
2050 | # End:
|
---|
2051 |
|
---|
2052 | # Set a version string.
|
---|
2053 | scriptversion='(GNU libtool) 2.4.6'
|
---|
2054 |
|
---|
2055 |
|
---|
2056 | # func_echo ARG...
|
---|
2057 | # ----------------
|
---|
2058 | # Libtool also displays the current mode in messages, so override
|
---|
2059 | # funclib.sh func_echo with this custom definition.
|
---|
2060 | func_echo ()
|
---|
2061 | {
|
---|
2062 | $debug_cmd
|
---|
2063 |
|
---|
2064 | _G_message=$*
|
---|
2065 |
|
---|
2066 | func_echo_IFS=$IFS
|
---|
2067 | IFS=$nl
|
---|
2068 | for _G_line in $_G_message; do
|
---|
2069 | IFS=$func_echo_IFS
|
---|
2070 | $ECHO "$progname${opt_mode+: $opt_mode}: $_G_line"
|
---|
2071 | done
|
---|
2072 | IFS=$func_echo_IFS
|
---|
2073 | }
|
---|
2074 |
|
---|
2075 |
|
---|
2076 | # func_warning ARG...
|
---|
2077 | # -------------------
|
---|
2078 | # Libtool warnings are not categorized, so override funclib.sh
|
---|
2079 | # func_warning with this simpler definition.
|
---|
2080 | func_warning ()
|
---|
2081 | {
|
---|
2082 | $debug_cmd
|
---|
2083 |
|
---|
2084 | $warning_func ${1+"$@"}
|
---|
2085 | }
|
---|
2086 |
|
---|
2087 |
|
---|
2088 | ## ---------------- ##
|
---|
2089 | ## Options parsing. ##
|
---|
2090 | ## ---------------- ##
|
---|
2091 |
|
---|
2092 | # Hook in the functions to make sure our own options are parsed during
|
---|
2093 | # the option parsing loop.
|
---|
2094 |
|
---|
2095 | usage='$progpath [OPTION]... [MODE-ARG]...'
|
---|
2096 |
|
---|
2097 | # Short help message in response to '-h'.
|
---|
2098 | usage_message="Options:
|
---|
2099 | --config show all configuration variables
|
---|
2100 | --debug enable verbose shell tracing
|
---|
2101 | -n, --dry-run display commands without modifying any files
|
---|
2102 | --features display basic configuration information and exit
|
---|
2103 | --mode=MODE use operation mode MODE
|
---|
2104 | --no-warnings equivalent to '-Wnone'
|
---|
2105 | --preserve-dup-deps don't remove duplicate dependency libraries
|
---|
2106 | --quiet, --silent don't print informational messages
|
---|
2107 | --tag=TAG use configuration variables from tag TAG
|
---|
2108 | -v, --verbose print more informational messages than default
|
---|
2109 | --version print version information
|
---|
2110 | -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all]
|
---|
2111 | -h, --help, --help-all print short, long, or detailed help message
|
---|
2112 | "
|
---|
2113 |
|
---|
2114 | # Additional text appended to 'usage_message' in response to '--help'.
|
---|
2115 | func_help ()
|
---|
2116 | {
|
---|
2117 | $debug_cmd
|
---|
2118 |
|
---|
2119 | func_usage_message
|
---|
2120 | $ECHO "$long_help_message
|
---|
2121 |
|
---|
2122 | MODE must be one of the following:
|
---|
2123 |
|
---|
2124 | clean remove files from the build directory
|
---|
2125 | compile compile a source file into a libtool object
|
---|
2126 | execute automatically set library path, then run a program
|
---|
2127 | finish complete the installation of libtool libraries
|
---|
2128 | install install libraries or executables
|
---|
2129 | link create a library or an executable
|
---|
2130 | uninstall remove libraries from an installed directory
|
---|
2131 |
|
---|
2132 | MODE-ARGS vary depending on the MODE. When passed as first option,
|
---|
2133 | '--mode=MODE' may be abbreviated as 'MODE' or a unique abbreviation of that.
|
---|
2134 | Try '$progname --help --mode=MODE' for a more detailed description of MODE.
|
---|
2135 |
|
---|
2136 | When reporting a bug, please describe a test case to reproduce it and
|
---|
2137 | include the following information:
|
---|
2138 |
|
---|
2139 | host-triplet: $host
|
---|
2140 | shell: $SHELL
|
---|
2141 | compiler: $LTCC
|
---|
2142 | compiler flags: $LTCFLAGS
|
---|
2143 | linker: $LD (gnu? $with_gnu_ld)
|
---|
2144 | version: $progname $scriptversion Debian-2.4.6-15
|
---|
2145 | automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q`
|
---|
2146 | autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q`
|
---|
2147 |
|
---|
2148 | Report bugs to <bug-libtool@gnu.org>.
|
---|
2149 | GNU libtool home page: <http://www.gnu.org/s/libtool/>.
|
---|
2150 | General help using GNU software: <http://www.gnu.org/gethelp/>."
|
---|
2151 | exit 0
|
---|
2152 | }
|
---|
2153 |
|
---|
2154 |
|
---|
2155 | # func_lo2o OBJECT-NAME
|
---|
2156 | # ---------------------
|
---|
2157 | # Transform OBJECT-NAME from a '.lo' suffix to the platform specific
|
---|
2158 | # object suffix.
|
---|
2159 |
|
---|
2160 | lo2o=s/\\.lo\$/.$objext/
|
---|
2161 | o2lo=s/\\.$objext\$/.lo/
|
---|
2162 |
|
---|
2163 | if test yes = "$_G_HAVE_XSI_OPS"; then
|
---|
2164 | eval 'func_lo2o ()
|
---|
2165 | {
|
---|
2166 | case $1 in
|
---|
2167 | *.lo) func_lo2o_result=${1%.lo}.$objext ;;
|
---|
2168 | * ) func_lo2o_result=$1 ;;
|
---|
2169 | esac
|
---|
2170 | }'
|
---|
2171 |
|
---|
2172 | # func_xform LIBOBJ-OR-SOURCE
|
---|
2173 | # ---------------------------
|
---|
2174 | # Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise)
|
---|
2175 | # suffix to a '.lo' libtool-object suffix.
|
---|
2176 | eval 'func_xform ()
|
---|
2177 | {
|
---|
2178 | func_xform_result=${1%.*}.lo
|
---|
2179 | }'
|
---|
2180 | else
|
---|
2181 | # ...otherwise fall back to using sed.
|
---|
2182 | func_lo2o ()
|
---|
2183 | {
|
---|
2184 | func_lo2o_result=`$ECHO "$1" | $SED "$lo2o"`
|
---|
2185 | }
|
---|
2186 |
|
---|
2187 | func_xform ()
|
---|
2188 | {
|
---|
2189 | func_xform_result=`$ECHO "$1" | $SED 's|\.[^.]*$|.lo|'`
|
---|
2190 | }
|
---|
2191 | fi
|
---|
2192 |
|
---|
2193 |
|
---|
2194 | # func_fatal_configuration ARG...
|
---|
2195 | # -------------------------------
|
---|
2196 | # Echo program name prefixed message to standard error, followed by
|
---|
2197 | # a configuration failure hint, and exit.
|
---|
2198 | func_fatal_configuration ()
|
---|
2199 | {
|
---|
2200 | func__fatal_error ${1+"$@"} \
|
---|
2201 | "See the $PACKAGE documentation for more information." \
|
---|
2202 | "Fatal configuration error."
|
---|
2203 | }
|
---|
2204 |
|
---|
2205 |
|
---|
2206 | # func_config
|
---|
2207 | # -----------
|
---|
2208 | # Display the configuration for all the tags in this script.
|
---|
2209 | func_config ()
|
---|
2210 | {
|
---|
2211 | re_begincf='^# ### BEGIN LIBTOOL'
|
---|
2212 | re_endcf='^# ### END LIBTOOL'
|
---|
2213 |
|
---|
2214 | # Default configuration.
|
---|
2215 | $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
|
---|
2216 |
|
---|
2217 | # Now print the configurations for the tags.
|
---|
2218 | for tagname in $taglist; do
|
---|
2219 | $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
|
---|
2220 | done
|
---|
2221 |
|
---|
2222 | exit $?
|
---|
2223 | }
|
---|
2224 |
|
---|
2225 |
|
---|
2226 | # func_features
|
---|
2227 | # -------------
|
---|
2228 | # Display the features supported by this script.
|
---|
2229 | func_features ()
|
---|
2230 | {
|
---|
2231 | echo "host: $host"
|
---|
2232 | if test yes = "$build_libtool_libs"; then
|
---|
2233 | echo "enable shared libraries"
|
---|
2234 | else
|
---|
2235 | echo "disable shared libraries"
|
---|
2236 | fi
|
---|
2237 | if test yes = "$build_old_libs"; then
|
---|
2238 | echo "enable static libraries"
|
---|
2239 | else
|
---|
2240 | echo "disable static libraries"
|
---|
2241 | fi
|
---|
2242 |
|
---|
2243 | exit $?
|
---|
2244 | }
|
---|
2245 |
|
---|
2246 |
|
---|
2247 | # func_enable_tag TAGNAME
|
---|
2248 | # -----------------------
|
---|
2249 | # Verify that TAGNAME is valid, and either flag an error and exit, or
|
---|
2250 | # enable the TAGNAME tag. We also add TAGNAME to the global $taglist
|
---|
2251 | # variable here.
|
---|
2252 | func_enable_tag ()
|
---|
2253 | {
|
---|
2254 | # Global variable:
|
---|
2255 | tagname=$1
|
---|
2256 |
|
---|
2257 | re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
|
---|
2258 | re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
|
---|
2259 | sed_extractcf=/$re_begincf/,/$re_endcf/p
|
---|
2260 |
|
---|
2261 | # Validate tagname.
|
---|
2262 | case $tagname in
|
---|
2263 | *[!-_A-Za-z0-9,/]*)
|
---|
2264 | func_fatal_error "invalid tag name: $tagname"
|
---|
2265 | ;;
|
---|
2266 | esac
|
---|
2267 |
|
---|
2268 | # Don't test for the "default" C tag, as we know it's
|
---|
2269 | # there but not specially marked.
|
---|
2270 | case $tagname in
|
---|
2271 | CC) ;;
|
---|
2272 | *)
|
---|
2273 | if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
|
---|
2274 | taglist="$taglist $tagname"
|
---|
2275 |
|
---|
2276 | # Evaluate the configuration. Be careful to quote the path
|
---|
2277 | # and the sed script, to avoid splitting on whitespace, but
|
---|
2278 | # also don't use non-portable quotes within backquotes within
|
---|
2279 | # quotes we have to do it in 2 steps:
|
---|
2280 | extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
|
---|
2281 | eval "$extractedcf"
|
---|
2282 | else
|
---|
2283 | func_error "ignoring unknown tag $tagname"
|
---|
2284 | fi
|
---|
2285 | ;;
|
---|
2286 | esac
|
---|
2287 | }
|
---|
2288 |
|
---|
2289 |
|
---|
2290 | # func_check_version_match
|
---|
2291 | # ------------------------
|
---|
2292 | # Ensure that we are using m4 macros, and libtool script from the same
|
---|
2293 | # release of libtool.
|
---|
2294 | func_check_version_match ()
|
---|
2295 | {
|
---|
2296 | if test "$package_revision" != "$macro_revision"; then
|
---|
2297 | if test "$VERSION" != "$macro_version"; then
|
---|
2298 | if test -z "$macro_version"; then
|
---|
2299 | cat >&2 <<_LT_EOF
|
---|
2300 | $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
|
---|
2301 | $progname: definition of this LT_INIT comes from an older release.
|
---|
2302 | $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
|
---|
2303 | $progname: and run autoconf again.
|
---|
2304 | _LT_EOF
|
---|
2305 | else
|
---|
2306 | cat >&2 <<_LT_EOF
|
---|
2307 | $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
|
---|
2308 | $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
|
---|
2309 | $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
|
---|
2310 | $progname: and run autoconf again.
|
---|
2311 | _LT_EOF
|
---|
2312 | fi
|
---|
2313 | else
|
---|
2314 | cat >&2 <<_LT_EOF
|
---|
2315 | $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
|
---|
2316 | $progname: but the definition of this LT_INIT comes from revision $macro_revision.
|
---|
2317 | $progname: You should recreate aclocal.m4 with macros from revision $package_revision
|
---|
2318 | $progname: of $PACKAGE $VERSION and run autoconf again.
|
---|
2319 | _LT_EOF
|
---|
2320 | fi
|
---|
2321 |
|
---|
2322 | exit $EXIT_MISMATCH
|
---|
2323 | fi
|
---|
2324 | }
|
---|
2325 |
|
---|
2326 |
|
---|
2327 | # libtool_options_prep [ARG]...
|
---|
2328 | # -----------------------------
|
---|
2329 | # Preparation for options parsed by libtool.
|
---|
2330 | libtool_options_prep ()
|
---|
2331 | {
|
---|
2332 | $debug_mode
|
---|
2333 |
|
---|
2334 | # Option defaults:
|
---|
2335 | opt_config=false
|
---|
2336 | opt_dlopen=
|
---|
2337 | opt_dry_run=false
|
---|
2338 | opt_help=false
|
---|
2339 | opt_mode=
|
---|
2340 | opt_preserve_dup_deps=false
|
---|
2341 | opt_quiet=false
|
---|
2342 |
|
---|
2343 | nonopt=
|
---|
2344 | preserve_args=
|
---|
2345 |
|
---|
2346 | _G_rc_lt_options_prep=:
|
---|
2347 |
|
---|
2348 | # Shorthand for --mode=foo, only valid as the first argument
|
---|
2349 | case $1 in
|
---|
2350 | clean|clea|cle|cl)
|
---|
2351 | shift; set dummy --mode clean ${1+"$@"}; shift
|
---|
2352 | ;;
|
---|
2353 | compile|compil|compi|comp|com|co|c)
|
---|
2354 | shift; set dummy --mode compile ${1+"$@"}; shift
|
---|
2355 | ;;
|
---|
2356 | execute|execut|execu|exec|exe|ex|e)
|
---|
2357 | shift; set dummy --mode execute ${1+"$@"}; shift
|
---|
2358 | ;;
|
---|
2359 | finish|finis|fini|fin|fi|f)
|
---|
2360 | shift; set dummy --mode finish ${1+"$@"}; shift
|
---|
2361 | ;;
|
---|
2362 | install|instal|insta|inst|ins|in|i)
|
---|
2363 | shift; set dummy --mode install ${1+"$@"}; shift
|
---|
2364 | ;;
|
---|
2365 | link|lin|li|l)
|
---|
2366 | shift; set dummy --mode link ${1+"$@"}; shift
|
---|
2367 | ;;
|
---|
2368 | uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
|
---|
2369 | shift; set dummy --mode uninstall ${1+"$@"}; shift
|
---|
2370 | ;;
|
---|
2371 | *)
|
---|
2372 | _G_rc_lt_options_prep=false
|
---|
2373 | ;;
|
---|
2374 | esac
|
---|
2375 |
|
---|
2376 | if $_G_rc_lt_options_prep; then
|
---|
2377 | # Pass back the list of options.
|
---|
2378 | func_quote_for_eval ${1+"$@"}
|
---|
2379 | libtool_options_prep_result=$func_quote_for_eval_result
|
---|
2380 | fi
|
---|
2381 |
|
---|
2382 | $_G_rc_lt_options_prep
|
---|
2383 | }
|
---|
2384 | func_add_hook func_options_prep libtool_options_prep
|
---|
2385 |
|
---|
2386 |
|
---|
2387 | # libtool_parse_options [ARG]...
|
---|
2388 | # ---------------------------------
|
---|
2389 | # Provide handling for libtool specific options.
|
---|
2390 | libtool_parse_options ()
|
---|
2391 | {
|
---|
2392 | $debug_cmd
|
---|
2393 |
|
---|
2394 | _G_rc_lt_parse_options=false
|
---|
2395 |
|
---|
2396 | # Perform our own loop to consume as many options as possible in
|
---|
2397 | # each iteration.
|
---|
2398 | while test $# -gt 0; do
|
---|
2399 | _G_match_lt_parse_options=:
|
---|
2400 | _G_opt=$1
|
---|
2401 | shift
|
---|
2402 | case $_G_opt in
|
---|
2403 | --dry-run|--dryrun|-n)
|
---|
2404 | opt_dry_run=:
|
---|
2405 | ;;
|
---|
2406 |
|
---|
2407 | --config) func_config ;;
|
---|
2408 |
|
---|
2409 | --dlopen|-dlopen)
|
---|
2410 | opt_dlopen="${opt_dlopen+$opt_dlopen
|
---|
2411 | }$1"
|
---|
2412 | shift
|
---|
2413 | ;;
|
---|
2414 |
|
---|
2415 | --preserve-dup-deps)
|
---|
2416 | opt_preserve_dup_deps=: ;;
|
---|
2417 |
|
---|
2418 | --features) func_features ;;
|
---|
2419 |
|
---|
2420 | --finish) set dummy --mode finish ${1+"$@"}; shift ;;
|
---|
2421 |
|
---|
2422 | --help) opt_help=: ;;
|
---|
2423 |
|
---|
2424 | --help-all) opt_help=': help-all' ;;
|
---|
2425 |
|
---|
2426 | --mode) test $# = 0 && func_missing_arg $_G_opt && break
|
---|
2427 | opt_mode=$1
|
---|
2428 | case $1 in
|
---|
2429 | # Valid mode arguments:
|
---|
2430 | clean|compile|execute|finish|install|link|relink|uninstall) ;;
|
---|
2431 |
|
---|
2432 | # Catch anything else as an error
|
---|
2433 | *) func_error "invalid argument for $_G_opt"
|
---|
2434 | exit_cmd=exit
|
---|
2435 | break
|
---|
2436 | ;;
|
---|
2437 | esac
|
---|
2438 | shift
|
---|
2439 | ;;
|
---|
2440 |
|
---|
2441 | --no-silent|--no-quiet)
|
---|
2442 | opt_quiet=false
|
---|
2443 | func_append preserve_args " $_G_opt"
|
---|
2444 | ;;
|
---|
2445 |
|
---|
2446 | --no-warnings|--no-warning|--no-warn)
|
---|
2447 | opt_warning=false
|
---|
2448 | func_append preserve_args " $_G_opt"
|
---|
2449 | ;;
|
---|
2450 |
|
---|
2451 | --no-verbose)
|
---|
2452 | opt_verbose=false
|
---|
2453 | func_append preserve_args " $_G_opt"
|
---|
2454 | ;;
|
---|
2455 |
|
---|
2456 | --silent|--quiet)
|
---|
2457 | opt_quiet=:
|
---|
2458 | opt_verbose=false
|
---|
2459 | func_append preserve_args " $_G_opt"
|
---|
2460 | ;;
|
---|
2461 |
|
---|
2462 | --tag) test $# = 0 && func_missing_arg $_G_opt && break
|
---|
2463 | opt_tag=$1
|
---|
2464 | func_append preserve_args " $_G_opt $1"
|
---|
2465 | func_enable_tag "$1"
|
---|
2466 | shift
|
---|
2467 | ;;
|
---|
2468 |
|
---|
2469 | --verbose|-v) opt_quiet=false
|
---|
2470 | opt_verbose=:
|
---|
2471 | func_append preserve_args " $_G_opt"
|
---|
2472 | ;;
|
---|
2473 |
|
---|
2474 | # An option not handled by this hook function:
|
---|
2475 | *) set dummy "$_G_opt" ${1+"$@"} ; shift
|
---|
2476 | _G_match_lt_parse_options=false
|
---|
2477 | break
|
---|
2478 | ;;
|
---|
2479 | esac
|
---|
2480 | $_G_match_lt_parse_options && _G_rc_lt_parse_options=:
|
---|
2481 | done
|
---|
2482 |
|
---|
2483 | if $_G_rc_lt_parse_options; then
|
---|
2484 | # save modified positional parameters for caller
|
---|
2485 | func_quote_for_eval ${1+"$@"}
|
---|
2486 | libtool_parse_options_result=$func_quote_for_eval_result
|
---|
2487 | fi
|
---|
2488 |
|
---|
2489 | $_G_rc_lt_parse_options
|
---|
2490 | }
|
---|
2491 | func_add_hook func_parse_options libtool_parse_options
|
---|
2492 |
|
---|
2493 |
|
---|
2494 |
|
---|
2495 | # libtool_validate_options [ARG]...
|
---|
2496 | # ---------------------------------
|
---|
2497 | # Perform any sanity checks on option settings and/or unconsumed
|
---|
2498 | # arguments.
|
---|
2499 | libtool_validate_options ()
|
---|
2500 | {
|
---|
2501 | # save first non-option argument
|
---|
2502 | if test 0 -lt $#; then
|
---|
2503 | nonopt=$1
|
---|
2504 | shift
|
---|
2505 | fi
|
---|
2506 |
|
---|
2507 | # preserve --debug
|
---|
2508 | test : = "$debug_cmd" || func_append preserve_args " --debug"
|
---|
2509 |
|
---|
2510 | case $host in
|
---|
2511 | # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452
|
---|
2512 | # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788
|
---|
2513 | *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*)
|
---|
2514 | # don't eliminate duplications in $postdeps and $predeps
|
---|
2515 | opt_duplicate_compiler_generated_deps=:
|
---|
2516 | ;;
|
---|
2517 | *)
|
---|
2518 | opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
|
---|
2519 | ;;
|
---|
2520 | esac
|
---|
2521 |
|
---|
2522 | $opt_help || {
|
---|
2523 | # Sanity checks first:
|
---|
2524 | func_check_version_match
|
---|
2525 |
|
---|
2526 | test yes != "$build_libtool_libs" \
|
---|
2527 | && test yes != "$build_old_libs" \
|
---|
2528 | && func_fatal_configuration "not configured to build any kind of library"
|
---|
2529 |
|
---|
2530 | # Darwin sucks
|
---|
2531 | eval std_shrext=\"$shrext_cmds\"
|
---|
2532 |
|
---|
2533 | # Only execute mode is allowed to have -dlopen flags.
|
---|
2534 | if test -n "$opt_dlopen" && test execute != "$opt_mode"; then
|
---|
2535 | func_error "unrecognized option '-dlopen'"
|
---|
2536 | $ECHO "$help" 1>&2
|
---|
2537 | exit $EXIT_FAILURE
|
---|
2538 | fi
|
---|
2539 |
|
---|
2540 | # Change the help message to a mode-specific one.
|
---|
2541 | generic_help=$help
|
---|
2542 | help="Try '$progname --help --mode=$opt_mode' for more information."
|
---|
2543 | }
|
---|
2544 |
|
---|
2545 | # Pass back the unparsed argument list
|
---|
2546 | func_quote_for_eval ${1+"$@"}
|
---|
2547 | libtool_validate_options_result=$func_quote_for_eval_result
|
---|
2548 | }
|
---|
2549 | func_add_hook func_validate_options libtool_validate_options
|
---|
2550 |
|
---|
2551 |
|
---|
2552 | # Process options as early as possible so that --help and --version
|
---|
2553 | # can return quickly.
|
---|
2554 | func_options ${1+"$@"}
|
---|
2555 | eval set dummy "$func_options_result"; shift
|
---|
2556 |
|
---|
2557 |
|
---|
2558 |
|
---|
2559 | ## ----------- ##
|
---|
2560 | ## Main. ##
|
---|
2561 | ## ----------- ##
|
---|
2562 |
|
---|
2563 | magic='%%%MAGIC variable%%%'
|
---|
2564 | magic_exe='%%%MAGIC EXE variable%%%'
|
---|
2565 |
|
---|
2566 | # Global variables.
|
---|
2567 | extracted_archives=
|
---|
2568 | extracted_serial=0
|
---|
2569 |
|
---|
2570 | # If this variable is set in any of the actions, the command in it
|
---|
2571 | # will be execed at the end. This prevents here-documents from being
|
---|
2572 | # left over by shells.
|
---|
2573 | exec_cmd=
|
---|
2574 |
|
---|
2575 |
|
---|
2576 | # A function that is used when there is no print builtin or printf.
|
---|
2577 | func_fallback_echo ()
|
---|
2578 | {
|
---|
2579 | eval 'cat <<_LTECHO_EOF
|
---|
2580 | $1
|
---|
2581 | _LTECHO_EOF'
|
---|
2582 | }
|
---|
2583 |
|
---|
2584 | # func_generated_by_libtool
|
---|
2585 | # True iff stdin has been generated by Libtool. This function is only
|
---|
2586 | # a basic sanity check; it will hardly flush out determined imposters.
|
---|
2587 | func_generated_by_libtool_p ()
|
---|
2588 | {
|
---|
2589 | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
|
---|
2590 | }
|
---|
2591 |
|
---|
2592 | # func_lalib_p file
|
---|
2593 | # True iff FILE is a libtool '.la' library or '.lo' object file.
|
---|
2594 | # This function is only a basic sanity check; it will hardly flush out
|
---|
2595 | # determined imposters.
|
---|
2596 | func_lalib_p ()
|
---|
2597 | {
|
---|
2598 | test -f "$1" &&
|
---|
2599 | $SED -e 4q "$1" 2>/dev/null | func_generated_by_libtool_p
|
---|
2600 | }
|
---|
2601 |
|
---|
2602 | # func_lalib_unsafe_p file
|
---|
2603 | # True iff FILE is a libtool '.la' library or '.lo' object file.
|
---|
2604 | # This function implements the same check as func_lalib_p without
|
---|
2605 | # resorting to external programs. To this end, it redirects stdin and
|
---|
2606 | # closes it afterwards, without saving the original file descriptor.
|
---|
2607 | # As a safety measure, use it only where a negative result would be
|
---|
2608 | # fatal anyway. Works if 'file' does not exist.
|
---|
2609 | func_lalib_unsafe_p ()
|
---|
2610 | {
|
---|
2611 | lalib_p=no
|
---|
2612 | if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
|
---|
2613 | for lalib_p_l in 1 2 3 4
|
---|
2614 | do
|
---|
2615 | read lalib_p_line
|
---|
2616 | case $lalib_p_line in
|
---|
2617 | \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
|
---|
2618 | esac
|
---|
2619 | done
|
---|
2620 | exec 0<&5 5<&-
|
---|
2621 | fi
|
---|
2622 | test yes = "$lalib_p"
|
---|
2623 | }
|
---|
2624 |
|
---|
2625 | # func_ltwrapper_script_p file
|
---|
2626 | # True iff FILE is a libtool wrapper script
|
---|
2627 | # This function is only a basic sanity check; it will hardly flush out
|
---|
2628 | # determined imposters.
|
---|
2629 | func_ltwrapper_script_p ()
|
---|
2630 | {
|
---|
2631 | test -f "$1" &&
|
---|
2632 | $lt_truncate_bin < "$1" 2>/dev/null | func_generated_by_libtool_p
|
---|
2633 | }
|
---|
2634 |
|
---|
2635 | # func_ltwrapper_executable_p file
|
---|
2636 | # True iff FILE is a libtool wrapper executable
|
---|
2637 | # This function is only a basic sanity check; it will hardly flush out
|
---|
2638 | # determined imposters.
|
---|
2639 | func_ltwrapper_executable_p ()
|
---|
2640 | {
|
---|
2641 | func_ltwrapper_exec_suffix=
|
---|
2642 | case $1 in
|
---|
2643 | *.exe) ;;
|
---|
2644 | *) func_ltwrapper_exec_suffix=.exe ;;
|
---|
2645 | esac
|
---|
2646 | $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
|
---|
2647 | }
|
---|
2648 |
|
---|
2649 | # func_ltwrapper_scriptname file
|
---|
2650 | # Assumes file is an ltwrapper_executable
|
---|
2651 | # uses $file to determine the appropriate filename for a
|
---|
2652 | # temporary ltwrapper_script.
|
---|
2653 | func_ltwrapper_scriptname ()
|
---|
2654 | {
|
---|
2655 | func_dirname_and_basename "$1" "" "."
|
---|
2656 | func_stripname '' '.exe' "$func_basename_result"
|
---|
2657 | func_ltwrapper_scriptname_result=$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper
|
---|
2658 | }
|
---|
2659 |
|
---|
2660 | # func_ltwrapper_p file
|
---|
2661 | # True iff FILE is a libtool wrapper script or wrapper executable
|
---|
2662 | # This function is only a basic sanity check; it will hardly flush out
|
---|
2663 | # determined imposters.
|
---|
2664 | func_ltwrapper_p ()
|
---|
2665 | {
|
---|
2666 | func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
|
---|
2667 | }
|
---|
2668 |
|
---|
2669 |
|
---|
2670 | # func_execute_cmds commands fail_cmd
|
---|
2671 | # Execute tilde-delimited COMMANDS.
|
---|
2672 | # If FAIL_CMD is given, eval that upon failure.
|
---|
2673 | # FAIL_CMD may read-access the current command in variable CMD!
|
---|
2674 | func_execute_cmds ()
|
---|
2675 | {
|
---|
2676 | $debug_cmd
|
---|
2677 |
|
---|
2678 | save_ifs=$IFS; IFS='~'
|
---|
2679 | for cmd in $1; do
|
---|
2680 | IFS=$sp$nl
|
---|
2681 | eval cmd=\"$cmd\"
|
---|
2682 | IFS=$save_ifs
|
---|
2683 | func_show_eval "$cmd" "${2-:}"
|
---|
2684 | done
|
---|
2685 | IFS=$save_ifs
|
---|
2686 | }
|
---|
2687 |
|
---|
2688 |
|
---|
2689 | # func_source file
|
---|
2690 | # Source FILE, adding directory component if necessary.
|
---|
2691 | # Note that it is not necessary on cygwin/mingw to append a dot to
|
---|
2692 | # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
|
---|
2693 | # behavior happens only for exec(3), not for open(2)! Also, sourcing
|
---|
2694 | # 'FILE.' does not work on cygwin managed mounts.
|
---|
2695 | func_source ()
|
---|
2696 | {
|
---|
2697 | $debug_cmd
|
---|
2698 |
|
---|
2699 | case $1 in
|
---|
2700 | */* | *\\*) . "$1" ;;
|
---|
2701 | *) . "./$1" ;;
|
---|
2702 | esac
|
---|
2703 | }
|
---|
2704 |
|
---|
2705 |
|
---|
2706 | # func_resolve_sysroot PATH
|
---|
2707 | # Replace a leading = in PATH with a sysroot. Store the result into
|
---|
2708 | # func_resolve_sysroot_result
|
---|
2709 | func_resolve_sysroot ()
|
---|
2710 | {
|
---|
2711 | func_resolve_sysroot_result=$1
|
---|
2712 | case $func_resolve_sysroot_result in
|
---|
2713 | =*)
|
---|
2714 | func_stripname '=' '' "$func_resolve_sysroot_result"
|
---|
2715 | func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
|
---|
2716 | ;;
|
---|
2717 | esac
|
---|
2718 | }
|
---|
2719 |
|
---|
2720 | # func_replace_sysroot PATH
|
---|
2721 | # If PATH begins with the sysroot, replace it with = and
|
---|
2722 | # store the result into func_replace_sysroot_result.
|
---|
2723 | func_replace_sysroot ()
|
---|
2724 | {
|
---|
2725 | case $lt_sysroot:$1 in
|
---|
2726 | ?*:"$lt_sysroot"*)
|
---|
2727 | func_stripname "$lt_sysroot" '' "$1"
|
---|
2728 | func_replace_sysroot_result='='$func_stripname_result
|
---|
2729 | ;;
|
---|
2730 | *)
|
---|
2731 | # Including no sysroot.
|
---|
2732 | func_replace_sysroot_result=$1
|
---|
2733 | ;;
|
---|
2734 | esac
|
---|
2735 | }
|
---|
2736 |
|
---|
2737 | # func_infer_tag arg
|
---|
2738 | # Infer tagged configuration to use if any are available and
|
---|
2739 | # if one wasn't chosen via the "--tag" command line option.
|
---|
2740 | # Only attempt this if the compiler in the base compile
|
---|
2741 | # command doesn't match the default compiler.
|
---|
2742 | # arg is usually of the form 'gcc ...'
|
---|
2743 | func_infer_tag ()
|
---|
2744 | {
|
---|
2745 | $debug_cmd
|
---|
2746 |
|
---|
2747 | if test -n "$available_tags" && test -z "$tagname"; then
|
---|
2748 | CC_quoted=
|
---|
2749 | for arg in $CC; do
|
---|
2750 | func_append_quoted CC_quoted "$arg"
|
---|
2751 | done
|
---|
2752 | CC_expanded=`func_echo_all $CC`
|
---|
2753 | CC_quoted_expanded=`func_echo_all $CC_quoted`
|
---|
2754 | case $@ in
|
---|
2755 | # Blanks in the command may have been stripped by the calling shell,
|
---|
2756 | # but not from the CC environment variable when configure was run.
|
---|
2757 | " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
|
---|
2758 | " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
|
---|
2759 | # Blanks at the start of $base_compile will cause this to fail
|
---|
2760 | # if we don't check for them as well.
|
---|
2761 | *)
|
---|
2762 | for z in $available_tags; do
|
---|
2763 | if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
|
---|
2764 | # Evaluate the configuration.
|
---|
2765 | eval "`$SED -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
|
---|
2766 | CC_quoted=
|
---|
2767 | for arg in $CC; do
|
---|
2768 | # Double-quote args containing other shell metacharacters.
|
---|
2769 | func_append_quoted CC_quoted "$arg"
|
---|
2770 | done
|
---|
2771 | CC_expanded=`func_echo_all $CC`
|
---|
2772 | CC_quoted_expanded=`func_echo_all $CC_quoted`
|
---|
2773 | case "$@ " in
|
---|
2774 | " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
|
---|
2775 | " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
|
---|
2776 | # The compiler in the base compile command matches
|
---|
2777 | # the one in the tagged configuration.
|
---|
2778 | # Assume this is the tagged configuration we want.
|
---|
2779 | tagname=$z
|
---|
2780 | break
|
---|
2781 | ;;
|
---|
2782 | esac
|
---|
2783 | fi
|
---|
2784 | done
|
---|
2785 | # If $tagname still isn't set, then no tagged configuration
|
---|
2786 | # was found and let the user know that the "--tag" command
|
---|
2787 | # line option must be used.
|
---|
2788 | if test -z "$tagname"; then
|
---|
2789 | func_echo "unable to infer tagged configuration"
|
---|
2790 | func_fatal_error "specify a tag with '--tag'"
|
---|
2791 | # else
|
---|
2792 | # func_verbose "using $tagname tagged configuration"
|
---|
2793 | fi
|
---|
2794 | ;;
|
---|
2795 | esac
|
---|
2796 | fi
|
---|
2797 | }
|
---|
2798 |
|
---|
2799 |
|
---|
2800 |
|
---|
2801 | # func_write_libtool_object output_name pic_name nonpic_name
|
---|
2802 | # Create a libtool object file (analogous to a ".la" file),
|
---|
2803 | # but don't create it if we're doing a dry run.
|
---|
2804 | func_write_libtool_object ()
|
---|
2805 | {
|
---|
2806 | write_libobj=$1
|
---|
2807 | if test yes = "$build_libtool_libs"; then
|
---|
2808 | write_lobj=\'$2\'
|
---|
2809 | else
|
---|
2810 | write_lobj=none
|
---|
2811 | fi
|
---|
2812 |
|
---|
2813 | if test yes = "$build_old_libs"; then
|
---|
2814 | write_oldobj=\'$3\'
|
---|
2815 | else
|
---|
2816 | write_oldobj=none
|
---|
2817 | fi
|
---|
2818 |
|
---|
2819 | $opt_dry_run || {
|
---|
2820 | cat >${write_libobj}T <<EOF
|
---|
2821 | # $write_libobj - a libtool object file
|
---|
2822 | # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
|
---|
2823 | #
|
---|
2824 | # Please DO NOT delete this file!
|
---|
2825 | # It is necessary for linking the library.
|
---|
2826 |
|
---|
2827 | # Name of the PIC object.
|
---|
2828 | pic_object=$write_lobj
|
---|
2829 |
|
---|
2830 | # Name of the non-PIC object
|
---|
2831 | non_pic_object=$write_oldobj
|
---|
2832 |
|
---|
2833 | EOF
|
---|
2834 | $MV "${write_libobj}T" "$write_libobj"
|
---|
2835 | }
|
---|
2836 | }
|
---|
2837 |
|
---|
2838 |
|
---|
2839 | ##################################################
|
---|
2840 | # FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
|
---|
2841 | ##################################################
|
---|
2842 |
|
---|
2843 | # func_convert_core_file_wine_to_w32 ARG
|
---|
2844 | # Helper function used by file name conversion functions when $build is *nix,
|
---|
2845 | # and $host is mingw, cygwin, or some other w32 environment. Relies on a
|
---|
2846 | # correctly configured wine environment available, with the winepath program
|
---|
2847 | # in $build's $PATH.
|
---|
2848 | #
|
---|
2849 | # ARG is the $build file name to be converted to w32 format.
|
---|
2850 | # Result is available in $func_convert_core_file_wine_to_w32_result, and will
|
---|
2851 | # be empty on error (or when ARG is empty)
|
---|
2852 | func_convert_core_file_wine_to_w32 ()
|
---|
2853 | {
|
---|
2854 | $debug_cmd
|
---|
2855 |
|
---|
2856 | func_convert_core_file_wine_to_w32_result=$1
|
---|
2857 | if test -n "$1"; then
|
---|
2858 | # Unfortunately, winepath does not exit with a non-zero error code, so we
|
---|
2859 | # are forced to check the contents of stdout. On the other hand, if the
|
---|
2860 | # command is not found, the shell will set an exit code of 127 and print
|
---|
2861 | # *an error message* to stdout. So we must check for both error code of
|
---|
2862 | # zero AND non-empty stdout, which explains the odd construction:
|
---|
2863 | func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
|
---|
2864 | if test "$?" -eq 0 && test -n "$func_convert_core_file_wine_to_w32_tmp"; then
|
---|
2865 | func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
|
---|
2866 | $SED -e "$sed_naive_backslashify"`
|
---|
2867 | else
|
---|
2868 | func_convert_core_file_wine_to_w32_result=
|
---|
2869 | fi
|
---|
2870 | fi
|
---|
2871 | }
|
---|
2872 | # end: func_convert_core_file_wine_to_w32
|
---|
2873 |
|
---|
2874 |
|
---|
2875 | # func_convert_core_path_wine_to_w32 ARG
|
---|
2876 | # Helper function used by path conversion functions when $build is *nix, and
|
---|
2877 | # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
|
---|
2878 | # configured wine environment available, with the winepath program in $build's
|
---|
2879 | # $PATH. Assumes ARG has no leading or trailing path separator characters.
|
---|
2880 | #
|
---|
2881 | # ARG is path to be converted from $build format to win32.
|
---|
2882 | # Result is available in $func_convert_core_path_wine_to_w32_result.
|
---|
2883 | # Unconvertible file (directory) names in ARG are skipped; if no directory names
|
---|
2884 | # are convertible, then the result may be empty.
|
---|
2885 | func_convert_core_path_wine_to_w32 ()
|
---|
2886 | {
|
---|
2887 | $debug_cmd
|
---|
2888 |
|
---|
2889 | # unfortunately, winepath doesn't convert paths, only file names
|
---|
2890 | func_convert_core_path_wine_to_w32_result=
|
---|
2891 | if test -n "$1"; then
|
---|
2892 | oldIFS=$IFS
|
---|
2893 | IFS=:
|
---|
2894 | for func_convert_core_path_wine_to_w32_f in $1; do
|
---|
2895 | IFS=$oldIFS
|
---|
2896 | func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
|
---|
2897 | if test -n "$func_convert_core_file_wine_to_w32_result"; then
|
---|
2898 | if test -z "$func_convert_core_path_wine_to_w32_result"; then
|
---|
2899 | func_convert_core_path_wine_to_w32_result=$func_convert_core_file_wine_to_w32_result
|
---|
2900 | else
|
---|
2901 | func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
|
---|
2902 | fi
|
---|
2903 | fi
|
---|
2904 | done
|
---|
2905 | IFS=$oldIFS
|
---|
2906 | fi
|
---|
2907 | }
|
---|
2908 | # end: func_convert_core_path_wine_to_w32
|
---|
2909 |
|
---|
2910 |
|
---|
2911 | # func_cygpath ARGS...
|
---|
2912 | # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
|
---|
2913 | # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
|
---|
2914 | # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
|
---|
2915 | # (2), returns the Cygwin file name or path in func_cygpath_result (input
|
---|
2916 | # file name or path is assumed to be in w32 format, as previously converted
|
---|
2917 | # from $build's *nix or MSYS format). In case (3), returns the w32 file name
|
---|
2918 | # or path in func_cygpath_result (input file name or path is assumed to be in
|
---|
2919 | # Cygwin format). Returns an empty string on error.
|
---|
2920 | #
|
---|
2921 | # ARGS are passed to cygpath, with the last one being the file name or path to
|
---|
2922 | # be converted.
|
---|
2923 | #
|
---|
2924 | # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
|
---|
2925 | # environment variable; do not put it in $PATH.
|
---|
2926 | func_cygpath ()
|
---|
2927 | {
|
---|
2928 | $debug_cmd
|
---|
2929 |
|
---|
2930 | if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
|
---|
2931 | func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
|
---|
2932 | if test "$?" -ne 0; then
|
---|
2933 | # on failure, ensure result is empty
|
---|
2934 | func_cygpath_result=
|
---|
2935 | fi
|
---|
2936 | else
|
---|
2937 | func_cygpath_result=
|
---|
2938 | func_error "LT_CYGPATH is empty or specifies non-existent file: '$LT_CYGPATH'"
|
---|
2939 | fi
|
---|
2940 | }
|
---|
2941 | #end: func_cygpath
|
---|
2942 |
|
---|
2943 |
|
---|
2944 | # func_convert_core_msys_to_w32 ARG
|
---|
2945 | # Convert file name or path ARG from MSYS format to w32 format. Return
|
---|
2946 | # result in func_convert_core_msys_to_w32_result.
|
---|
2947 | func_convert_core_msys_to_w32 ()
|
---|
2948 | {
|
---|
2949 | $debug_cmd
|
---|
2950 |
|
---|
2951 | # awkward: cmd appends spaces to result
|
---|
2952 | func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
|
---|
2953 | $SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"`
|
---|
2954 | }
|
---|
2955 | #end: func_convert_core_msys_to_w32
|
---|
2956 |
|
---|
2957 |
|
---|
2958 | # func_convert_file_check ARG1 ARG2
|
---|
2959 | # Verify that ARG1 (a file name in $build format) was converted to $host
|
---|
2960 | # format in ARG2. Otherwise, emit an error message, but continue (resetting
|
---|
2961 | # func_to_host_file_result to ARG1).
|
---|
2962 | func_convert_file_check ()
|
---|
2963 | {
|
---|
2964 | $debug_cmd
|
---|
2965 |
|
---|
2966 | if test -z "$2" && test -n "$1"; then
|
---|
2967 | func_error "Could not determine host file name corresponding to"
|
---|
2968 | func_error " '$1'"
|
---|
2969 | func_error "Continuing, but uninstalled executables may not work."
|
---|
2970 | # Fallback:
|
---|
2971 | func_to_host_file_result=$1
|
---|
2972 | fi
|
---|
2973 | }
|
---|
2974 | # end func_convert_file_check
|
---|
2975 |
|
---|
2976 |
|
---|
2977 | # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
|
---|
2978 | # Verify that FROM_PATH (a path in $build format) was converted to $host
|
---|
2979 | # format in TO_PATH. Otherwise, emit an error message, but continue, resetting
|
---|
2980 | # func_to_host_file_result to a simplistic fallback value (see below).
|
---|
2981 | func_convert_path_check ()
|
---|
2982 | {
|
---|
2983 | $debug_cmd
|
---|
2984 |
|
---|
2985 | if test -z "$4" && test -n "$3"; then
|
---|
2986 | func_error "Could not determine the host path corresponding to"
|
---|
2987 | func_error " '$3'"
|
---|
2988 | func_error "Continuing, but uninstalled executables may not work."
|
---|
2989 | # Fallback. This is a deliberately simplistic "conversion" and
|
---|
2990 | # should not be "improved". See libtool.info.
|
---|
2991 | if test "x$1" != "x$2"; then
|
---|
2992 | lt_replace_pathsep_chars="s|$1|$2|g"
|
---|
2993 | func_to_host_path_result=`echo "$3" |
|
---|
2994 | $SED -e "$lt_replace_pathsep_chars"`
|
---|
2995 | else
|
---|
2996 | func_to_host_path_result=$3
|
---|
2997 | fi
|
---|
2998 | fi
|
---|
2999 | }
|
---|
3000 | # end func_convert_path_check
|
---|
3001 |
|
---|
3002 |
|
---|
3003 | # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
|
---|
3004 | # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
|
---|
3005 | # and appending REPL if ORIG matches BACKPAT.
|
---|
3006 | func_convert_path_front_back_pathsep ()
|
---|
3007 | {
|
---|
3008 | $debug_cmd
|
---|
3009 |
|
---|
3010 | case $4 in
|
---|
3011 | $1 ) func_to_host_path_result=$3$func_to_host_path_result
|
---|
3012 | ;;
|
---|
3013 | esac
|
---|
3014 | case $4 in
|
---|
3015 | $2 ) func_append func_to_host_path_result "$3"
|
---|
3016 | ;;
|
---|
3017 | esac
|
---|
3018 | }
|
---|
3019 | # end func_convert_path_front_back_pathsep
|
---|
3020 |
|
---|
3021 |
|
---|
3022 | ##################################################
|
---|
3023 | # $build to $host FILE NAME CONVERSION FUNCTIONS #
|
---|
3024 | ##################################################
|
---|
3025 | # invoked via '$to_host_file_cmd ARG'
|
---|
3026 | #
|
---|
3027 | # In each case, ARG is the path to be converted from $build to $host format.
|
---|
3028 | # Result will be available in $func_to_host_file_result.
|
---|
3029 |
|
---|
3030 |
|
---|
3031 | # func_to_host_file ARG
|
---|
3032 | # Converts the file name ARG from $build format to $host format. Return result
|
---|
3033 | # in func_to_host_file_result.
|
---|
3034 | func_to_host_file ()
|
---|
3035 | {
|
---|
3036 | $debug_cmd
|
---|
3037 |
|
---|
3038 | $to_host_file_cmd "$1"
|
---|
3039 | }
|
---|
3040 | # end func_to_host_file
|
---|
3041 |
|
---|
3042 |
|
---|
3043 | # func_to_tool_file ARG LAZY
|
---|
3044 | # converts the file name ARG from $build format to toolchain format. Return
|
---|
3045 | # result in func_to_tool_file_result. If the conversion in use is listed
|
---|
3046 | # in (the comma separated) LAZY, no conversion takes place.
|
---|
3047 | func_to_tool_file ()
|
---|
3048 | {
|
---|
3049 | $debug_cmd
|
---|
3050 |
|
---|
3051 | case ,$2, in
|
---|
3052 | *,"$to_tool_file_cmd",*)
|
---|
3053 | func_to_tool_file_result=$1
|
---|
3054 | ;;
|
---|
3055 | *)
|
---|
3056 | $to_tool_file_cmd "$1"
|
---|
3057 | func_to_tool_file_result=$func_to_host_file_result
|
---|
3058 | ;;
|
---|
3059 | esac
|
---|
3060 | }
|
---|
3061 | # end func_to_tool_file
|
---|
3062 |
|
---|
3063 |
|
---|
3064 | # func_convert_file_noop ARG
|
---|
3065 | # Copy ARG to func_to_host_file_result.
|
---|
3066 | func_convert_file_noop ()
|
---|
3067 | {
|
---|
3068 | func_to_host_file_result=$1
|
---|
3069 | }
|
---|
3070 | # end func_convert_file_noop
|
---|
3071 |
|
---|
3072 |
|
---|
3073 | # func_convert_file_msys_to_w32 ARG
|
---|
3074 | # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
|
---|
3075 | # conversion to w32 is not available inside the cwrapper. Returns result in
|
---|
3076 | # func_to_host_file_result.
|
---|
3077 | func_convert_file_msys_to_w32 ()
|
---|
3078 | {
|
---|
3079 | $debug_cmd
|
---|
3080 |
|
---|
3081 | func_to_host_file_result=$1
|
---|
3082 | if test -n "$1"; then
|
---|
3083 | func_convert_core_msys_to_w32 "$1"
|
---|
3084 | func_to_host_file_result=$func_convert_core_msys_to_w32_result
|
---|
3085 | fi
|
---|
3086 | func_convert_file_check "$1" "$func_to_host_file_result"
|
---|
3087 | }
|
---|
3088 | # end func_convert_file_msys_to_w32
|
---|
3089 |
|
---|
3090 |
|
---|
3091 | # func_convert_file_cygwin_to_w32 ARG
|
---|
3092 | # Convert file name ARG from Cygwin to w32 format. Returns result in
|
---|
3093 | # func_to_host_file_result.
|
---|
3094 | func_convert_file_cygwin_to_w32 ()
|
---|
3095 | {
|
---|
3096 | $debug_cmd
|
---|
3097 |
|
---|
3098 | func_to_host_file_result=$1
|
---|
3099 | if test -n "$1"; then
|
---|
3100 | # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
|
---|
3101 | # LT_CYGPATH in this case.
|
---|
3102 | func_to_host_file_result=`cygpath -m "$1"`
|
---|
3103 | fi
|
---|
3104 | func_convert_file_check "$1" "$func_to_host_file_result"
|
---|
3105 | }
|
---|
3106 | # end func_convert_file_cygwin_to_w32
|
---|
3107 |
|
---|
3108 |
|
---|
3109 | # func_convert_file_nix_to_w32 ARG
|
---|
3110 | # Convert file name ARG from *nix to w32 format. Requires a wine environment
|
---|
3111 | # and a working winepath. Returns result in func_to_host_file_result.
|
---|
3112 | func_convert_file_nix_to_w32 ()
|
---|
3113 | {
|
---|
3114 | $debug_cmd
|
---|
3115 |
|
---|
3116 | func_to_host_file_result=$1
|
---|
3117 | if test -n "$1"; then
|
---|
3118 | func_convert_core_file_wine_to_w32 "$1"
|
---|
3119 | func_to_host_file_result=$func_convert_core_file_wine_to_w32_result
|
---|
3120 | fi
|
---|
3121 | func_convert_file_check "$1" "$func_to_host_file_result"
|
---|
3122 | }
|
---|
3123 | # end func_convert_file_nix_to_w32
|
---|
3124 |
|
---|
3125 |
|
---|
3126 | # func_convert_file_msys_to_cygwin ARG
|
---|
3127 | # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
|
---|
3128 | # Returns result in func_to_host_file_result.
|
---|
3129 | func_convert_file_msys_to_cygwin ()
|
---|
3130 | {
|
---|
3131 | $debug_cmd
|
---|
3132 |
|
---|
3133 | func_to_host_file_result=$1
|
---|
3134 | if test -n "$1"; then
|
---|
3135 | func_convert_core_msys_to_w32 "$1"
|
---|
3136 | func_cygpath -u "$func_convert_core_msys_to_w32_result"
|
---|
3137 | func_to_host_file_result=$func_cygpath_result
|
---|
3138 | fi
|
---|
3139 | func_convert_file_check "$1" "$func_to_host_file_result"
|
---|
3140 | }
|
---|
3141 | # end func_convert_file_msys_to_cygwin
|
---|
3142 |
|
---|
3143 |
|
---|
3144 | # func_convert_file_nix_to_cygwin ARG
|
---|
3145 | # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed
|
---|
3146 | # in a wine environment, working winepath, and LT_CYGPATH set. Returns result
|
---|
3147 | # in func_to_host_file_result.
|
---|
3148 | func_convert_file_nix_to_cygwin ()
|
---|
3149 | {
|
---|
3150 | $debug_cmd
|
---|
3151 |
|
---|
3152 | func_to_host_file_result=$1
|
---|
3153 | if test -n "$1"; then
|
---|
3154 | # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
|
---|
3155 | func_convert_core_file_wine_to_w32 "$1"
|
---|
3156 | func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
|
---|
3157 | func_to_host_file_result=$func_cygpath_result
|
---|
3158 | fi
|
---|
3159 | func_convert_file_check "$1" "$func_to_host_file_result"
|
---|
3160 | }
|
---|
3161 | # end func_convert_file_nix_to_cygwin
|
---|
3162 |
|
---|
3163 |
|
---|
3164 | #############################################
|
---|
3165 | # $build to $host PATH CONVERSION FUNCTIONS #
|
---|
3166 | #############################################
|
---|
3167 | # invoked via '$to_host_path_cmd ARG'
|
---|
3168 | #
|
---|
3169 | # In each case, ARG is the path to be converted from $build to $host format.
|
---|
3170 | # The result will be available in $func_to_host_path_result.
|
---|
3171 | #
|
---|
3172 | # Path separators are also converted from $build format to $host format. If
|
---|
3173 | # ARG begins or ends with a path separator character, it is preserved (but
|
---|
3174 | # converted to $host format) on output.
|
---|
3175 | #
|
---|
3176 | # All path conversion functions are named using the following convention:
|
---|
3177 | # file name conversion function : func_convert_file_X_to_Y ()
|
---|
3178 | # path conversion function : func_convert_path_X_to_Y ()
|
---|
3179 | # where, for any given $build/$host combination the 'X_to_Y' value is the
|
---|
3180 | # same. If conversion functions are added for new $build/$host combinations,
|
---|
3181 | # the two new functions must follow this pattern, or func_init_to_host_path_cmd
|
---|
3182 | # will break.
|
---|
3183 |
|
---|
3184 |
|
---|
3185 | # func_init_to_host_path_cmd
|
---|
3186 | # Ensures that function "pointer" variable $to_host_path_cmd is set to the
|
---|
3187 | # appropriate value, based on the value of $to_host_file_cmd.
|
---|
3188 | to_host_path_cmd=
|
---|
3189 | func_init_to_host_path_cmd ()
|
---|
3190 | {
|
---|
3191 | $debug_cmd
|
---|
3192 |
|
---|
3193 | if test -z "$to_host_path_cmd"; then
|
---|
3194 | func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
|
---|
3195 | to_host_path_cmd=func_convert_path_$func_stripname_result
|
---|
3196 | fi
|
---|
3197 | }
|
---|
3198 |
|
---|
3199 |
|
---|
3200 | # func_to_host_path ARG
|
---|
3201 | # Converts the path ARG from $build format to $host format. Return result
|
---|
3202 | # in func_to_host_path_result.
|
---|
3203 | func_to_host_path ()
|
---|
3204 | {
|
---|
3205 | $debug_cmd
|
---|
3206 |
|
---|
3207 | func_init_to_host_path_cmd
|
---|
3208 | $to_host_path_cmd "$1"
|
---|
3209 | }
|
---|
3210 | # end func_to_host_path
|
---|
3211 |
|
---|
3212 |
|
---|
3213 | # func_convert_path_noop ARG
|
---|
3214 | # Copy ARG to func_to_host_path_result.
|
---|
3215 | func_convert_path_noop ()
|
---|
3216 | {
|
---|
3217 | func_to_host_path_result=$1
|
---|
3218 | }
|
---|
3219 | # end func_convert_path_noop
|
---|
3220 |
|
---|
3221 |
|
---|
3222 | # func_convert_path_msys_to_w32 ARG
|
---|
3223 | # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
|
---|
3224 | # conversion to w32 is not available inside the cwrapper. Returns result in
|
---|
3225 | # func_to_host_path_result.
|
---|
3226 | func_convert_path_msys_to_w32 ()
|
---|
3227 | {
|
---|
3228 | $debug_cmd
|
---|
3229 |
|
---|
3230 | func_to_host_path_result=$1
|
---|
3231 | if test -n "$1"; then
|
---|
3232 | # Remove leading and trailing path separator characters from ARG. MSYS
|
---|
3233 | # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
|
---|
3234 | # and winepath ignores them completely.
|
---|
3235 | func_stripname : : "$1"
|
---|
3236 | func_to_host_path_tmp1=$func_stripname_result
|
---|
3237 | func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
|
---|
3238 | func_to_host_path_result=$func_convert_core_msys_to_w32_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_msys_to_w32
|
---|
3245 |
|
---|
3246 |
|
---|
3247 | # func_convert_path_cygwin_to_w32 ARG
|
---|
3248 | # Convert path ARG from Cygwin to w32 format. Returns result in
|
---|
3249 | # func_to_host_file_result.
|
---|
3250 | func_convert_path_cygwin_to_w32 ()
|
---|
3251 | {
|
---|
3252 | $debug_cmd
|
---|
3253 |
|
---|
3254 | func_to_host_path_result=$1
|
---|
3255 | if test -n "$1"; then
|
---|
3256 | # See func_convert_path_msys_to_w32:
|
---|
3257 | func_stripname : : "$1"
|
---|
3258 | func_to_host_path_tmp1=$func_stripname_result
|
---|
3259 | func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
|
---|
3260 | func_convert_path_check : ";" \
|
---|
3261 | "$func_to_host_path_tmp1" "$func_to_host_path_result"
|
---|
3262 | func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
|
---|
3263 | fi
|
---|
3264 | }
|
---|
3265 | # end func_convert_path_cygwin_to_w32
|
---|
3266 |
|
---|
3267 |
|
---|
3268 | # func_convert_path_nix_to_w32 ARG
|
---|
3269 | # Convert path ARG from *nix to w32 format. Requires a wine environment and
|
---|
3270 | # a working winepath. Returns result in func_to_host_file_result.
|
---|
3271 | func_convert_path_nix_to_w32 ()
|
---|
3272 | {
|
---|
3273 | $debug_cmd
|
---|
3274 |
|
---|
3275 | func_to_host_path_result=$1
|
---|
3276 | if test -n "$1"; then
|
---|
3277 | # See func_convert_path_msys_to_w32:
|
---|
3278 | func_stripname : : "$1"
|
---|
3279 | func_to_host_path_tmp1=$func_stripname_result
|
---|
3280 | func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
|
---|
3281 | func_to_host_path_result=$func_convert_core_path_wine_to_w32_result
|
---|
3282 | func_convert_path_check : ";" \
|
---|
3283 | "$func_to_host_path_tmp1" "$func_to_host_path_result"
|
---|
3284 | func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
|
---|
3285 | fi
|
---|
3286 | }
|
---|
3287 | # end func_convert_path_nix_to_w32
|
---|
3288 |
|
---|
3289 |
|
---|
3290 | # func_convert_path_msys_to_cygwin ARG
|
---|
3291 | # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
|
---|
3292 | # Returns result in func_to_host_file_result.
|
---|
3293 | func_convert_path_msys_to_cygwin ()
|
---|
3294 | {
|
---|
3295 | $debug_cmd
|
---|
3296 |
|
---|
3297 | func_to_host_path_result=$1
|
---|
3298 | if test -n "$1"; then
|
---|
3299 | # See func_convert_path_msys_to_w32:
|
---|
3300 | func_stripname : : "$1"
|
---|
3301 | func_to_host_path_tmp1=$func_stripname_result
|
---|
3302 | func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
|
---|
3303 | func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
|
---|
3304 | func_to_host_path_result=$func_cygpath_result
|
---|
3305 | func_convert_path_check : : \
|
---|
3306 | "$func_to_host_path_tmp1" "$func_to_host_path_result"
|
---|
3307 | func_convert_path_front_back_pathsep ":*" "*:" : "$1"
|
---|
3308 | fi
|
---|
3309 | }
|
---|
3310 | # end func_convert_path_msys_to_cygwin
|
---|
3311 |
|
---|
3312 |
|
---|
3313 | # func_convert_path_nix_to_cygwin ARG
|
---|
3314 | # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a
|
---|
3315 | # a wine environment, working winepath, and LT_CYGPATH set. Returns result in
|
---|
3316 | # func_to_host_file_result.
|
---|
3317 | func_convert_path_nix_to_cygwin ()
|
---|
3318 | {
|
---|
3319 | $debug_cmd
|
---|
3320 |
|
---|
3321 | func_to_host_path_result=$1
|
---|
3322 | if test -n "$1"; then
|
---|
3323 | # Remove leading and trailing path separator characters from
|
---|
3324 | # ARG. msys behavior is inconsistent here, cygpath turns them
|
---|
3325 | # into '.;' and ';.', and winepath ignores them completely.
|
---|
3326 | func_stripname : : "$1"
|
---|
3327 | func_to_host_path_tmp1=$func_stripname_result
|
---|
3328 | func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
|
---|
3329 | func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
|
---|
3330 | func_to_host_path_result=$func_cygpath_result
|
---|
3331 | func_convert_path_check : : \
|
---|
3332 | "$func_to_host_path_tmp1" "$func_to_host_path_result"
|
---|
3333 | func_convert_path_front_back_pathsep ":*" "*:" : "$1"
|
---|
3334 | fi
|
---|
3335 | }
|
---|
3336 | # end func_convert_path_nix_to_cygwin
|
---|
3337 |
|
---|
3338 |
|
---|
3339 | # func_dll_def_p FILE
|
---|
3340 | # True iff FILE is a Windows DLL '.def' file.
|
---|
3341 | # Keep in sync with _LT_DLL_DEF_P in libtool.m4
|
---|
3342 | func_dll_def_p ()
|
---|
3343 | {
|
---|
3344 | $debug_cmd
|
---|
3345 |
|
---|
3346 | func_dll_def_p_tmp=`$SED -n \
|
---|
3347 | -e 's/^[ ]*//' \
|
---|
3348 | -e '/^\(;.*\)*$/d' \
|
---|
3349 | -e 's/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p' \
|
---|
3350 | -e q \
|
---|
3351 | "$1"`
|
---|
3352 | test DEF = "$func_dll_def_p_tmp"
|
---|
3353 | }
|
---|
3354 |
|
---|
3355 |
|
---|
3356 | # func_mode_compile arg...
|
---|
3357 | func_mode_compile ()
|
---|
3358 | {
|
---|
3359 | $debug_cmd
|
---|
3360 |
|
---|
3361 | # Get the compilation command and the source file.
|
---|
3362 | base_compile=
|
---|
3363 | srcfile=$nonopt # always keep a non-empty value in "srcfile"
|
---|
3364 | suppress_opt=yes
|
---|
3365 | suppress_output=
|
---|
3366 | arg_mode=normal
|
---|
3367 | libobj=
|
---|
3368 | later=
|
---|
3369 | pie_flag=
|
---|
3370 |
|
---|
3371 | for arg
|
---|
3372 | do
|
---|
3373 | case $arg_mode in
|
---|
3374 | arg )
|
---|
3375 | # do not "continue". Instead, add this to base_compile
|
---|
3376 | lastarg=$arg
|
---|
3377 | arg_mode=normal
|
---|
3378 | ;;
|
---|
3379 |
|
---|
3380 | target )
|
---|
3381 | libobj=$arg
|
---|
3382 | arg_mode=normal
|
---|
3383 | continue
|
---|
3384 | ;;
|
---|
3385 |
|
---|
3386 | normal )
|
---|
3387 | # Accept any command-line options.
|
---|
3388 | case $arg in
|
---|
3389 | -o)
|
---|
3390 | test -n "$libobj" && \
|
---|
3391 | func_fatal_error "you cannot specify '-o' more than once"
|
---|
3392 | arg_mode=target
|
---|
3393 | continue
|
---|
3394 | ;;
|
---|
3395 |
|
---|
3396 | -pie | -fpie | -fPIE)
|
---|
3397 | func_append pie_flag " $arg"
|
---|
3398 | continue
|
---|
3399 | ;;
|
---|
3400 |
|
---|
3401 | -shared | -static | -prefer-pic | -prefer-non-pic)
|
---|
3402 | func_append later " $arg"
|
---|
3403 | continue
|
---|
3404 | ;;
|
---|
3405 |
|
---|
3406 | -no-suppress)
|
---|
3407 | suppress_opt=no
|
---|
3408 | continue
|
---|
3409 | ;;
|
---|
3410 |
|
---|
3411 | -Xcompiler)
|
---|
3412 | arg_mode=arg # the next one goes into the "base_compile" arg list
|
---|
3413 | continue # The current "srcfile" will either be retained or
|
---|
3414 | ;; # replaced later. I would guess that would be a bug.
|
---|
3415 |
|
---|
3416 | -Wc,*)
|
---|
3417 | func_stripname '-Wc,' '' "$arg"
|
---|
3418 | args=$func_stripname_result
|
---|
3419 | lastarg=
|
---|
3420 | save_ifs=$IFS; IFS=,
|
---|
3421 | for arg in $args; do
|
---|
3422 | IFS=$save_ifs
|
---|
3423 | func_append_quoted lastarg "$arg"
|
---|
3424 | done
|
---|
3425 | IFS=$save_ifs
|
---|
3426 | func_stripname ' ' '' "$lastarg"
|
---|
3427 | lastarg=$func_stripname_result
|
---|
3428 |
|
---|
3429 | # Add the arguments to base_compile.
|
---|
3430 | func_append base_compile " $lastarg"
|
---|
3431 | continue
|
---|
3432 | ;;
|
---|
3433 |
|
---|
3434 | *)
|
---|
3435 | # Accept the current argument as the source file.
|
---|
3436 | # The previous "srcfile" becomes the current argument.
|
---|
3437 | #
|
---|
3438 | lastarg=$srcfile
|
---|
3439 | srcfile=$arg
|
---|
3440 | ;;
|
---|
3441 | esac # case $arg
|
---|
3442 | ;;
|
---|
3443 | esac # case $arg_mode
|
---|
3444 |
|
---|
3445 | # Aesthetically quote the previous argument.
|
---|
3446 | func_append_quoted base_compile "$lastarg"
|
---|
3447 | done # for arg
|
---|
3448 |
|
---|
3449 | case $arg_mode in
|
---|
3450 | arg)
|
---|
3451 | func_fatal_error "you must specify an argument for -Xcompile"
|
---|
3452 | ;;
|
---|
3453 | target)
|
---|
3454 | func_fatal_error "you must specify a target with '-o'"
|
---|
3455 | ;;
|
---|
3456 | *)
|
---|
3457 | # Get the name of the library object.
|
---|
3458 | test -z "$libobj" && {
|
---|
3459 | func_basename "$srcfile"
|
---|
3460 | libobj=$func_basename_result
|
---|
3461 | }
|
---|
3462 | ;;
|
---|
3463 | esac
|
---|
3464 |
|
---|
3465 | # Recognize several different file suffixes.
|
---|
3466 | # If the user specifies -o file.o, it is replaced with file.lo
|
---|
3467 | case $libobj in
|
---|
3468 | *.[cCFSifmso] | \
|
---|
3469 | *.ada | *.adb | *.ads | *.asm | \
|
---|
3470 | *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
|
---|
3471 | *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)
|
---|
3472 | func_xform "$libobj"
|
---|
3473 | libobj=$func_xform_result
|
---|
3474 | ;;
|
---|
3475 | esac
|
---|
3476 |
|
---|
3477 | case $libobj in
|
---|
3478 | *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
|
---|
3479 | *)
|
---|
3480 | func_fatal_error "cannot determine name of library object from '$libobj'"
|
---|
3481 | ;;
|
---|
3482 | esac
|
---|
3483 |
|
---|
3484 | func_infer_tag $base_compile
|
---|
3485 |
|
---|
3486 | for arg in $later; do
|
---|
3487 | case $arg in
|
---|
3488 | -shared)
|
---|
3489 | test yes = "$build_libtool_libs" \
|
---|
3490 | || func_fatal_configuration "cannot build a shared library"
|
---|
3491 | build_old_libs=no
|
---|
3492 | continue
|
---|
3493 | ;;
|
---|
3494 |
|
---|
3495 | -static)
|
---|
3496 | build_libtool_libs=no
|
---|
3497 | build_old_libs=yes
|
---|
3498 | continue
|
---|
3499 | ;;
|
---|
3500 |
|
---|
3501 | -prefer-pic)
|
---|
3502 | pic_mode=yes
|
---|
3503 | continue
|
---|
3504 | ;;
|
---|
3505 |
|
---|
3506 | -prefer-non-pic)
|
---|
3507 | pic_mode=no
|
---|
3508 | continue
|
---|
3509 | ;;
|
---|
3510 | esac
|
---|
3511 | done
|
---|
3512 |
|
---|
3513 | func_quote_for_eval "$libobj"
|
---|
3514 | test "X$libobj" != "X$func_quote_for_eval_result" \
|
---|
3515 | && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
|
---|
3516 | && func_warning "libobj name '$libobj' may not contain shell special characters."
|
---|
3517 | func_dirname_and_basename "$obj" "/" ""
|
---|
3518 | objname=$func_basename_result
|
---|
3519 | xdir=$func_dirname_result
|
---|
3520 | lobj=$xdir$objdir/$objname
|
---|
3521 |
|
---|
3522 | test -z "$base_compile" && \
|
---|
3523 | func_fatal_help "you must specify a compilation command"
|
---|
3524 |
|
---|
3525 | # Delete any leftover library objects.
|
---|
3526 | if test yes = "$build_old_libs"; then
|
---|
3527 | removelist="$obj $lobj $libobj ${libobj}T"
|
---|
3528 | else
|
---|
3529 | removelist="$lobj $libobj ${libobj}T"
|
---|
3530 | fi
|
---|
3531 |
|
---|
3532 | # On Cygwin there's no "real" PIC flag so we must build both object types
|
---|
3533 | case $host_os in
|
---|
3534 | cygwin* | mingw* | pw32* | os2* | cegcc*)
|
---|
3535 | pic_mode=default
|
---|
3536 | ;;
|
---|
3537 | esac
|
---|
3538 | if test no = "$pic_mode" && test pass_all != "$deplibs_check_method"; then
|
---|
3539 | # non-PIC code in shared libraries is not supported
|
---|
3540 | pic_mode=default
|
---|
3541 | fi
|
---|
3542 |
|
---|
3543 | # Calculate the filename of the output object if compiler does
|
---|
3544 | # not support -o with -c
|
---|
3545 | if test no = "$compiler_c_o"; then
|
---|
3546 | output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.$objext
|
---|
3547 | lockfile=$output_obj.lock
|
---|
3548 | else
|
---|
3549 | output_obj=
|
---|
3550 | need_locks=no
|
---|
3551 | lockfile=
|
---|
3552 | fi
|
---|
3553 |
|
---|
3554 | # Lock this critical section if it is needed
|
---|
3555 | # We use this script file to make the link, it avoids creating a new file
|
---|
3556 | if test yes = "$need_locks"; then
|
---|
3557 | until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
|
---|
3558 | func_echo "Waiting for $lockfile to be removed"
|
---|
3559 | sleep 2
|
---|
3560 | done
|
---|
3561 | elif test warn = "$need_locks"; then
|
---|
3562 | if test -f "$lockfile"; then
|
---|
3563 | $ECHO "\
|
---|
3564 | *** ERROR, $lockfile exists and contains:
|
---|
3565 | `cat $lockfile 2>/dev/null`
|
---|
3566 |
|
---|
3567 | This indicates that another process is trying to use the same
|
---|
3568 | temporary object file, and libtool could not work around it because
|
---|
3569 | your compiler does not support '-c' and '-o' together. If you
|
---|
3570 | repeat this compilation, it may succeed, by chance, but you had better
|
---|
3571 | avoid parallel builds (make -j) in this platform, or get a better
|
---|
3572 | compiler."
|
---|
3573 |
|
---|
3574 | $opt_dry_run || $RM $removelist
|
---|
3575 | exit $EXIT_FAILURE
|
---|
3576 | fi
|
---|
3577 | func_append removelist " $output_obj"
|
---|
3578 | $ECHO "$srcfile" > "$lockfile"
|
---|
3579 | fi
|
---|
3580 |
|
---|
3581 | $opt_dry_run || $RM $removelist
|
---|
3582 | func_append removelist " $lockfile"
|
---|
3583 | trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
|
---|
3584 |
|
---|
3585 | func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
|
---|
3586 | srcfile=$func_to_tool_file_result
|
---|
3587 | func_quote_for_eval "$srcfile"
|
---|
3588 | qsrcfile=$func_quote_for_eval_result
|
---|
3589 |
|
---|
3590 | # Only build a PIC object if we are building libtool libraries.
|
---|
3591 | if test yes = "$build_libtool_libs"; then
|
---|
3592 | # Without this assignment, base_compile gets emptied.
|
---|
3593 | fbsd_hideous_sh_bug=$base_compile
|
---|
3594 |
|
---|
3595 | if test no != "$pic_mode"; then
|
---|
3596 | command="$base_compile $qsrcfile $pic_flag"
|
---|
3597 | else
|
---|
3598 | # Don't build PIC code
|
---|
3599 | command="$base_compile $qsrcfile"
|
---|
3600 | fi
|
---|
3601 |
|
---|
3602 | func_mkdir_p "$xdir$objdir"
|
---|
3603 |
|
---|
3604 | if test -z "$output_obj"; then
|
---|
3605 | # Place PIC objects in $objdir
|
---|
3606 | func_append command " -o $lobj"
|
---|
3607 | fi
|
---|
3608 |
|
---|
3609 | func_show_eval_locale "$command" \
|
---|
3610 | 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
|
---|
3611 |
|
---|
3612 | if test warn = "$need_locks" &&
|
---|
3613 | test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
|
---|
3614 | $ECHO "\
|
---|
3615 | *** ERROR, $lockfile contains:
|
---|
3616 | `cat $lockfile 2>/dev/null`
|
---|
3617 |
|
---|
3618 | but it should contain:
|
---|
3619 | $srcfile
|
---|
3620 |
|
---|
3621 | This indicates that another process is trying to use the same
|
---|
3622 | temporary object file, and libtool could not work around it because
|
---|
3623 | your compiler does not support '-c' and '-o' together. If you
|
---|
3624 | repeat this compilation, it may succeed, by chance, but you had better
|
---|
3625 | avoid parallel builds (make -j) in this platform, or get a better
|
---|
3626 | compiler."
|
---|
3627 |
|
---|
3628 | $opt_dry_run || $RM $removelist
|
---|
3629 | exit $EXIT_FAILURE
|
---|
3630 | fi
|
---|
3631 |
|
---|
3632 | # Just move the object if needed, then go on to compile the next one
|
---|
3633 | if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
|
---|
3634 | func_show_eval '$MV "$output_obj" "$lobj"' \
|
---|
3635 | 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
|
---|
3636 | fi
|
---|
3637 |
|
---|
3638 | # Allow error messages only from the first compilation.
|
---|
3639 | if test yes = "$suppress_opt"; then
|
---|
3640 | suppress_output=' >/dev/null 2>&1'
|
---|
3641 | fi
|
---|
3642 | fi
|
---|
3643 |
|
---|
3644 | # Only build a position-dependent object if we build old libraries.
|
---|
3645 | if test yes = "$build_old_libs"; then
|
---|
3646 | if test yes != "$pic_mode"; then
|
---|
3647 | # Don't build PIC code
|
---|
3648 | command="$base_compile $qsrcfile$pie_flag"
|
---|
3649 | else
|
---|
3650 | command="$base_compile $qsrcfile $pic_flag"
|
---|
3651 | fi
|
---|
3652 | if test yes = "$compiler_c_o"; then
|
---|
3653 | func_append command " -o $obj"
|
---|
3654 | fi
|
---|
3655 |
|
---|
3656 | # Suppress compiler output if we already did a PIC compilation.
|
---|
3657 | func_append command "$suppress_output"
|
---|
3658 | func_show_eval_locale "$command" \
|
---|
3659 | '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
|
---|
3660 |
|
---|
3661 | if test warn = "$need_locks" &&
|
---|
3662 | test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
|
---|
3663 | $ECHO "\
|
---|
3664 | *** ERROR, $lockfile contains:
|
---|
3665 | `cat $lockfile 2>/dev/null`
|
---|
3666 |
|
---|
3667 | but it should contain:
|
---|
3668 | $srcfile
|
---|
3669 |
|
---|
3670 | This indicates that another process is trying to use the same
|
---|
3671 | temporary object file, and libtool could not work around it because
|
---|
3672 | your compiler does not support '-c' and '-o' together. If you
|
---|
3673 | repeat this compilation, it may succeed, by chance, but you had better
|
---|
3674 | avoid parallel builds (make -j) in this platform, or get a better
|
---|
3675 | compiler."
|
---|
3676 |
|
---|
3677 | $opt_dry_run || $RM $removelist
|
---|
3678 | exit $EXIT_FAILURE
|
---|
3679 | fi
|
---|
3680 |
|
---|
3681 | # Just move the object if needed
|
---|
3682 | if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
|
---|
3683 | func_show_eval '$MV "$output_obj" "$obj"' \
|
---|
3684 | 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
|
---|
3685 | fi
|
---|
3686 | fi
|
---|
3687 |
|
---|
3688 | $opt_dry_run || {
|
---|
3689 | func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
|
---|
3690 |
|
---|
3691 | # Unlock the critical section if it was locked
|
---|
3692 | if test no != "$need_locks"; then
|
---|
3693 | removelist=$lockfile
|
---|
3694 | $RM "$lockfile"
|
---|
3695 | fi
|
---|
3696 | }
|
---|
3697 |
|
---|
3698 | exit $EXIT_SUCCESS
|
---|
3699 | }
|
---|
3700 |
|
---|
3701 | $opt_help || {
|
---|
3702 | test compile = "$opt_mode" && func_mode_compile ${1+"$@"}
|
---|
3703 | }
|
---|
3704 |
|
---|
3705 | func_mode_help ()
|
---|
3706 | {
|
---|
3707 | # We need to display help for each of the modes.
|
---|
3708 | case $opt_mode in
|
---|
3709 | "")
|
---|
3710 | # Generic help is extracted from the usage comments
|
---|
3711 | # at the start of this file.
|
---|
3712 | func_help
|
---|
3713 | ;;
|
---|
3714 |
|
---|
3715 | clean)
|
---|
3716 | $ECHO \
|
---|
3717 | "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
|
---|
3718 |
|
---|
3719 | Remove files from the build directory.
|
---|
3720 |
|
---|
3721 | RM is the name of the program to use to delete files associated with each FILE
|
---|
3722 | (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed
|
---|
3723 | to RM.
|
---|
3724 |
|
---|
3725 | If FILE is a libtool library, object or program, all the files associated
|
---|
3726 | with it are deleted. Otherwise, only FILE itself is deleted using RM."
|
---|
3727 | ;;
|
---|
3728 |
|
---|
3729 | compile)
|
---|
3730 | $ECHO \
|
---|
3731 | "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
|
---|
3732 |
|
---|
3733 | Compile a source file into a libtool library object.
|
---|
3734 |
|
---|
3735 | This mode accepts the following additional options:
|
---|
3736 |
|
---|
3737 | -o OUTPUT-FILE set the output file name to OUTPUT-FILE
|
---|
3738 | -no-suppress do not suppress compiler output for multiple passes
|
---|
3739 | -prefer-pic try to build PIC objects only
|
---|
3740 | -prefer-non-pic try to build non-PIC objects only
|
---|
3741 | -shared do not build a '.o' file suitable for static linking
|
---|
3742 | -static only build a '.o' file suitable for static linking
|
---|
3743 | -Wc,FLAG pass FLAG directly to the compiler
|
---|
3744 |
|
---|
3745 | COMPILE-COMMAND is a command to be used in creating a 'standard' object file
|
---|
3746 | from the given SOURCEFILE.
|
---|
3747 |
|
---|
3748 | The output file name is determined by removing the directory component from
|
---|
3749 | SOURCEFILE, then substituting the C source code suffix '.c' with the
|
---|
3750 | library object suffix, '.lo'."
|
---|
3751 | ;;
|
---|
3752 |
|
---|
3753 | execute)
|
---|
3754 | $ECHO \
|
---|
3755 | "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
|
---|
3756 |
|
---|
3757 | Automatically set library path, then run a program.
|
---|
3758 |
|
---|
3759 | This mode accepts the following additional options:
|
---|
3760 |
|
---|
3761 | -dlopen FILE add the directory containing FILE to the library path
|
---|
3762 |
|
---|
3763 | This mode sets the library path environment variable according to '-dlopen'
|
---|
3764 | flags.
|
---|
3765 |
|
---|
3766 | If any of the ARGS are libtool executable wrappers, then they are translated
|
---|
3767 | into their corresponding uninstalled binary, and any of their required library
|
---|
3768 | directories are added to the library path.
|
---|
3769 |
|
---|
3770 | Then, COMMAND is executed, with ARGS as arguments."
|
---|
3771 | ;;
|
---|
3772 |
|
---|
3773 | finish)
|
---|
3774 | $ECHO \
|
---|
3775 | "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
|
---|
3776 |
|
---|
3777 | Complete the installation of libtool libraries.
|
---|
3778 |
|
---|
3779 | Each LIBDIR is a directory that contains libtool libraries.
|
---|
3780 |
|
---|
3781 | The commands that this mode executes may require superuser privileges. Use
|
---|
3782 | the '--dry-run' option if you just want to see what would be executed."
|
---|
3783 | ;;
|
---|
3784 |
|
---|
3785 | install)
|
---|
3786 | $ECHO \
|
---|
3787 | "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
|
---|
3788 |
|
---|
3789 | Install executables or libraries.
|
---|
3790 |
|
---|
3791 | INSTALL-COMMAND is the installation command. The first component should be
|
---|
3792 | either the 'install' or 'cp' program.
|
---|
3793 |
|
---|
3794 | The following components of INSTALL-COMMAND are treated specially:
|
---|
3795 |
|
---|
3796 | -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation
|
---|
3797 |
|
---|
3798 | The rest of the components are interpreted as arguments to that command (only
|
---|
3799 | BSD-compatible install options are recognized)."
|
---|
3800 | ;;
|
---|
3801 |
|
---|
3802 | link)
|
---|
3803 | $ECHO \
|
---|
3804 | "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
|
---|
3805 |
|
---|
3806 | Link object files or libraries together to form another library, or to
|
---|
3807 | create an executable program.
|
---|
3808 |
|
---|
3809 | LINK-COMMAND is a command using the C compiler that you would use to create
|
---|
3810 | a program from several object files.
|
---|
3811 |
|
---|
3812 | The following components of LINK-COMMAND are treated specially:
|
---|
3813 |
|
---|
3814 | -all-static do not do any dynamic linking at all
|
---|
3815 | -avoid-version do not add a version suffix if possible
|
---|
3816 | -bindir BINDIR specify path to binaries directory (for systems where
|
---|
3817 | libraries must be found in the PATH setting at runtime)
|
---|
3818 | -dlopen FILE '-dlpreopen' FILE if it cannot be dlopened at runtime
|
---|
3819 | -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
|
---|
3820 | -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
|
---|
3821 | -export-symbols SYMFILE
|
---|
3822 | try to export only the symbols listed in SYMFILE
|
---|
3823 | -export-symbols-regex REGEX
|
---|
3824 | try to export only the symbols matching REGEX
|
---|
3825 | -LLIBDIR search LIBDIR for required installed libraries
|
---|
3826 | -lNAME OUTPUT-FILE requires the installed library libNAME
|
---|
3827 | -module build a library that can dlopened
|
---|
3828 | -no-fast-install disable the fast-install mode
|
---|
3829 | -no-install link a not-installable executable
|
---|
3830 | -no-undefined declare that a library does not refer to external symbols
|
---|
3831 | -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
|
---|
3832 | -objectlist FILE use a list of object files found in FILE to specify objects
|
---|
3833 | -os2dllname NAME force a short DLL name on OS/2 (no effect on other OSes)
|
---|
3834 | -precious-files-regex REGEX
|
---|
3835 | don't remove output files matching REGEX
|
---|
3836 | -release RELEASE specify package release information
|
---|
3837 | -rpath LIBDIR the created library will eventually be installed in LIBDIR
|
---|
3838 | -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
|
---|
3839 | -shared only do dynamic linking of libtool libraries
|
---|
3840 | -shrext SUFFIX override the standard shared library file extension
|
---|
3841 | -static do not do any dynamic linking of uninstalled libtool libraries
|
---|
3842 | -static-libtool-libs
|
---|
3843 | do not do any dynamic linking of libtool libraries
|
---|
3844 | -version-info CURRENT[:REVISION[:AGE]]
|
---|
3845 | specify library version info [each variable defaults to 0]
|
---|
3846 | -weak LIBNAME declare that the target provides the LIBNAME interface
|
---|
3847 | -Wc,FLAG
|
---|
3848 | -Xcompiler FLAG pass linker-specific FLAG directly to the compiler
|
---|
3849 | -Wl,FLAG
|
---|
3850 | -Xlinker FLAG pass linker-specific FLAG directly to the linker
|
---|
3851 | -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC)
|
---|
3852 |
|
---|
3853 | All other options (arguments beginning with '-') are ignored.
|
---|
3854 |
|
---|
3855 | Every other argument is treated as a filename. Files ending in '.la' are
|
---|
3856 | treated as uninstalled libtool libraries, other files are standard or library
|
---|
3857 | object files.
|
---|
3858 |
|
---|
3859 | If the OUTPUT-FILE ends in '.la', then a libtool library is created,
|
---|
3860 | only library objects ('.lo' files) may be specified, and '-rpath' is
|
---|
3861 | required, except when creating a convenience library.
|
---|
3862 |
|
---|
3863 | If OUTPUT-FILE ends in '.a' or '.lib', then a standard library is created
|
---|
3864 | using 'ar' and 'ranlib', or on Windows using 'lib'.
|
---|
3865 |
|
---|
3866 | If OUTPUT-FILE ends in '.lo' or '.$objext', then a reloadable object file
|
---|
3867 | is created, otherwise an executable program is created."
|
---|
3868 | ;;
|
---|
3869 |
|
---|
3870 | uninstall)
|
---|
3871 | $ECHO \
|
---|
3872 | "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
|
---|
3873 |
|
---|
3874 | Remove libraries from an installation directory.
|
---|
3875 |
|
---|
3876 | RM is the name of the program to use to delete files associated with each FILE
|
---|
3877 | (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed
|
---|
3878 | to RM.
|
---|
3879 |
|
---|
3880 | If FILE is a libtool library, all the files associated with it are deleted.
|
---|
3881 | Otherwise, only FILE itself is deleted using RM."
|
---|
3882 | ;;
|
---|
3883 |
|
---|
3884 | *)
|
---|
3885 | func_fatal_help "invalid operation mode '$opt_mode'"
|
---|
3886 | ;;
|
---|
3887 | esac
|
---|
3888 |
|
---|
3889 | echo
|
---|
3890 | $ECHO "Try '$progname --help' for more information about other modes."
|
---|
3891 | }
|
---|
3892 |
|
---|
3893 | # Now that we've collected a possible --mode arg, show help if necessary
|
---|
3894 | if $opt_help; then
|
---|
3895 | if test : = "$opt_help"; then
|
---|
3896 | func_mode_help
|
---|
3897 | else
|
---|
3898 | {
|
---|
3899 | func_help noexit
|
---|
3900 | for opt_mode in compile link execute install finish uninstall clean; do
|
---|
3901 | func_mode_help
|
---|
3902 | done
|
---|
3903 | } | $SED -n '1p; 2,$s/^Usage:/ or: /p'
|
---|
3904 | {
|
---|
3905 | func_help noexit
|
---|
3906 | for opt_mode in compile link execute install finish uninstall clean; do
|
---|
3907 | echo
|
---|
3908 | func_mode_help
|
---|
3909 | done
|
---|
3910 | } |
|
---|
3911 | $SED '1d
|
---|
3912 | /^When reporting/,/^Report/{
|
---|
3913 | H
|
---|
3914 | d
|
---|
3915 | }
|
---|
3916 | $x
|
---|
3917 | /information about other modes/d
|
---|
3918 | /more detailed .*MODE/d
|
---|
3919 | s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
|
---|
3920 | fi
|
---|
3921 | exit $?
|
---|
3922 | fi
|
---|
3923 |
|
---|
3924 |
|
---|
3925 | # func_mode_execute arg...
|
---|
3926 | func_mode_execute ()
|
---|
3927 | {
|
---|
3928 | $debug_cmd
|
---|
3929 |
|
---|
3930 | # The first argument is the command name.
|
---|
3931 | cmd=$nonopt
|
---|
3932 | test -z "$cmd" && \
|
---|
3933 | func_fatal_help "you must specify a COMMAND"
|
---|
3934 |
|
---|
3935 | # Handle -dlopen flags immediately.
|
---|
3936 | for file in $opt_dlopen; do
|
---|
3937 | test -f "$file" \
|
---|
3938 | || func_fatal_help "'$file' is not a file"
|
---|
3939 |
|
---|
3940 | dir=
|
---|
3941 | case $file in
|
---|
3942 | *.la)
|
---|
3943 | func_resolve_sysroot "$file"
|
---|
3944 | file=$func_resolve_sysroot_result
|
---|
3945 |
|
---|
3946 | # Check to see that this really is a libtool archive.
|
---|
3947 | func_lalib_unsafe_p "$file" \
|
---|
3948 | || func_fatal_help "'$lib' is not a valid libtool archive"
|
---|
3949 |
|
---|
3950 | # Read the libtool library.
|
---|
3951 | dlname=
|
---|
3952 | library_names=
|
---|
3953 | func_source "$file"
|
---|
3954 |
|
---|
3955 | # Skip this library if it cannot be dlopened.
|
---|
3956 | if test -z "$dlname"; then
|
---|
3957 | # Warn if it was a shared library.
|
---|
3958 | test -n "$library_names" && \
|
---|
3959 | func_warning "'$file' was not linked with '-export-dynamic'"
|
---|
3960 | continue
|
---|
3961 | fi
|
---|
3962 |
|
---|
3963 | func_dirname "$file" "" "."
|
---|
3964 | dir=$func_dirname_result
|
---|
3965 |
|
---|
3966 | if test -f "$dir/$objdir/$dlname"; then
|
---|
3967 | func_append dir "/$objdir"
|
---|
3968 | else
|
---|
3969 | if test ! -f "$dir/$dlname"; then
|
---|
3970 | func_fatal_error "cannot find '$dlname' in '$dir' or '$dir/$objdir'"
|
---|
3971 | fi
|
---|
3972 | fi
|
---|
3973 | ;;
|
---|
3974 |
|
---|
3975 | *.lo)
|
---|
3976 | # Just add the directory containing the .lo file.
|
---|
3977 | func_dirname "$file" "" "."
|
---|
3978 | dir=$func_dirname_result
|
---|
3979 | ;;
|
---|
3980 |
|
---|
3981 | *)
|
---|
3982 | func_warning "'-dlopen' is ignored for non-libtool libraries and objects"
|
---|
3983 | continue
|
---|
3984 | ;;
|
---|
3985 | esac
|
---|
3986 |
|
---|
3987 | # Get the absolute pathname.
|
---|
3988 | absdir=`cd "$dir" && pwd`
|
---|
3989 | test -n "$absdir" && dir=$absdir
|
---|
3990 |
|
---|
3991 | # Now add the directory to shlibpath_var.
|
---|
3992 | if eval "test -z \"\$$shlibpath_var\""; then
|
---|
3993 | eval "$shlibpath_var=\"\$dir\""
|
---|
3994 | else
|
---|
3995 | eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
|
---|
3996 | fi
|
---|
3997 | done
|
---|
3998 |
|
---|
3999 | # This variable tells wrapper scripts just to set shlibpath_var
|
---|
4000 | # rather than running their programs.
|
---|
4001 | libtool_execute_magic=$magic
|
---|
4002 |
|
---|
4003 | # Check if any of the arguments is a wrapper script.
|
---|
4004 | args=
|
---|
4005 | for file
|
---|
4006 | do
|
---|
4007 | case $file in
|
---|
4008 | -* | *.la | *.lo ) ;;
|
---|
4009 | *)
|
---|
4010 | # Do a test to see if this is really a libtool program.
|
---|
4011 | if func_ltwrapper_script_p "$file"; then
|
---|
4012 | func_source "$file"
|
---|
4013 | # Transform arg to wrapped name.
|
---|
4014 | file=$progdir/$program
|
---|
4015 | elif func_ltwrapper_executable_p "$file"; then
|
---|
4016 | func_ltwrapper_scriptname "$file"
|
---|
4017 | func_source "$func_ltwrapper_scriptname_result"
|
---|
4018 | # Transform arg to wrapped name.
|
---|
4019 | file=$progdir/$program
|
---|
4020 | fi
|
---|
4021 | ;;
|
---|
4022 | esac
|
---|
4023 | # Quote arguments (to preserve shell metacharacters).
|
---|
4024 | func_append_quoted args "$file"
|
---|
4025 | done
|
---|
4026 |
|
---|
4027 | if $opt_dry_run; then
|
---|
4028 | # Display what would be done.
|
---|
4029 | if test -n "$shlibpath_var"; then
|
---|
4030 | eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
|
---|
4031 | echo "export $shlibpath_var"
|
---|
4032 | fi
|
---|
4033 | $ECHO "$cmd$args"
|
---|
4034 | exit $EXIT_SUCCESS
|
---|
4035 | else
|
---|
4036 | if test -n "$shlibpath_var"; then
|
---|
4037 | # Export the shlibpath_var.
|
---|
4038 | eval "export $shlibpath_var"
|
---|
4039 | fi
|
---|
4040 |
|
---|
4041 | # Restore saved environment variables
|
---|
4042 | for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
|
---|
4043 | do
|
---|
4044 | eval "if test \"\${save_$lt_var+set}\" = set; then
|
---|
4045 | $lt_var=\$save_$lt_var; export $lt_var
|
---|
4046 | else
|
---|
4047 | $lt_unset $lt_var
|
---|
4048 | fi"
|
---|
4049 | done
|
---|
4050 |
|
---|
4051 | # Now prepare to actually exec the command.
|
---|
4052 | exec_cmd=\$cmd$args
|
---|
4053 | fi
|
---|
4054 | }
|
---|
4055 |
|
---|
4056 | test execute = "$opt_mode" && func_mode_execute ${1+"$@"}
|
---|
4057 |
|
---|
4058 |
|
---|
4059 | # func_mode_finish arg...
|
---|
4060 | func_mode_finish ()
|
---|
4061 | {
|
---|
4062 | $debug_cmd
|
---|
4063 |
|
---|
4064 | libs=
|
---|
4065 | libdirs=
|
---|
4066 | admincmds=
|
---|
4067 |
|
---|
4068 | for opt in "$nonopt" ${1+"$@"}
|
---|
4069 | do
|
---|
4070 | if test -d "$opt"; then
|
---|
4071 | func_append libdirs " $opt"
|
---|
4072 |
|
---|
4073 | elif test -f "$opt"; then
|
---|
4074 | if func_lalib_unsafe_p "$opt"; then
|
---|
4075 | func_append libs " $opt"
|
---|
4076 | else
|
---|
4077 | func_warning "'$opt' is not a valid libtool archive"
|
---|
4078 | fi
|
---|
4079 |
|
---|
4080 | else
|
---|
4081 | func_fatal_error "invalid argument '$opt'"
|
---|
4082 | fi
|
---|
4083 | done
|
---|
4084 |
|
---|
4085 | if test -n "$libs"; then
|
---|
4086 | if test -n "$lt_sysroot"; then
|
---|
4087 | sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
|
---|
4088 | sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
|
---|
4089 | else
|
---|
4090 | sysroot_cmd=
|
---|
4091 | fi
|
---|
4092 |
|
---|
4093 | # Remove sysroot references
|
---|
4094 | if $opt_dry_run; then
|
---|
4095 | for lib in $libs; do
|
---|
4096 | echo "removing references to $lt_sysroot and '=' prefixes from $lib"
|
---|
4097 | done
|
---|
4098 | else
|
---|
4099 | tmpdir=`func_mktempdir`
|
---|
4100 | for lib in $libs; do
|
---|
4101 | $SED -e "$sysroot_cmd s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
|
---|
4102 | > $tmpdir/tmp-la
|
---|
4103 | mv -f $tmpdir/tmp-la $lib
|
---|
4104 | done
|
---|
4105 | ${RM}r "$tmpdir"
|
---|
4106 | fi
|
---|
4107 | fi
|
---|
4108 |
|
---|
4109 | if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
|
---|
4110 | for libdir in $libdirs; do
|
---|
4111 | if test -n "$finish_cmds"; then
|
---|
4112 | # Do each command in the finish commands.
|
---|
4113 | func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
|
---|
4114 | '"$cmd"'"'
|
---|
4115 | fi
|
---|
4116 | if test -n "$finish_eval"; then
|
---|
4117 | # Do the single finish_eval.
|
---|
4118 | eval cmds=\"$finish_eval\"
|
---|
4119 | $opt_dry_run || eval "$cmds" || func_append admincmds "
|
---|
4120 | $cmds"
|
---|
4121 | fi
|
---|
4122 | done
|
---|
4123 | fi
|
---|
4124 |
|
---|
4125 | # Exit here if they wanted silent mode.
|
---|
4126 | $opt_quiet && exit $EXIT_SUCCESS
|
---|
4127 |
|
---|
4128 | if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
|
---|
4129 | echo "----------------------------------------------------------------------"
|
---|
4130 | echo "Libraries have been installed in:"
|
---|
4131 | for libdir in $libdirs; do
|
---|
4132 | $ECHO " $libdir"
|
---|
4133 | done
|
---|
4134 | echo
|
---|
4135 | echo "If you ever happen to want to link against installed libraries"
|
---|
4136 | echo "in a given directory, LIBDIR, you must either use libtool, and"
|
---|
4137 | echo "specify the full pathname of the library, or use the '-LLIBDIR'"
|
---|
4138 | echo "flag during linking and do at least one of the following:"
|
---|
4139 | if test -n "$shlibpath_var"; then
|
---|
4140 | echo " - add LIBDIR to the '$shlibpath_var' environment variable"
|
---|
4141 | echo " during execution"
|
---|
4142 | fi
|
---|
4143 | if test -n "$runpath_var"; then
|
---|
4144 | echo " - add LIBDIR to the '$runpath_var' environment variable"
|
---|
4145 | echo " during linking"
|
---|
4146 | fi
|
---|
4147 | if test -n "$hardcode_libdir_flag_spec"; then
|
---|
4148 | libdir=LIBDIR
|
---|
4149 | eval flag=\"$hardcode_libdir_flag_spec\"
|
---|
4150 |
|
---|
4151 | $ECHO " - use the '$flag' linker flag"
|
---|
4152 | fi
|
---|
4153 | if test -n "$admincmds"; then
|
---|
4154 | $ECHO " - have your system administrator run these commands:$admincmds"
|
---|
4155 | fi
|
---|
4156 | if test -f /etc/ld.so.conf; then
|
---|
4157 | echo " - have your system administrator add LIBDIR to '/etc/ld.so.conf'"
|
---|
4158 | fi
|
---|
4159 | echo
|
---|
4160 |
|
---|
4161 | echo "See any operating system documentation about shared libraries for"
|
---|
4162 | case $host in
|
---|
4163 | solaris2.[6789]|solaris2.1[0-9])
|
---|
4164 | echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
|
---|
4165 | echo "pages."
|
---|
4166 | ;;
|
---|
4167 | *)
|
---|
4168 | echo "more information, such as the ld(1) and ld.so(8) manual pages."
|
---|
4169 | ;;
|
---|
4170 | esac
|
---|
4171 | echo "----------------------------------------------------------------------"
|
---|
4172 | fi
|
---|
4173 | exit $EXIT_SUCCESS
|
---|
4174 | }
|
---|
4175 |
|
---|
4176 | test finish = "$opt_mode" && func_mode_finish ${1+"$@"}
|
---|
4177 |
|
---|
4178 |
|
---|
4179 | # func_mode_install arg...
|
---|
4180 | func_mode_install ()
|
---|
4181 | {
|
---|
4182 | $debug_cmd
|
---|
4183 |
|
---|
4184 | # There may be an optional sh(1) argument at the beginning of
|
---|
4185 | # install_prog (especially on Windows NT).
|
---|
4186 | if test "$SHELL" = "$nonopt" || test /bin/sh = "$nonopt" ||
|
---|
4187 | # Allow the use of GNU shtool's install command.
|
---|
4188 | case $nonopt in *shtool*) :;; *) false;; esac
|
---|
4189 | then
|
---|
4190 | # Aesthetically quote it.
|
---|
4191 | func_quote_for_eval "$nonopt"
|
---|
4192 | install_prog="$func_quote_for_eval_result "
|
---|
4193 | arg=$1
|
---|
4194 | shift
|
---|
4195 | else
|
---|
4196 | install_prog=
|
---|
4197 | arg=$nonopt
|
---|
4198 | fi
|
---|
4199 |
|
---|
4200 | # The real first argument should be the name of the installation program.
|
---|
4201 | # Aesthetically quote it.
|
---|
4202 | func_quote_for_eval "$arg"
|
---|
4203 | func_append install_prog "$func_quote_for_eval_result"
|
---|
4204 | install_shared_prog=$install_prog
|
---|
4205 | case " $install_prog " in
|
---|
4206 | *[\\\ /]cp\ *) install_cp=: ;;
|
---|
4207 | *) install_cp=false ;;
|
---|
4208 | esac
|
---|
4209 |
|
---|
4210 | # We need to accept at least all the BSD install flags.
|
---|
4211 | dest=
|
---|
4212 | files=
|
---|
4213 | opts=
|
---|
4214 | prev=
|
---|
4215 | install_type=
|
---|
4216 | isdir=false
|
---|
4217 | stripme=
|
---|
4218 | no_mode=:
|
---|
4219 | for arg
|
---|
4220 | do
|
---|
4221 | arg2=
|
---|
4222 | if test -n "$dest"; then
|
---|
4223 | func_append files " $dest"
|
---|
4224 | dest=$arg
|
---|
4225 | continue
|
---|
4226 | fi
|
---|
4227 |
|
---|
4228 | case $arg in
|
---|
4229 | -d) isdir=: ;;
|
---|
4230 | -f)
|
---|
4231 | if $install_cp; then :; else
|
---|
4232 | prev=$arg
|
---|
4233 | fi
|
---|
4234 | ;;
|
---|
4235 | -g | -m | -o)
|
---|
4236 | prev=$arg
|
---|
4237 | ;;
|
---|
4238 | -s)
|
---|
4239 | stripme=" -s"
|
---|
4240 | continue
|
---|
4241 | ;;
|
---|
4242 | -*)
|
---|
4243 | ;;
|
---|
4244 | *)
|
---|
4245 | # If the previous option needed an argument, then skip it.
|
---|
4246 | if test -n "$prev"; then
|
---|
4247 | if test X-m = "X$prev" && test -n "$install_override_mode"; then
|
---|
4248 | arg2=$install_override_mode
|
---|
4249 | no_mode=false
|
---|
4250 | fi
|
---|
4251 | prev=
|
---|
4252 | else
|
---|
4253 | dest=$arg
|
---|
4254 | continue
|
---|
4255 | fi
|
---|
4256 | ;;
|
---|
4257 | esac
|
---|
4258 |
|
---|
4259 | # Aesthetically quote the argument.
|
---|
4260 | func_quote_for_eval "$arg"
|
---|
4261 | func_append install_prog " $func_quote_for_eval_result"
|
---|
4262 | if test -n "$arg2"; then
|
---|
4263 | func_quote_for_eval "$arg2"
|
---|
4264 | fi
|
---|
4265 | func_append install_shared_prog " $func_quote_for_eval_result"
|
---|
4266 | done
|
---|
4267 |
|
---|
4268 | test -z "$install_prog" && \
|
---|
4269 | func_fatal_help "you must specify an install program"
|
---|
4270 |
|
---|
4271 | test -n "$prev" && \
|
---|
4272 | func_fatal_help "the '$prev' option requires an argument"
|
---|
4273 |
|
---|
4274 | if test -n "$install_override_mode" && $no_mode; then
|
---|
4275 | if $install_cp; then :; else
|
---|
4276 | func_quote_for_eval "$install_override_mode"
|
---|
4277 | func_append install_shared_prog " -m $func_quote_for_eval_result"
|
---|
4278 | fi
|
---|
4279 | fi
|
---|
4280 |
|
---|
4281 | if test -z "$files"; then
|
---|
4282 | if test -z "$dest"; then
|
---|
4283 | func_fatal_help "no file or destination specified"
|
---|
4284 | else
|
---|
4285 | func_fatal_help "you must specify a destination"
|
---|
4286 | fi
|
---|
4287 | fi
|
---|
4288 |
|
---|
4289 | # Strip any trailing slash from the destination.
|
---|
4290 | func_stripname '' '/' "$dest"
|
---|
4291 | dest=$func_stripname_result
|
---|
4292 |
|
---|
4293 | # Check to see that the destination is a directory.
|
---|
4294 | test -d "$dest" && isdir=:
|
---|
4295 | if $isdir; then
|
---|
4296 | destdir=$dest
|
---|
4297 | destname=
|
---|
4298 | else
|
---|
4299 | func_dirname_and_basename "$dest" "" "."
|
---|
4300 | destdir=$func_dirname_result
|
---|
4301 | destname=$func_basename_result
|
---|
4302 |
|
---|
4303 | # Not a directory, so check to see that there is only one file specified.
|
---|
4304 | set dummy $files; shift
|
---|
4305 | test "$#" -gt 1 && \
|
---|
4306 | func_fatal_help "'$dest' is not a directory"
|
---|
4307 | fi
|
---|
4308 | case $destdir in
|
---|
4309 | [\\/]* | [A-Za-z]:[\\/]*) ;;
|
---|
4310 | *)
|
---|
4311 | for file in $files; do
|
---|
4312 | case $file in
|
---|
4313 | *.lo) ;;
|
---|
4314 | *)
|
---|
4315 | func_fatal_help "'$destdir' must be an absolute directory name"
|
---|
4316 | ;;
|
---|
4317 | esac
|
---|
4318 | done
|
---|
4319 | ;;
|
---|
4320 | esac
|
---|
4321 |
|
---|
4322 | # This variable tells wrapper scripts just to set variables rather
|
---|
4323 | # than running their programs.
|
---|
4324 | libtool_install_magic=$magic
|
---|
4325 |
|
---|
4326 | staticlibs=
|
---|
4327 | future_libdirs=
|
---|
4328 | current_libdirs=
|
---|
4329 | for file in $files; do
|
---|
4330 |
|
---|
4331 | # Do each installation.
|
---|
4332 | case $file in
|
---|
4333 | *.$libext)
|
---|
4334 | # Do the static libraries later.
|
---|
4335 | func_append staticlibs " $file"
|
---|
4336 | ;;
|
---|
4337 |
|
---|
4338 | *.la)
|
---|
4339 | func_resolve_sysroot "$file"
|
---|
4340 | file=$func_resolve_sysroot_result
|
---|
4341 |
|
---|
4342 | # Check to see that this really is a libtool archive.
|
---|
4343 | func_lalib_unsafe_p "$file" \
|
---|
4344 | || func_fatal_help "'$file' is not a valid libtool archive"
|
---|
4345 |
|
---|
4346 | library_names=
|
---|
4347 | old_library=
|
---|
4348 | relink_command=
|
---|
4349 | func_source "$file"
|
---|
4350 |
|
---|
4351 | # Add the libdir to current_libdirs if it is the destination.
|
---|
4352 | if test "X$destdir" = "X$libdir"; then
|
---|
4353 | case "$current_libdirs " in
|
---|
4354 | *" $libdir "*) ;;
|
---|
4355 | *) func_append current_libdirs " $libdir" ;;
|
---|
4356 | esac
|
---|
4357 | else
|
---|
4358 | # Note the libdir as a future libdir.
|
---|
4359 | case "$future_libdirs " in
|
---|
4360 | *" $libdir "*) ;;
|
---|
4361 | *) func_append future_libdirs " $libdir" ;;
|
---|
4362 | esac
|
---|
4363 | fi
|
---|
4364 |
|
---|
4365 | func_dirname "$file" "/" ""
|
---|
4366 | dir=$func_dirname_result
|
---|
4367 | func_append dir "$objdir"
|
---|
4368 |
|
---|
4369 | if test -n "$relink_command"; then
|
---|
4370 | # Determine the prefix the user has applied to our future dir.
|
---|
4371 | inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
|
---|
4372 |
|
---|
4373 | # Don't allow the user to place us outside of our expected
|
---|
4374 | # location b/c this prevents finding dependent libraries that
|
---|
4375 | # are installed to the same prefix.
|
---|
4376 | # At present, this check doesn't affect windows .dll's that
|
---|
4377 | # are installed into $libdir/../bin (currently, that works fine)
|
---|
4378 | # but it's something to keep an eye on.
|
---|
4379 | test "$inst_prefix_dir" = "$destdir" && \
|
---|
4380 | func_fatal_error "error: cannot install '$file' to a directory not ending in $libdir"
|
---|
4381 |
|
---|
4382 | if test -n "$inst_prefix_dir"; then
|
---|
4383 | # Stick the inst_prefix_dir data into the link command.
|
---|
4384 | relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
|
---|
4385 | else
|
---|
4386 | relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
|
---|
4387 | fi
|
---|
4388 |
|
---|
4389 | func_warning "relinking '$file'"
|
---|
4390 | func_show_eval "$relink_command" \
|
---|
4391 | 'func_fatal_error "error: relink '\''$file'\'' with the above command before installing it"'
|
---|
4392 | fi
|
---|
4393 |
|
---|
4394 | # See the names of the shared library.
|
---|
4395 | set dummy $library_names; shift
|
---|
4396 | if test -n "$1"; then
|
---|
4397 | realname=$1
|
---|
4398 | shift
|
---|
4399 |
|
---|
4400 | srcname=$realname
|
---|
4401 | test -n "$relink_command" && srcname=${realname}T
|
---|
4402 |
|
---|
4403 | # Install the shared library and build the symlinks.
|
---|
4404 | func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
|
---|
4405 | 'exit $?'
|
---|
4406 | tstripme=$stripme
|
---|
4407 | case $host_os in
|
---|
4408 | cygwin* | mingw* | pw32* | cegcc*)
|
---|
4409 | case $realname in
|
---|
4410 | *.dll.a)
|
---|
4411 | tstripme=
|
---|
4412 | ;;
|
---|
4413 | esac
|
---|
4414 | ;;
|
---|
4415 | os2*)
|
---|
4416 | case $realname in
|
---|
4417 | *_dll.a)
|
---|
4418 | tstripme=
|
---|
4419 | ;;
|
---|
4420 | esac
|
---|
4421 | ;;
|
---|
4422 | esac
|
---|
4423 | if test -n "$tstripme" && test -n "$striplib"; then
|
---|
4424 | func_show_eval "$striplib $destdir/$realname" 'exit $?'
|
---|
4425 | fi
|
---|
4426 |
|
---|
4427 | if test "$#" -gt 0; then
|
---|
4428 | # Delete the old symlinks, and create new ones.
|
---|
4429 | # Try 'ln -sf' first, because the 'ln' binary might depend on
|
---|
4430 | # the symlink we replace! Solaris /bin/ln does not understand -f,
|
---|
4431 | # so we also need to try rm && ln -s.
|
---|
4432 | for linkname
|
---|
4433 | do
|
---|
4434 | test "$linkname" != "$realname" \
|
---|
4435 | && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
|
---|
4436 | done
|
---|
4437 | fi
|
---|
4438 |
|
---|
4439 | # Do each command in the postinstall commands.
|
---|
4440 | lib=$destdir/$realname
|
---|
4441 | func_execute_cmds "$postinstall_cmds" 'exit $?'
|
---|
4442 | fi
|
---|
4443 |
|
---|
4444 | # Install the pseudo-library for information purposes.
|
---|
4445 | func_basename "$file"
|
---|
4446 | name=$func_basename_result
|
---|
4447 | instname=$dir/${name}i
|
---|
4448 | func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
|
---|
4449 |
|
---|
4450 | # Maybe install the static library, too.
|
---|
4451 | test -n "$old_library" && func_append staticlibs " $dir/$old_library"
|
---|
4452 | ;;
|
---|
4453 |
|
---|
4454 | *.lo)
|
---|
4455 | # Install (i.e. copy) a libtool object.
|
---|
4456 |
|
---|
4457 | # Figure out destination file name, if it wasn't already specified.
|
---|
4458 | if test -n "$destname"; then
|
---|
4459 | destfile=$destdir/$destname
|
---|
4460 | else
|
---|
4461 | func_basename "$file"
|
---|
4462 | destfile=$func_basename_result
|
---|
4463 | destfile=$destdir/$destfile
|
---|
4464 | fi
|
---|
4465 |
|
---|
4466 | # Deduce the name of the destination old-style object file.
|
---|
4467 | case $destfile in
|
---|
4468 | *.lo)
|
---|
4469 | func_lo2o "$destfile"
|
---|
4470 | staticdest=$func_lo2o_result
|
---|
4471 | ;;
|
---|
4472 | *.$objext)
|
---|
4473 | staticdest=$destfile
|
---|
4474 | destfile=
|
---|
4475 | ;;
|
---|
4476 | *)
|
---|
4477 | func_fatal_help "cannot copy a libtool object to '$destfile'"
|
---|
4478 | ;;
|
---|
4479 | esac
|
---|
4480 |
|
---|
4481 | # Install the libtool object if requested.
|
---|
4482 | test -n "$destfile" && \
|
---|
4483 | func_show_eval "$install_prog $file $destfile" 'exit $?'
|
---|
4484 |
|
---|
4485 | # Install the old object if enabled.
|
---|
4486 | if test yes = "$build_old_libs"; then
|
---|
4487 | # Deduce the name of the old-style object file.
|
---|
4488 | func_lo2o "$file"
|
---|
4489 | staticobj=$func_lo2o_result
|
---|
4490 | func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
|
---|
4491 | fi
|
---|
4492 | exit $EXIT_SUCCESS
|
---|
4493 | ;;
|
---|
4494 |
|
---|
4495 | *)
|
---|
4496 | # Figure out destination file name, if it wasn't already specified.
|
---|
4497 | if test -n "$destname"; then
|
---|
4498 | destfile=$destdir/$destname
|
---|
4499 | else
|
---|
4500 | func_basename "$file"
|
---|
4501 | destfile=$func_basename_result
|
---|
4502 | destfile=$destdir/$destfile
|
---|
4503 | fi
|
---|
4504 |
|
---|
4505 | # If the file is missing, and there is a .exe on the end, strip it
|
---|
4506 | # because it is most likely a libtool script we actually want to
|
---|
4507 | # install
|
---|
4508 | stripped_ext=
|
---|
4509 | case $file in
|
---|
4510 | *.exe)
|
---|
4511 | if test ! -f "$file"; then
|
---|
4512 | func_stripname '' '.exe' "$file"
|
---|
4513 | file=$func_stripname_result
|
---|
4514 | stripped_ext=.exe
|
---|
4515 | fi
|
---|
4516 | ;;
|
---|
4517 | esac
|
---|
4518 |
|
---|
4519 | # Do a test to see if this is really a libtool program.
|
---|
4520 | case $host in
|
---|
4521 | *cygwin* | *mingw*)
|
---|
4522 | if func_ltwrapper_executable_p "$file"; then
|
---|
4523 | func_ltwrapper_scriptname "$file"
|
---|
4524 | wrapper=$func_ltwrapper_scriptname_result
|
---|
4525 | else
|
---|
4526 | func_stripname '' '.exe' "$file"
|
---|
4527 | wrapper=$func_stripname_result
|
---|
4528 | fi
|
---|
4529 | ;;
|
---|
4530 | *)
|
---|
4531 | wrapper=$file
|
---|
4532 | ;;
|
---|
4533 | esac
|
---|
4534 | if func_ltwrapper_script_p "$wrapper"; then
|
---|
4535 | notinst_deplibs=
|
---|
4536 | relink_command=
|
---|
4537 |
|
---|
4538 | func_source "$wrapper"
|
---|
4539 |
|
---|
4540 | # Check the variables that should have been set.
|
---|
4541 | test -z "$generated_by_libtool_version" && \
|
---|
4542 | func_fatal_error "invalid libtool wrapper script '$wrapper'"
|
---|
4543 |
|
---|
4544 | finalize=:
|
---|
4545 | for lib in $notinst_deplibs; do
|
---|
4546 | # Check to see that each library is installed.
|
---|
4547 | libdir=
|
---|
4548 | if test -f "$lib"; then
|
---|
4549 | func_source "$lib"
|
---|
4550 | fi
|
---|
4551 | libfile=$libdir/`$ECHO "$lib" | $SED 's%^.*/%%g'`
|
---|
4552 | if test -n "$libdir" && test ! -f "$libfile"; then
|
---|
4553 | func_warning "'$lib' has not been installed in '$libdir'"
|
---|
4554 | finalize=false
|
---|
4555 | fi
|
---|
4556 | done
|
---|
4557 |
|
---|
4558 | relink_command=
|
---|
4559 | func_source "$wrapper"
|
---|
4560 |
|
---|
4561 | outputname=
|
---|
4562 | if test no = "$fast_install" && test -n "$relink_command"; then
|
---|
4563 | $opt_dry_run || {
|
---|
4564 | if $finalize; then
|
---|
4565 | tmpdir=`func_mktempdir`
|
---|
4566 | func_basename "$file$stripped_ext"
|
---|
4567 | file=$func_basename_result
|
---|
4568 | outputname=$tmpdir/$file
|
---|
4569 | # Replace the output file specification.
|
---|
4570 | relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
|
---|
4571 |
|
---|
4572 | $opt_quiet || {
|
---|
4573 | func_quote_for_expand "$relink_command"
|
---|
4574 | eval "func_echo $func_quote_for_expand_result"
|
---|
4575 | }
|
---|
4576 | if eval "$relink_command"; then :
|
---|
4577 | else
|
---|
4578 | func_error "error: relink '$file' with the above command before installing it"
|
---|
4579 | $opt_dry_run || ${RM}r "$tmpdir"
|
---|
4580 | continue
|
---|
4581 | fi
|
---|
4582 | file=$outputname
|
---|
4583 | else
|
---|
4584 | func_warning "cannot relink '$file'"
|
---|
4585 | fi
|
---|
4586 | }
|
---|
4587 | else
|
---|
4588 | # Install the binary that we compiled earlier.
|
---|
4589 | file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
|
---|
4590 | fi
|
---|
4591 | fi
|
---|
4592 |
|
---|
4593 | # remove .exe since cygwin /usr/bin/install will append another
|
---|
4594 | # one anyway
|
---|
4595 | case $install_prog,$host in
|
---|
4596 | */usr/bin/install*,*cygwin*)
|
---|
4597 | case $file:$destfile in
|
---|
4598 | *.exe:*.exe)
|
---|
4599 | # this is ok
|
---|
4600 | ;;
|
---|
4601 | *.exe:*)
|
---|
4602 | destfile=$destfile.exe
|
---|
4603 | ;;
|
---|
4604 | *:*.exe)
|
---|
4605 | func_stripname '' '.exe' "$destfile"
|
---|
4606 | destfile=$func_stripname_result
|
---|
4607 | ;;
|
---|
4608 | esac
|
---|
4609 | ;;
|
---|
4610 | esac
|
---|
4611 | func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
|
---|
4612 | $opt_dry_run || if test -n "$outputname"; then
|
---|
4613 | ${RM}r "$tmpdir"
|
---|
4614 | fi
|
---|
4615 | ;;
|
---|
4616 | esac
|
---|
4617 | done
|
---|
4618 |
|
---|
4619 | for file in $staticlibs; do
|
---|
4620 | func_basename "$file"
|
---|
4621 | name=$func_basename_result
|
---|
4622 |
|
---|
4623 | # Set up the ranlib parameters.
|
---|
4624 | oldlib=$destdir/$name
|
---|
4625 | func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
|
---|
4626 | tool_oldlib=$func_to_tool_file_result
|
---|
4627 |
|
---|
4628 | func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
|
---|
4629 |
|
---|
4630 | if test -n "$stripme" && test -n "$old_striplib"; then
|
---|
4631 | func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
|
---|
4632 | fi
|
---|
4633 |
|
---|
4634 | # Do each command in the postinstall commands.
|
---|
4635 | func_execute_cmds "$old_postinstall_cmds" 'exit $?'
|
---|
4636 | done
|
---|
4637 |
|
---|
4638 | test -n "$future_libdirs" && \
|
---|
4639 | func_warning "remember to run '$progname --finish$future_libdirs'"
|
---|
4640 |
|
---|
4641 | if test -n "$current_libdirs"; then
|
---|
4642 | # Maybe just do a dry run.
|
---|
4643 | $opt_dry_run && current_libdirs=" -n$current_libdirs"
|
---|
4644 | exec_cmd='$SHELL "$progpath" $preserve_args --finish$current_libdirs'
|
---|
4645 | else
|
---|
4646 | exit $EXIT_SUCCESS
|
---|
4647 | fi
|
---|
4648 | }
|
---|
4649 |
|
---|
4650 | test install = "$opt_mode" && func_mode_install ${1+"$@"}
|
---|
4651 |
|
---|
4652 |
|
---|
4653 | # func_generate_dlsyms outputname originator pic_p
|
---|
4654 | # Extract symbols from dlprefiles and create ${outputname}S.o with
|
---|
4655 | # a dlpreopen symbol table.
|
---|
4656 | func_generate_dlsyms ()
|
---|
4657 | {
|
---|
4658 | $debug_cmd
|
---|
4659 |
|
---|
4660 | my_outputname=$1
|
---|
4661 | my_originator=$2
|
---|
4662 | my_pic_p=${3-false}
|
---|
4663 | my_prefix=`$ECHO "$my_originator" | $SED 's%[^a-zA-Z0-9]%_%g'`
|
---|
4664 | my_dlsyms=
|
---|
4665 |
|
---|
4666 | if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
|
---|
4667 | if test -n "$NM" && test -n "$global_symbol_pipe"; then
|
---|
4668 | my_dlsyms=${my_outputname}S.c
|
---|
4669 | else
|
---|
4670 | func_error "not configured to extract global symbols from dlpreopened files"
|
---|
4671 | fi
|
---|
4672 | fi
|
---|
4673 |
|
---|
4674 | if test -n "$my_dlsyms"; then
|
---|
4675 | case $my_dlsyms in
|
---|
4676 | "") ;;
|
---|
4677 | *.c)
|
---|
4678 | # Discover the nlist of each of the dlfiles.
|
---|
4679 | nlist=$output_objdir/$my_outputname.nm
|
---|
4680 |
|
---|
4681 | func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
|
---|
4682 |
|
---|
4683 | # Parse the name list into a source file.
|
---|
4684 | func_verbose "creating $output_objdir/$my_dlsyms"
|
---|
4685 |
|
---|
4686 | $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
|
---|
4687 | /* $my_dlsyms - symbol resolution table for '$my_outputname' dlsym emulation. */
|
---|
4688 | /* Generated by $PROGRAM (GNU $PACKAGE) $VERSION */
|
---|
4689 |
|
---|
4690 | #ifdef __cplusplus
|
---|
4691 | extern \"C\" {
|
---|
4692 | #endif
|
---|
4693 |
|
---|
4694 | #if defined __GNUC__ && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
|
---|
4695 | #pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
|
---|
4696 | #endif
|
---|
4697 |
|
---|
4698 | /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
|
---|
4699 | #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
|
---|
4700 | /* DATA imports from DLLs on WIN32 can't be const, because runtime
|
---|
4701 | relocations are performed -- see ld's documentation on pseudo-relocs. */
|
---|
4702 | # define LT_DLSYM_CONST
|
---|
4703 | #elif defined __osf__
|
---|
4704 | /* This system does not cope well with relocations in const data. */
|
---|
4705 | # define LT_DLSYM_CONST
|
---|
4706 | #else
|
---|
4707 | # define LT_DLSYM_CONST const
|
---|
4708 | #endif
|
---|
4709 |
|
---|
4710 | #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
|
---|
4711 |
|
---|
4712 | /* External symbol declarations for the compiler. */\
|
---|
4713 | "
|
---|
4714 |
|
---|
4715 | if test yes = "$dlself"; then
|
---|
4716 | func_verbose "generating symbol list for '$output'"
|
---|
4717 |
|
---|
4718 | $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
|
---|
4719 |
|
---|
4720 | # Add our own program objects to the symbol list.
|
---|
4721 | progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
|
---|
4722 | for progfile in $progfiles; do
|
---|
4723 | func_to_tool_file "$progfile" func_convert_file_msys_to_w32
|
---|
4724 | func_verbose "extracting global C symbols from '$func_to_tool_file_result'"
|
---|
4725 | $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
|
---|
4726 | done
|
---|
4727 |
|
---|
4728 | if test -n "$exclude_expsyms"; then
|
---|
4729 | $opt_dry_run || {
|
---|
4730 | eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
|
---|
4731 | eval '$MV "$nlist"T "$nlist"'
|
---|
4732 | }
|
---|
4733 | fi
|
---|
4734 |
|
---|
4735 | if test -n "$export_symbols_regex"; then
|
---|
4736 | $opt_dry_run || {
|
---|
4737 | eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
|
---|
4738 | eval '$MV "$nlist"T "$nlist"'
|
---|
4739 | }
|
---|
4740 | fi
|
---|
4741 |
|
---|
4742 | # Prepare the list of exported symbols
|
---|
4743 | if test -z "$export_symbols"; then
|
---|
4744 | export_symbols=$output_objdir/$outputname.exp
|
---|
4745 | $opt_dry_run || {
|
---|
4746 | $RM $export_symbols
|
---|
4747 | eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
|
---|
4748 | case $host in
|
---|
4749 | *cygwin* | *mingw* | *cegcc* )
|
---|
4750 | eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
|
---|
4751 | eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
|
---|
4752 | ;;
|
---|
4753 | esac
|
---|
4754 | }
|
---|
4755 | else
|
---|
4756 | $opt_dry_run || {
|
---|
4757 | eval "$SED -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
|
---|
4758 | eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
|
---|
4759 | eval '$MV "$nlist"T "$nlist"'
|
---|
4760 | case $host in
|
---|
4761 | *cygwin* | *mingw* | *cegcc* )
|
---|
4762 | eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
|
---|
4763 | eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
|
---|
4764 | ;;
|
---|
4765 | esac
|
---|
4766 | }
|
---|
4767 | fi
|
---|
4768 | fi
|
---|
4769 |
|
---|
4770 | for dlprefile in $dlprefiles; do
|
---|
4771 | func_verbose "extracting global C symbols from '$dlprefile'"
|
---|
4772 | func_basename "$dlprefile"
|
---|
4773 | name=$func_basename_result
|
---|
4774 | case $host in
|
---|
4775 | *cygwin* | *mingw* | *cegcc* )
|
---|
4776 | # if an import library, we need to obtain dlname
|
---|
4777 | if func_win32_import_lib_p "$dlprefile"; then
|
---|
4778 | func_tr_sh "$dlprefile"
|
---|
4779 | eval "curr_lafile=\$libfile_$func_tr_sh_result"
|
---|
4780 | dlprefile_dlbasename=
|
---|
4781 | if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
|
---|
4782 | # Use subshell, to avoid clobbering current variable values
|
---|
4783 | dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
|
---|
4784 | if test -n "$dlprefile_dlname"; then
|
---|
4785 | func_basename "$dlprefile_dlname"
|
---|
4786 | dlprefile_dlbasename=$func_basename_result
|
---|
4787 | else
|
---|
4788 | # no lafile. user explicitly requested -dlpreopen <import library>.
|
---|
4789 | $sharedlib_from_linklib_cmd "$dlprefile"
|
---|
4790 | dlprefile_dlbasename=$sharedlib_from_linklib_result
|
---|
4791 | fi
|
---|
4792 | fi
|
---|
4793 | $opt_dry_run || {
|
---|
4794 | if test -n "$dlprefile_dlbasename"; then
|
---|
4795 | eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
|
---|
4796 | else
|
---|
4797 | func_warning "Could not compute DLL name from $name"
|
---|
4798 | eval '$ECHO ": $name " >> "$nlist"'
|
---|
4799 | fi
|
---|
4800 | func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
|
---|
4801 | eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
|
---|
4802 | $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
|
---|
4803 | }
|
---|
4804 | else # not an import lib
|
---|
4805 | $opt_dry_run || {
|
---|
4806 | eval '$ECHO ": $name " >> "$nlist"'
|
---|
4807 | func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
|
---|
4808 | eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
|
---|
4809 | }
|
---|
4810 | fi
|
---|
4811 | ;;
|
---|
4812 | *)
|
---|
4813 | $opt_dry_run || {
|
---|
4814 | eval '$ECHO ": $name " >> "$nlist"'
|
---|
4815 | func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
|
---|
4816 | eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
|
---|
4817 | }
|
---|
4818 | ;;
|
---|
4819 | esac
|
---|
4820 | done
|
---|
4821 |
|
---|
4822 | $opt_dry_run || {
|
---|
4823 | # Make sure we have at least an empty file.
|
---|
4824 | test -f "$nlist" || : > "$nlist"
|
---|
4825 |
|
---|
4826 | if test -n "$exclude_expsyms"; then
|
---|
4827 | $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
|
---|
4828 | $MV "$nlist"T "$nlist"
|
---|
4829 | fi
|
---|
4830 |
|
---|
4831 | # Try sorting and uniquifying the output.
|
---|
4832 | if $GREP -v "^: " < "$nlist" |
|
---|
4833 | if sort -k 3 </dev/null >/dev/null 2>&1; then
|
---|
4834 | sort -k 3
|
---|
4835 | else
|
---|
4836 | sort +2
|
---|
4837 | fi |
|
---|
4838 | uniq > "$nlist"S; then
|
---|
4839 | :
|
---|
4840 | else
|
---|
4841 | $GREP -v "^: " < "$nlist" > "$nlist"S
|
---|
4842 | fi
|
---|
4843 |
|
---|
4844 | if test -f "$nlist"S; then
|
---|
4845 | eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
|
---|
4846 | else
|
---|
4847 | echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
|
---|
4848 | fi
|
---|
4849 |
|
---|
4850 | func_show_eval '$RM "${nlist}I"'
|
---|
4851 | if test -n "$global_symbol_to_import"; then
|
---|
4852 | eval "$global_symbol_to_import"' < "$nlist"S > "$nlist"I'
|
---|
4853 | fi
|
---|
4854 |
|
---|
4855 | echo >> "$output_objdir/$my_dlsyms" "\
|
---|
4856 |
|
---|
4857 | /* The mapping between symbol names and symbols. */
|
---|
4858 | typedef struct {
|
---|
4859 | const char *name;
|
---|
4860 | void *address;
|
---|
4861 | } lt_dlsymlist;
|
---|
4862 | extern LT_DLSYM_CONST lt_dlsymlist
|
---|
4863 | lt_${my_prefix}_LTX_preloaded_symbols[];\
|
---|
4864 | "
|
---|
4865 |
|
---|
4866 | if test -s "$nlist"I; then
|
---|
4867 | echo >> "$output_objdir/$my_dlsyms" "\
|
---|
4868 | static void lt_syminit(void)
|
---|
4869 | {
|
---|
4870 | LT_DLSYM_CONST lt_dlsymlist *symbol = lt_${my_prefix}_LTX_preloaded_symbols;
|
---|
4871 | for (; symbol->name; ++symbol)
|
---|
4872 | {"
|
---|
4873 | $SED 's/.*/ if (STREQ (symbol->name, \"&\")) symbol->address = (void *) \&&;/' < "$nlist"I >> "$output_objdir/$my_dlsyms"
|
---|
4874 | echo >> "$output_objdir/$my_dlsyms" "\
|
---|
4875 | }
|
---|
4876 | }"
|
---|
4877 | fi
|
---|
4878 | echo >> "$output_objdir/$my_dlsyms" "\
|
---|
4879 | LT_DLSYM_CONST lt_dlsymlist
|
---|
4880 | lt_${my_prefix}_LTX_preloaded_symbols[] =
|
---|
4881 | { {\"$my_originator\", (void *) 0},"
|
---|
4882 |
|
---|
4883 | if test -s "$nlist"I; then
|
---|
4884 | echo >> "$output_objdir/$my_dlsyms" "\
|
---|
4885 | {\"@INIT@\", (void *) <_syminit},"
|
---|
4886 | fi
|
---|
4887 |
|
---|
4888 | case $need_lib_prefix in
|
---|
4889 | no)
|
---|
4890 | eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
|
---|
4891 | ;;
|
---|
4892 | *)
|
---|
4893 | eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
|
---|
4894 | ;;
|
---|
4895 | esac
|
---|
4896 | echo >> "$output_objdir/$my_dlsyms" "\
|
---|
4897 | {0, (void *) 0}
|
---|
4898 | };
|
---|
4899 |
|
---|
4900 | /* This works around a problem in FreeBSD linker */
|
---|
4901 | #ifdef FREEBSD_WORKAROUND
|
---|
4902 | static const void *lt_preloaded_setup() {
|
---|
4903 | return lt_${my_prefix}_LTX_preloaded_symbols;
|
---|
4904 | }
|
---|
4905 | #endif
|
---|
4906 |
|
---|
4907 | #ifdef __cplusplus
|
---|
4908 | }
|
---|
4909 | #endif\
|
---|
4910 | "
|
---|
4911 | } # !$opt_dry_run
|
---|
4912 |
|
---|
4913 | pic_flag_for_symtable=
|
---|
4914 | case "$compile_command " in
|
---|
4915 | *" -static "*) ;;
|
---|
4916 | *)
|
---|
4917 | case $host in
|
---|
4918 | # compiling the symbol table file with pic_flag works around
|
---|
4919 | # a FreeBSD bug that causes programs to crash when -lm is
|
---|
4920 | # linked before any other PIC object. But we must not use
|
---|
4921 | # pic_flag when linking with -static. The problem exists in
|
---|
4922 | # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
|
---|
4923 | *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
|
---|
4924 | pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
|
---|
4925 | *-*-hpux*)
|
---|
4926 | pic_flag_for_symtable=" $pic_flag" ;;
|
---|
4927 | *)
|
---|
4928 | $my_pic_p && pic_flag_for_symtable=" $pic_flag"
|
---|
4929 | ;;
|
---|
4930 | esac
|
---|
4931 | ;;
|
---|
4932 | esac
|
---|
4933 | symtab_cflags=
|
---|
4934 | for arg in $LTCFLAGS; do
|
---|
4935 | case $arg in
|
---|
4936 | -pie | -fpie | -fPIE) ;;
|
---|
4937 | *) func_append symtab_cflags " $arg" ;;
|
---|
4938 | esac
|
---|
4939 | done
|
---|
4940 |
|
---|
4941 | # Now compile the dynamic symbol file.
|
---|
4942 | func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
|
---|
4943 |
|
---|
4944 | # Clean up the generated files.
|
---|
4945 | func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" "${nlist}I"'
|
---|
4946 |
|
---|
4947 | # Transform the symbol file into the correct name.
|
---|
4948 | symfileobj=$output_objdir/${my_outputname}S.$objext
|
---|
4949 | case $host in
|
---|
4950 | *cygwin* | *mingw* | *cegcc* )
|
---|
4951 | if test -f "$output_objdir/$my_outputname.def"; then
|
---|
4952 | compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
|
---|
4953 | finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
|
---|
4954 | else
|
---|
4955 | compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
|
---|
4956 | finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
|
---|
4957 | fi
|
---|
4958 | ;;
|
---|
4959 | *)
|
---|
4960 | compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
|
---|
4961 | finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
|
---|
4962 | ;;
|
---|
4963 | esac
|
---|
4964 | ;;
|
---|
4965 | *)
|
---|
4966 | func_fatal_error "unknown suffix for '$my_dlsyms'"
|
---|
4967 | ;;
|
---|
4968 | esac
|
---|
4969 | else
|
---|
4970 | # We keep going just in case the user didn't refer to
|
---|
4971 | # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
|
---|
4972 | # really was required.
|
---|
4973 |
|
---|
4974 | # Nullify the symbol file.
|
---|
4975 | compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
|
---|
4976 | finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
|
---|
4977 | fi
|
---|
4978 | }
|
---|
4979 |
|
---|
4980 | # func_cygming_gnu_implib_p ARG
|
---|
4981 | # This predicate returns with zero status (TRUE) if
|
---|
4982 | # ARG is a GNU/binutils-style import library. Returns
|
---|
4983 | # with nonzero status (FALSE) otherwise.
|
---|
4984 | func_cygming_gnu_implib_p ()
|
---|
4985 | {
|
---|
4986 | $debug_cmd
|
---|
4987 |
|
---|
4988 | func_to_tool_file "$1" func_convert_file_msys_to_w32
|
---|
4989 | 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)$'`
|
---|
4990 | test -n "$func_cygming_gnu_implib_tmp"
|
---|
4991 | }
|
---|
4992 |
|
---|
4993 | # func_cygming_ms_implib_p ARG
|
---|
4994 | # This predicate returns with zero status (TRUE) if
|
---|
4995 | # ARG is an MS-style import library. Returns
|
---|
4996 | # with nonzero status (FALSE) otherwise.
|
---|
4997 | func_cygming_ms_implib_p ()
|
---|
4998 | {
|
---|
4999 | $debug_cmd
|
---|
5000 |
|
---|
5001 | func_to_tool_file "$1" func_convert_file_msys_to_w32
|
---|
5002 | func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
|
---|
5003 | test -n "$func_cygming_ms_implib_tmp"
|
---|
5004 | }
|
---|
5005 |
|
---|
5006 | # func_win32_libid arg
|
---|
5007 | # return the library type of file 'arg'
|
---|
5008 | #
|
---|
5009 | # Need a lot of goo to handle *both* DLLs and import libs
|
---|
5010 | # Has to be a shell function in order to 'eat' the argument
|
---|
5011 | # that is supplied when $file_magic_command is called.
|
---|
5012 | # Despite the name, also deal with 64 bit binaries.
|
---|
5013 | func_win32_libid ()
|
---|
5014 | {
|
---|
5015 | $debug_cmd
|
---|
5016 |
|
---|
5017 | win32_libid_type=unknown
|
---|
5018 | win32_fileres=`file -L $1 2>/dev/null`
|
---|
5019 | case $win32_fileres in
|
---|
5020 | *ar\ archive\ import\ library*) # definitely import
|
---|
5021 | win32_libid_type="x86 archive import"
|
---|
5022 | ;;
|
---|
5023 | *ar\ archive*) # could be an import, or static
|
---|
5024 | # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
|
---|
5025 | if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
|
---|
5026 | $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
|
---|
5027 | case $nm_interface in
|
---|
5028 | "MS dumpbin")
|
---|
5029 | if func_cygming_ms_implib_p "$1" ||
|
---|
5030 | func_cygming_gnu_implib_p "$1"
|
---|
5031 | then
|
---|
5032 | win32_nmres=import
|
---|
5033 | else
|
---|
5034 | win32_nmres=
|
---|
5035 | fi
|
---|
5036 | ;;
|
---|
5037 | *)
|
---|
5038 | func_to_tool_file "$1" func_convert_file_msys_to_w32
|
---|
5039 | win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
|
---|
5040 | $SED -n -e '
|
---|
5041 | 1,100{
|
---|
5042 | / I /{
|
---|
5043 | s|.*|import|
|
---|
5044 | p
|
---|
5045 | q
|
---|
5046 | }
|
---|
5047 | }'`
|
---|
5048 | ;;
|
---|
5049 | esac
|
---|
5050 | case $win32_nmres in
|
---|
5051 | import*) win32_libid_type="x86 archive import";;
|
---|
5052 | *) win32_libid_type="x86 archive static";;
|
---|
5053 | esac
|
---|
5054 | fi
|
---|
5055 | ;;
|
---|
5056 | *DLL*)
|
---|
5057 | win32_libid_type="x86 DLL"
|
---|
5058 | ;;
|
---|
5059 | *executable*) # but shell scripts are "executable" too...
|
---|
5060 | case $win32_fileres in
|
---|
5061 | *MS\ Windows\ PE\ Intel*)
|
---|
5062 | win32_libid_type="x86 DLL"
|
---|
5063 | ;;
|
---|
5064 | esac
|
---|
5065 | ;;
|
---|
5066 | esac
|
---|
5067 | $ECHO "$win32_libid_type"
|
---|
5068 | }
|
---|
5069 |
|
---|
5070 | # func_cygming_dll_for_implib ARG
|
---|
5071 | #
|
---|
5072 | # Platform-specific function to extract the
|
---|
5073 | # name of the DLL associated with the specified
|
---|
5074 | # import library ARG.
|
---|
5075 | # Invoked by eval'ing the libtool variable
|
---|
5076 | # $sharedlib_from_linklib_cmd
|
---|
5077 | # Result is available in the variable
|
---|
5078 | # $sharedlib_from_linklib_result
|
---|
5079 | func_cygming_dll_for_implib ()
|
---|
5080 | {
|
---|
5081 | $debug_cmd
|
---|
5082 |
|
---|
5083 | sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
|
---|
5084 | }
|
---|
5085 |
|
---|
5086 | # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
|
---|
5087 | #
|
---|
5088 | # The is the core of a fallback implementation of a
|
---|
5089 | # platform-specific function to extract the name of the
|
---|
5090 | # DLL associated with the specified import library LIBNAME.
|
---|
5091 | #
|
---|
5092 | # SECTION_NAME is either .idata$6 or .idata$7, depending
|
---|
5093 | # on the platform and compiler that created the implib.
|
---|
5094 | #
|
---|
5095 | # Echos the name of the DLL associated with the
|
---|
5096 | # specified import library.
|
---|
5097 | func_cygming_dll_for_implib_fallback_core ()
|
---|
5098 | {
|
---|
5099 | $debug_cmd
|
---|
5100 |
|
---|
5101 | match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
|
---|
5102 | $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
|
---|
5103 | $SED '/^Contents of section '"$match_literal"':/{
|
---|
5104 | # Place marker at beginning of archive member dllname section
|
---|
5105 | s/.*/====MARK====/
|
---|
5106 | p
|
---|
5107 | d
|
---|
5108 | }
|
---|
5109 | # These lines can sometimes be longer than 43 characters, but
|
---|
5110 | # are always uninteresting
|
---|
5111 | /:[ ]*file format pe[i]\{,1\}-/d
|
---|
5112 | /^In archive [^:]*:/d
|
---|
5113 | # Ensure marker is printed
|
---|
5114 | /^====MARK====/p
|
---|
5115 | # Remove all lines with less than 43 characters
|
---|
5116 | /^.\{43\}/!d
|
---|
5117 | # From remaining lines, remove first 43 characters
|
---|
5118 | s/^.\{43\}//' |
|
---|
5119 | $SED -n '
|
---|
5120 | # Join marker and all lines until next marker into a single line
|
---|
5121 | /^====MARK====/ b para
|
---|
5122 | H
|
---|
5123 | $ b para
|
---|
5124 | b
|
---|
5125 | :para
|
---|
5126 | x
|
---|
5127 | s/\n//g
|
---|
5128 | # Remove the marker
|
---|
5129 | s/^====MARK====//
|
---|
5130 | # Remove trailing dots and whitespace
|
---|
5131 | s/[\. \t]*$//
|
---|
5132 | # Print
|
---|
5133 | /./p' |
|
---|
5134 | # we now have a list, one entry per line, of the stringified
|
---|
5135 | # contents of the appropriate section of all members of the
|
---|
5136 | # archive that possess that section. Heuristic: eliminate
|
---|
5137 | # all those that have a first or second character that is
|
---|
5138 | # a '.' (that is, objdump's representation of an unprintable
|
---|
5139 | # character.) This should work for all archives with less than
|
---|
5140 | # 0x302f exports -- but will fail for DLLs whose name actually
|
---|
5141 | # begins with a literal '.' or a single character followed by
|
---|
5142 | # a '.'.
|
---|
5143 | #
|
---|
5144 | # Of those that remain, print the first one.
|
---|
5145 | $SED -e '/^\./d;/^.\./d;q'
|
---|
5146 | }
|
---|
5147 |
|
---|
5148 | # func_cygming_dll_for_implib_fallback ARG
|
---|
5149 | # Platform-specific function to extract the
|
---|
5150 | # name of the DLL associated with the specified
|
---|
5151 | # import library ARG.
|
---|
5152 | #
|
---|
5153 | # This fallback implementation is for use when $DLLTOOL
|
---|
5154 | # does not support the --identify-strict option.
|
---|
5155 | # Invoked by eval'ing the libtool variable
|
---|
5156 | # $sharedlib_from_linklib_cmd
|
---|
5157 | # Result is available in the variable
|
---|
5158 | # $sharedlib_from_linklib_result
|
---|
5159 | func_cygming_dll_for_implib_fallback ()
|
---|
5160 | {
|
---|
5161 | $debug_cmd
|
---|
5162 |
|
---|
5163 | if func_cygming_gnu_implib_p "$1"; then
|
---|
5164 | # binutils import library
|
---|
5165 | sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
|
---|
5166 | elif func_cygming_ms_implib_p "$1"; then
|
---|
5167 | # ms-generated import library
|
---|
5168 | sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
|
---|
5169 | else
|
---|
5170 | # unknown
|
---|
5171 | sharedlib_from_linklib_result=
|
---|
5172 | fi
|
---|
5173 | }
|
---|
5174 |
|
---|
5175 |
|
---|
5176 | # func_extract_an_archive dir oldlib
|
---|
5177 | func_extract_an_archive ()
|
---|
5178 | {
|
---|
5179 | $debug_cmd
|
---|
5180 |
|
---|
5181 | f_ex_an_ar_dir=$1; shift
|
---|
5182 | f_ex_an_ar_oldlib=$1
|
---|
5183 | if test yes = "$lock_old_archive_extraction"; then
|
---|
5184 | lockfile=$f_ex_an_ar_oldlib.lock
|
---|
5185 | until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
|
---|
5186 | func_echo "Waiting for $lockfile to be removed"
|
---|
5187 | sleep 2
|
---|
5188 | done
|
---|
5189 | fi
|
---|
5190 | func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
|
---|
5191 | 'stat=$?; rm -f "$lockfile"; exit $stat'
|
---|
5192 | if test yes = "$lock_old_archive_extraction"; then
|
---|
5193 | $opt_dry_run || rm -f "$lockfile"
|
---|
5194 | fi
|
---|
5195 | if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
|
---|
5196 | :
|
---|
5197 | else
|
---|
5198 | func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
|
---|
5199 | fi
|
---|
5200 | }
|
---|
5201 |
|
---|
5202 |
|
---|
5203 | # func_extract_archives gentop oldlib ...
|
---|
5204 | func_extract_archives ()
|
---|
5205 | {
|
---|
5206 | $debug_cmd
|
---|
5207 |
|
---|
5208 | my_gentop=$1; shift
|
---|
5209 | my_oldlibs=${1+"$@"}
|
---|
5210 | my_oldobjs=
|
---|
5211 | my_xlib=
|
---|
5212 | my_xabs=
|
---|
5213 | my_xdir=
|
---|
5214 |
|
---|
5215 | for my_xlib in $my_oldlibs; do
|
---|
5216 | # Extract the objects.
|
---|
5217 | case $my_xlib in
|
---|
5218 | [\\/]* | [A-Za-z]:[\\/]*) my_xabs=$my_xlib ;;
|
---|
5219 | *) my_xabs=`pwd`"/$my_xlib" ;;
|
---|
5220 | esac
|
---|
5221 | func_basename "$my_xlib"
|
---|
5222 | my_xlib=$func_basename_result
|
---|
5223 | my_xlib_u=$my_xlib
|
---|
5224 | while :; do
|
---|
5225 | case " $extracted_archives " in
|
---|
5226 | *" $my_xlib_u "*)
|
---|
5227 | func_arith $extracted_serial + 1
|
---|
5228 | extracted_serial=$func_arith_result
|
---|
5229 | my_xlib_u=lt$extracted_serial-$my_xlib ;;
|
---|
5230 | *) break ;;
|
---|
5231 | esac
|
---|
5232 | done
|
---|
5233 | extracted_archives="$extracted_archives $my_xlib_u"
|
---|
5234 | my_xdir=$my_gentop/$my_xlib_u
|
---|
5235 |
|
---|
5236 | func_mkdir_p "$my_xdir"
|
---|
5237 |
|
---|
5238 | case $host in
|
---|
5239 | *-darwin*)
|
---|
5240 | func_verbose "Extracting $my_xabs"
|
---|
5241 | # Do not bother doing anything if just a dry run
|
---|
5242 | $opt_dry_run || {
|
---|
5243 | darwin_orig_dir=`pwd`
|
---|
5244 | cd $my_xdir || exit $?
|
---|
5245 | darwin_archive=$my_xabs
|
---|
5246 | darwin_curdir=`pwd`
|
---|
5247 | func_basename "$darwin_archive"
|
---|
5248 | darwin_base_archive=$func_basename_result
|
---|
5249 | darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
|
---|
5250 | if test -n "$darwin_arches"; then
|
---|
5251 | darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
|
---|
5252 | darwin_arch=
|
---|
5253 | func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
|
---|
5254 | for darwin_arch in $darwin_arches; do
|
---|
5255 | func_mkdir_p "unfat-$$/$darwin_base_archive-$darwin_arch"
|
---|
5256 | $LIPO -thin $darwin_arch -output "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" "$darwin_archive"
|
---|
5257 | cd "unfat-$$/$darwin_base_archive-$darwin_arch"
|
---|
5258 | func_extract_an_archive "`pwd`" "$darwin_base_archive"
|
---|
5259 | cd "$darwin_curdir"
|
---|
5260 | $RM "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive"
|
---|
5261 | done # $darwin_arches
|
---|
5262 | ## Okay now we've a bunch of thin objects, gotta fatten them up :)
|
---|
5263 | darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$sed_basename" | sort -u`
|
---|
5264 | darwin_file=
|
---|
5265 | darwin_files=
|
---|
5266 | for darwin_file in $darwin_filelist; do
|
---|
5267 | darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
|
---|
5268 | $LIPO -create -output "$darwin_file" $darwin_files
|
---|
5269 | done # $darwin_filelist
|
---|
5270 | $RM -rf unfat-$$
|
---|
5271 | cd "$darwin_orig_dir"
|
---|
5272 | else
|
---|
5273 | cd $darwin_orig_dir
|
---|
5274 | func_extract_an_archive "$my_xdir" "$my_xabs"
|
---|
5275 | fi # $darwin_arches
|
---|
5276 | } # !$opt_dry_run
|
---|
5277 | ;;
|
---|
5278 | *)
|
---|
5279 | func_extract_an_archive "$my_xdir" "$my_xabs"
|
---|
5280 | ;;
|
---|
5281 | esac
|
---|
5282 | my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
|
---|
5283 | done
|
---|
5284 |
|
---|
5285 | func_extract_archives_result=$my_oldobjs
|
---|
5286 | }
|
---|
5287 |
|
---|
5288 |
|
---|
5289 | # func_emit_wrapper [arg=no]
|
---|
5290 | #
|
---|
5291 | # Emit a libtool wrapper script on stdout.
|
---|
5292 | # Don't directly open a file because we may want to
|
---|
5293 | # incorporate the script contents within a cygwin/mingw
|
---|
5294 | # wrapper executable. Must ONLY be called from within
|
---|
5295 | # func_mode_link because it depends on a number of variables
|
---|
5296 | # set therein.
|
---|
5297 | #
|
---|
5298 | # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
|
---|
5299 | # variable will take. If 'yes', then the emitted script
|
---|
5300 | # will assume that the directory where it is stored is
|
---|
5301 | # the $objdir directory. This is a cygwin/mingw-specific
|
---|
5302 | # behavior.
|
---|
5303 | func_emit_wrapper ()
|
---|
5304 | {
|
---|
5305 | func_emit_wrapper_arg1=${1-no}
|
---|
5306 |
|
---|
5307 | $ECHO "\
|
---|
5308 | #! $SHELL
|
---|
5309 |
|
---|
5310 | # $output - temporary wrapper script for $objdir/$outputname
|
---|
5311 | # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
|
---|
5312 | #
|
---|
5313 | # The $output program cannot be directly executed until all the libtool
|
---|
5314 | # libraries that it depends on are installed.
|
---|
5315 | #
|
---|
5316 | # This wrapper script should never be moved out of the build directory.
|
---|
5317 | # If it is, it will not operate correctly.
|
---|
5318 |
|
---|
5319 | # Sed substitution that helps us do robust quoting. It backslashifies
|
---|
5320 | # metacharacters that are still active within double-quoted strings.
|
---|
5321 | sed_quote_subst='$sed_quote_subst'
|
---|
5322 |
|
---|
5323 | # Be Bourne compatible
|
---|
5324 | if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
|
---|
5325 | emulate sh
|
---|
5326 | NULLCMD=:
|
---|
5327 | # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
|
---|
5328 | # is contrary to our usage. Disable this feature.
|
---|
5329 | alias -g '\${1+\"\$@\"}'='\"\$@\"'
|
---|
5330 | setopt NO_GLOB_SUBST
|
---|
5331 | else
|
---|
5332 | case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
|
---|
5333 | fi
|
---|
5334 | BIN_SH=xpg4; export BIN_SH # for Tru64
|
---|
5335 | DUALCASE=1; export DUALCASE # for MKS sh
|
---|
5336 |
|
---|
5337 | # The HP-UX ksh and POSIX shell print the target directory to stdout
|
---|
5338 | # if CDPATH is set.
|
---|
5339 | (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
|
---|
5340 |
|
---|
5341 | relink_command=\"$relink_command\"
|
---|
5342 |
|
---|
5343 | # This environment variable determines our operation mode.
|
---|
5344 | if test \"\$libtool_install_magic\" = \"$magic\"; then
|
---|
5345 | # install mode needs the following variables:
|
---|
5346 | generated_by_libtool_version='$macro_version'
|
---|
5347 | notinst_deplibs='$notinst_deplibs'
|
---|
5348 | else
|
---|
5349 | # When we are sourced in execute mode, \$file and \$ECHO are already set.
|
---|
5350 | if test \"\$libtool_execute_magic\" != \"$magic\"; then
|
---|
5351 | file=\"\$0\""
|
---|
5352 |
|
---|
5353 | qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
|
---|
5354 | $ECHO "\
|
---|
5355 |
|
---|
5356 | # A function that is used when there is no print builtin or printf.
|
---|
5357 | func_fallback_echo ()
|
---|
5358 | {
|
---|
5359 | eval 'cat <<_LTECHO_EOF
|
---|
5360 | \$1
|
---|
5361 | _LTECHO_EOF'
|
---|
5362 | }
|
---|
5363 | ECHO=\"$qECHO\"
|
---|
5364 | fi
|
---|
5365 |
|
---|
5366 | # Very basic option parsing. These options are (a) specific to
|
---|
5367 | # the libtool wrapper, (b) are identical between the wrapper
|
---|
5368 | # /script/ and the wrapper /executable/ that is used only on
|
---|
5369 | # windows platforms, and (c) all begin with the string "--lt-"
|
---|
5370 | # (application programs are unlikely to have options that match
|
---|
5371 | # this pattern).
|
---|
5372 | #
|
---|
5373 | # There are only two supported options: --lt-debug and
|
---|
5374 | # --lt-dump-script. There is, deliberately, no --lt-help.
|
---|
5375 | #
|
---|
5376 | # The first argument to this parsing function should be the
|
---|
5377 | # script's $0 value, followed by "$@".
|
---|
5378 | lt_option_debug=
|
---|
5379 | func_parse_lt_options ()
|
---|
5380 | {
|
---|
5381 | lt_script_arg0=\$0
|
---|
5382 | shift
|
---|
5383 | for lt_opt
|
---|
5384 | do
|
---|
5385 | case \"\$lt_opt\" in
|
---|
5386 | --lt-debug) lt_option_debug=1 ;;
|
---|
5387 | --lt-dump-script)
|
---|
5388 | lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
|
---|
5389 | test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
|
---|
5390 | lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
|
---|
5391 | cat \"\$lt_dump_D/\$lt_dump_F\"
|
---|
5392 | exit 0
|
---|
5393 | ;;
|
---|
5394 | --lt-*)
|
---|
5395 | \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
|
---|
5396 | exit 1
|
---|
5397 | ;;
|
---|
5398 | esac
|
---|
5399 | done
|
---|
5400 |
|
---|
5401 | # Print the debug banner immediately:
|
---|
5402 | if test -n \"\$lt_option_debug\"; then
|
---|
5403 | echo \"$outputname:$output:\$LINENO: libtool wrapper (GNU $PACKAGE) $VERSION\" 1>&2
|
---|
5404 | fi
|
---|
5405 | }
|
---|
5406 |
|
---|
5407 | # Used when --lt-debug. Prints its arguments to stdout
|
---|
5408 | # (redirection is the responsibility of the caller)
|
---|
5409 | func_lt_dump_args ()
|
---|
5410 | {
|
---|
5411 | lt_dump_args_N=1;
|
---|
5412 | for lt_arg
|
---|
5413 | do
|
---|
5414 | \$ECHO \"$outputname:$output:\$LINENO: newargv[\$lt_dump_args_N]: \$lt_arg\"
|
---|
5415 | lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
|
---|
5416 | done
|
---|
5417 | }
|
---|
5418 |
|
---|
5419 | # Core function for launching the target application
|
---|
5420 | func_exec_program_core ()
|
---|
5421 | {
|
---|
5422 | "
|
---|
5423 | case $host in
|
---|
5424 | # Backslashes separate directories on plain windows
|
---|
5425 | *-*-mingw | *-*-os2* | *-cegcc*)
|
---|
5426 | $ECHO "\
|
---|
5427 | if test -n \"\$lt_option_debug\"; then
|
---|
5428 | \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir\\\\\$program\" 1>&2
|
---|
5429 | func_lt_dump_args \${1+\"\$@\"} 1>&2
|
---|
5430 | fi
|
---|
5431 | exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
|
---|
5432 | "
|
---|
5433 | ;;
|
---|
5434 |
|
---|
5435 | *)
|
---|
5436 | $ECHO "\
|
---|
5437 | if test -n \"\$lt_option_debug\"; then
|
---|
5438 | \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir/\$program\" 1>&2
|
---|
5439 | func_lt_dump_args \${1+\"\$@\"} 1>&2
|
---|
5440 | fi
|
---|
5441 | exec \"\$progdir/\$program\" \${1+\"\$@\"}
|
---|
5442 | "
|
---|
5443 | ;;
|
---|
5444 | esac
|
---|
5445 | $ECHO "\
|
---|
5446 | \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
|
---|
5447 | exit 1
|
---|
5448 | }
|
---|
5449 |
|
---|
5450 | # A function to encapsulate launching the target application
|
---|
5451 | # Strips options in the --lt-* namespace from \$@ and
|
---|
5452 | # launches target application with the remaining arguments.
|
---|
5453 | func_exec_program ()
|
---|
5454 | {
|
---|
5455 | case \" \$* \" in
|
---|
5456 | *\\ --lt-*)
|
---|
5457 | for lt_wr_arg
|
---|
5458 | do
|
---|
5459 | case \$lt_wr_arg in
|
---|
5460 | --lt-*) ;;
|
---|
5461 | *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
|
---|
5462 | esac
|
---|
5463 | shift
|
---|
5464 | done ;;
|
---|
5465 | esac
|
---|
5466 | func_exec_program_core \${1+\"\$@\"}
|
---|
5467 | }
|
---|
5468 |
|
---|
5469 | # Parse options
|
---|
5470 | func_parse_lt_options \"\$0\" \${1+\"\$@\"}
|
---|
5471 |
|
---|
5472 | # Find the directory that this script lives in.
|
---|
5473 | thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
|
---|
5474 | test \"x\$thisdir\" = \"x\$file\" && thisdir=.
|
---|
5475 |
|
---|
5476 | # Follow symbolic links until we get to the real thisdir.
|
---|
5477 | file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
|
---|
5478 | while test -n \"\$file\"; do
|
---|
5479 | destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
|
---|
5480 |
|
---|
5481 | # If there was a directory component, then change thisdir.
|
---|
5482 | if test \"x\$destdir\" != \"x\$file\"; then
|
---|
5483 | case \"\$destdir\" in
|
---|
5484 | [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
|
---|
5485 | *) thisdir=\"\$thisdir/\$destdir\" ;;
|
---|
5486 | esac
|
---|
5487 | fi
|
---|
5488 |
|
---|
5489 | file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
|
---|
5490 | file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
|
---|
5491 | done
|
---|
5492 |
|
---|
5493 | # Usually 'no', except on cygwin/mingw when embedded into
|
---|
5494 | # the cwrapper.
|
---|
5495 | WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
|
---|
5496 | if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
|
---|
5497 | # special case for '.'
|
---|
5498 | if test \"\$thisdir\" = \".\"; then
|
---|
5499 | thisdir=\`pwd\`
|
---|
5500 | fi
|
---|
5501 | # remove .libs from thisdir
|
---|
5502 | case \"\$thisdir\" in
|
---|
5503 | *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
|
---|
5504 | $objdir ) thisdir=. ;;
|
---|
5505 | esac
|
---|
5506 | fi
|
---|
5507 |
|
---|
5508 | # Try to get the absolute directory name.
|
---|
5509 | absdir=\`cd \"\$thisdir\" && pwd\`
|
---|
5510 | test -n \"\$absdir\" && thisdir=\"\$absdir\"
|
---|
5511 | "
|
---|
5512 |
|
---|
5513 | if test yes = "$fast_install"; then
|
---|
5514 | $ECHO "\
|
---|
5515 | program=lt-'$outputname'$exeext
|
---|
5516 | progdir=\"\$thisdir/$objdir\"
|
---|
5517 |
|
---|
5518 | if test ! -f \"\$progdir/\$program\" ||
|
---|
5519 | { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | $SED 1q\`; \\
|
---|
5520 | test \"X\$file\" != \"X\$progdir/\$program\"; }; then
|
---|
5521 |
|
---|
5522 | file=\"\$\$-\$program\"
|
---|
5523 |
|
---|
5524 | if test ! -d \"\$progdir\"; then
|
---|
5525 | $MKDIR \"\$progdir\"
|
---|
5526 | else
|
---|
5527 | $RM \"\$progdir/\$file\"
|
---|
5528 | fi"
|
---|
5529 |
|
---|
5530 | $ECHO "\
|
---|
5531 |
|
---|
5532 | # relink executable if necessary
|
---|
5533 | if test -n \"\$relink_command\"; then
|
---|
5534 | if relink_command_output=\`eval \$relink_command 2>&1\`; then :
|
---|
5535 | else
|
---|
5536 | \$ECHO \"\$relink_command_output\" >&2
|
---|
5537 | $RM \"\$progdir/\$file\"
|
---|
5538 | exit 1
|
---|
5539 | fi
|
---|
5540 | fi
|
---|
5541 |
|
---|
5542 | $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
|
---|
5543 | { $RM \"\$progdir/\$program\";
|
---|
5544 | $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
|
---|
5545 | $RM \"\$progdir/\$file\"
|
---|
5546 | fi"
|
---|
5547 | else
|
---|
5548 | $ECHO "\
|
---|
5549 | program='$outputname'
|
---|
5550 | progdir=\"\$thisdir/$objdir\"
|
---|
5551 | "
|
---|
5552 | fi
|
---|
5553 |
|
---|
5554 | $ECHO "\
|
---|
5555 |
|
---|
5556 | if test -f \"\$progdir/\$program\"; then"
|
---|
5557 |
|
---|
5558 | # fixup the dll searchpath if we need to.
|
---|
5559 | #
|
---|
5560 | # Fix the DLL searchpath if we need to. Do this before prepending
|
---|
5561 | # to shlibpath, because on Windows, both are PATH and uninstalled
|
---|
5562 | # libraries must come first.
|
---|
5563 | if test -n "$dllsearchpath"; then
|
---|
5564 | $ECHO "\
|
---|
5565 | # Add the dll search path components to the executable PATH
|
---|
5566 | PATH=$dllsearchpath:\$PATH
|
---|
5567 | "
|
---|
5568 | fi
|
---|
5569 |
|
---|
5570 | # Export our shlibpath_var if we have one.
|
---|
5571 | if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
|
---|
5572 | $ECHO "\
|
---|
5573 | # Add our own library path to $shlibpath_var
|
---|
5574 | $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
|
---|
5575 |
|
---|
5576 | # Some systems cannot cope with colon-terminated $shlibpath_var
|
---|
5577 | # The second colon is a workaround for a bug in BeOS R4 sed
|
---|
5578 | $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
|
---|
5579 |
|
---|
5580 | export $shlibpath_var
|
---|
5581 | "
|
---|
5582 | fi
|
---|
5583 |
|
---|
5584 | $ECHO "\
|
---|
5585 | if test \"\$libtool_execute_magic\" != \"$magic\"; then
|
---|
5586 | # Run the actual program with our arguments.
|
---|
5587 | func_exec_program \${1+\"\$@\"}
|
---|
5588 | fi
|
---|
5589 | else
|
---|
5590 | # The program doesn't exist.
|
---|
5591 | \$ECHO \"\$0: error: '\$progdir/\$program' does not exist\" 1>&2
|
---|
5592 | \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
|
---|
5593 | \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
|
---|
5594 | exit 1
|
---|
5595 | fi
|
---|
5596 | fi\
|
---|
5597 | "
|
---|
5598 | }
|
---|
5599 |
|
---|
5600 |
|
---|
5601 | # func_emit_cwrapperexe_src
|
---|
5602 | # emit the source code for a wrapper executable on stdout
|
---|
5603 | # Must ONLY be called from within func_mode_link because
|
---|
5604 | # it depends on a number of variable set therein.
|
---|
5605 | func_emit_cwrapperexe_src ()
|
---|
5606 | {
|
---|
5607 | cat <<EOF
|
---|
5608 |
|
---|
5609 | /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
|
---|
5610 | Generated by $PROGRAM (GNU $PACKAGE) $VERSION
|
---|
5611 |
|
---|
5612 | The $output program cannot be directly executed until all the libtool
|
---|
5613 | libraries that it depends on are installed.
|
---|
5614 |
|
---|
5615 | This wrapper executable should never be moved out of the build directory.
|
---|
5616 | If it is, it will not operate correctly.
|
---|
5617 | */
|
---|
5618 | EOF
|
---|
5619 | cat <<"EOF"
|
---|
5620 | #ifdef _MSC_VER
|
---|
5621 | # define _CRT_SECURE_NO_DEPRECATE 1
|
---|
5622 | #endif
|
---|
5623 | #include <stdio.h>
|
---|
5624 | #include <stdlib.h>
|
---|
5625 | #ifdef _MSC_VER
|
---|
5626 | # include <direct.h>
|
---|
5627 | # include <process.h>
|
---|
5628 | # include <io.h>
|
---|
5629 | #else
|
---|
5630 | # include <unistd.h>
|
---|
5631 | # include <stdint.h>
|
---|
5632 | # ifdef __CYGWIN__
|
---|
5633 | # include <io.h>
|
---|
5634 | # endif
|
---|
5635 | #endif
|
---|
5636 | #include <malloc.h>
|
---|
5637 | #include <stdarg.h>
|
---|
5638 | #include <assert.h>
|
---|
5639 | #include <string.h>
|
---|
5640 | #include <ctype.h>
|
---|
5641 | #include <errno.h>
|
---|
5642 | #include <fcntl.h>
|
---|
5643 | #include <sys/stat.h>
|
---|
5644 |
|
---|
5645 | #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
|
---|
5646 |
|
---|
5647 | /* declarations of non-ANSI functions */
|
---|
5648 | #if defined __MINGW32__
|
---|
5649 | # ifdef __STRICT_ANSI__
|
---|
5650 | int _putenv (const char *);
|
---|
5651 | # endif
|
---|
5652 | #elif defined __CYGWIN__
|
---|
5653 | # ifdef __STRICT_ANSI__
|
---|
5654 | char *realpath (const char *, char *);
|
---|
5655 | int putenv (char *);
|
---|
5656 | int setenv (const char *, const char *, int);
|
---|
5657 | # endif
|
---|
5658 | /* #elif defined other_platform || defined ... */
|
---|
5659 | #endif
|
---|
5660 |
|
---|
5661 | /* portability defines, excluding path handling macros */
|
---|
5662 | #if defined _MSC_VER
|
---|
5663 | # define setmode _setmode
|
---|
5664 | # define stat _stat
|
---|
5665 | # define chmod _chmod
|
---|
5666 | # define getcwd _getcwd
|
---|
5667 | # define putenv _putenv
|
---|
5668 | # define S_IXUSR _S_IEXEC
|
---|
5669 | #elif defined __MINGW32__
|
---|
5670 | # define setmode _setmode
|
---|
5671 | # define stat _stat
|
---|
5672 | # define chmod _chmod
|
---|
5673 | # define getcwd _getcwd
|
---|
5674 | # define putenv _putenv
|
---|
5675 | #elif defined __CYGWIN__
|
---|
5676 | # define HAVE_SETENV
|
---|
5677 | # define FOPEN_WB "wb"
|
---|
5678 | /* #elif defined other platforms ... */
|
---|
5679 | #endif
|
---|
5680 |
|
---|
5681 | #if defined PATH_MAX
|
---|
5682 | # define LT_PATHMAX PATH_MAX
|
---|
5683 | #elif defined MAXPATHLEN
|
---|
5684 | # define LT_PATHMAX MAXPATHLEN
|
---|
5685 | #else
|
---|
5686 | # define LT_PATHMAX 1024
|
---|
5687 | #endif
|
---|
5688 |
|
---|
5689 | #ifndef S_IXOTH
|
---|
5690 | # define S_IXOTH 0
|
---|
5691 | #endif
|
---|
5692 | #ifndef S_IXGRP
|
---|
5693 | # define S_IXGRP 0
|
---|
5694 | #endif
|
---|
5695 |
|
---|
5696 | /* path handling portability macros */
|
---|
5697 | #ifndef DIR_SEPARATOR
|
---|
5698 | # define DIR_SEPARATOR '/'
|
---|
5699 | # define PATH_SEPARATOR ':'
|
---|
5700 | #endif
|
---|
5701 |
|
---|
5702 | #if defined _WIN32 || defined __MSDOS__ || defined __DJGPP__ || \
|
---|
5703 | defined __OS2__
|
---|
5704 | # define HAVE_DOS_BASED_FILE_SYSTEM
|
---|
5705 | # define FOPEN_WB "wb"
|
---|
5706 | # ifndef DIR_SEPARATOR_2
|
---|
5707 | # define DIR_SEPARATOR_2 '\\'
|
---|
5708 | # endif
|
---|
5709 | # ifndef PATH_SEPARATOR_2
|
---|
5710 | # define PATH_SEPARATOR_2 ';'
|
---|
5711 | # endif
|
---|
5712 | #endif
|
---|
5713 |
|
---|
5714 | #ifndef DIR_SEPARATOR_2
|
---|
5715 | # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
|
---|
5716 | #else /* DIR_SEPARATOR_2 */
|
---|
5717 | # define IS_DIR_SEPARATOR(ch) \
|
---|
5718 | (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
|
---|
5719 | #endif /* DIR_SEPARATOR_2 */
|
---|
5720 |
|
---|
5721 | #ifndef PATH_SEPARATOR_2
|
---|
5722 | # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
|
---|
5723 | #else /* PATH_SEPARATOR_2 */
|
---|
5724 | # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
|
---|
5725 | #endif /* PATH_SEPARATOR_2 */
|
---|
5726 |
|
---|
5727 | #ifndef FOPEN_WB
|
---|
5728 | # define FOPEN_WB "w"
|
---|
5729 | #endif
|
---|
5730 | #ifndef _O_BINARY
|
---|
5731 | # define _O_BINARY 0
|
---|
5732 | #endif
|
---|
5733 |
|
---|
5734 | #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
|
---|
5735 | #define XFREE(stale) do { \
|
---|
5736 | if (stale) { free (stale); stale = 0; } \
|
---|
5737 | } while (0)
|
---|
5738 |
|
---|
5739 | #if defined LT_DEBUGWRAPPER
|
---|
5740 | static int lt_debug = 1;
|
---|
5741 | #else
|
---|
5742 | static int lt_debug = 0;
|
---|
5743 | #endif
|
---|
5744 |
|
---|
5745 | const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
|
---|
5746 |
|
---|
5747 | void *xmalloc (size_t num);
|
---|
5748 | char *xstrdup (const char *string);
|
---|
5749 | const char *base_name (const char *name);
|
---|
5750 | char *find_executable (const char *wrapper);
|
---|
5751 | char *chase_symlinks (const char *pathspec);
|
---|
5752 | int make_executable (const char *path);
|
---|
5753 | int check_executable (const char *path);
|
---|
5754 | char *strendzap (char *str, const char *pat);
|
---|
5755 | void lt_debugprintf (const char *file, int line, const char *fmt, ...);
|
---|
5756 | void lt_fatal (const char *file, int line, const char *message, ...);
|
---|
5757 | static const char *nonnull (const char *s);
|
---|
5758 | static const char *nonempty (const char *s);
|
---|
5759 | void lt_setenv (const char *name, const char *value);
|
---|
5760 | char *lt_extend_str (const char *orig_value, const char *add, int to_end);
|
---|
5761 | void lt_update_exe_path (const char *name, const char *value);
|
---|
5762 | void lt_update_lib_path (const char *name, const char *value);
|
---|
5763 | char **prepare_spawn (char **argv);
|
---|
5764 | void lt_dump_script (FILE *f);
|
---|
5765 | EOF
|
---|
5766 |
|
---|
5767 | cat <<EOF
|
---|
5768 | #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5)
|
---|
5769 | # define externally_visible volatile
|
---|
5770 | #else
|
---|
5771 | # define externally_visible __attribute__((externally_visible)) volatile
|
---|
5772 | #endif
|
---|
5773 | externally_visible const char * MAGIC_EXE = "$magic_exe";
|
---|
5774 | const char * LIB_PATH_VARNAME = "$shlibpath_var";
|
---|
5775 | EOF
|
---|
5776 |
|
---|
5777 | if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
|
---|
5778 | func_to_host_path "$temp_rpath"
|
---|
5779 | cat <<EOF
|
---|
5780 | const char * LIB_PATH_VALUE = "$func_to_host_path_result";
|
---|
5781 | EOF
|
---|
5782 | else
|
---|
5783 | cat <<"EOF"
|
---|
5784 | const char * LIB_PATH_VALUE = "";
|
---|
5785 | EOF
|
---|
5786 | fi
|
---|
5787 |
|
---|
5788 | if test -n "$dllsearchpath"; then
|
---|
5789 | func_to_host_path "$dllsearchpath:"
|
---|
5790 | cat <<EOF
|
---|
5791 | const char * EXE_PATH_VARNAME = "PATH";
|
---|
5792 | const char * EXE_PATH_VALUE = "$func_to_host_path_result";
|
---|
5793 | EOF
|
---|
5794 | else
|
---|
5795 | cat <<"EOF"
|
---|
5796 | const char * EXE_PATH_VARNAME = "";
|
---|
5797 | const char * EXE_PATH_VALUE = "";
|
---|
5798 | EOF
|
---|
5799 | fi
|
---|
5800 |
|
---|
5801 | if test yes = "$fast_install"; then
|
---|
5802 | cat <<EOF
|
---|
5803 | const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
|
---|
5804 | EOF
|
---|
5805 | else
|
---|
5806 | cat <<EOF
|
---|
5807 | const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
|
---|
5808 | EOF
|
---|
5809 | fi
|
---|
5810 |
|
---|
5811 |
|
---|
5812 | cat <<"EOF"
|
---|
5813 |
|
---|
5814 | #define LTWRAPPER_OPTION_PREFIX "--lt-"
|
---|
5815 |
|
---|
5816 | static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
|
---|
5817 | static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
|
---|
5818 | static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug";
|
---|
5819 |
|
---|
5820 | int
|
---|
5821 | main (int argc, char *argv[])
|
---|
5822 | {
|
---|
5823 | char **newargz;
|
---|
5824 | int newargc;
|
---|
5825 | char *tmp_pathspec;
|
---|
5826 | char *actual_cwrapper_path;
|
---|
5827 | char *actual_cwrapper_name;
|
---|
5828 | char *target_name;
|
---|
5829 | char *lt_argv_zero;
|
---|
5830 | int rval = 127;
|
---|
5831 |
|
---|
5832 | int i;
|
---|
5833 |
|
---|
5834 | program_name = (char *) xstrdup (base_name (argv[0]));
|
---|
5835 | newargz = XMALLOC (char *, (size_t) argc + 1);
|
---|
5836 |
|
---|
5837 | /* very simple arg parsing; don't want to rely on getopt
|
---|
5838 | * also, copy all non cwrapper options to newargz, except
|
---|
5839 | * argz[0], which is handled differently
|
---|
5840 | */
|
---|
5841 | newargc=0;
|
---|
5842 | for (i = 1; i < argc; i++)
|
---|
5843 | {
|
---|
5844 | if (STREQ (argv[i], dumpscript_opt))
|
---|
5845 | {
|
---|
5846 | EOF
|
---|
5847 | case $host in
|
---|
5848 | *mingw* | *cygwin* )
|
---|
5849 | # make stdout use "unix" line endings
|
---|
5850 | echo " setmode(1,_O_BINARY);"
|
---|
5851 | ;;
|
---|
5852 | esac
|
---|
5853 |
|
---|
5854 | cat <<"EOF"
|
---|
5855 | lt_dump_script (stdout);
|
---|
5856 | return 0;
|
---|
5857 | }
|
---|
5858 | if (STREQ (argv[i], debug_opt))
|
---|
5859 | {
|
---|
5860 | lt_debug = 1;
|
---|
5861 | continue;
|
---|
5862 | }
|
---|
5863 | if (STREQ (argv[i], ltwrapper_option_prefix))
|
---|
5864 | {
|
---|
5865 | /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
|
---|
5866 | namespace, but it is not one of the ones we know about and
|
---|
5867 | have already dealt with, above (inluding dump-script), then
|
---|
5868 | report an error. Otherwise, targets might begin to believe
|
---|
5869 | they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
|
---|
5870 | namespace. The first time any user complains about this, we'll
|
---|
5871 | need to make LTWRAPPER_OPTION_PREFIX a configure-time option
|
---|
5872 | or a configure.ac-settable value.
|
---|
5873 | */
|
---|
5874 | lt_fatal (__FILE__, __LINE__,
|
---|
5875 | "unrecognized %s option: '%s'",
|
---|
5876 | ltwrapper_option_prefix, argv[i]);
|
---|
5877 | }
|
---|
5878 | /* otherwise ... */
|
---|
5879 | newargz[++newargc] = xstrdup (argv[i]);
|
---|
5880 | }
|
---|
5881 | newargz[++newargc] = NULL;
|
---|
5882 |
|
---|
5883 | EOF
|
---|
5884 | cat <<EOF
|
---|
5885 | /* The GNU banner must be the first non-error debug message */
|
---|
5886 | lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE) $VERSION\n");
|
---|
5887 | EOF
|
---|
5888 | cat <<"EOF"
|
---|
5889 | lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
|
---|
5890 | lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
|
---|
5891 |
|
---|
5892 | tmp_pathspec = find_executable (argv[0]);
|
---|
5893 | if (tmp_pathspec == NULL)
|
---|
5894 | lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
|
---|
5895 | lt_debugprintf (__FILE__, __LINE__,
|
---|
5896 | "(main) found exe (before symlink chase) at: %s\n",
|
---|
5897 | tmp_pathspec);
|
---|
5898 |
|
---|
5899 | actual_cwrapper_path = chase_symlinks (tmp_pathspec);
|
---|
5900 | lt_debugprintf (__FILE__, __LINE__,
|
---|
5901 | "(main) found exe (after symlink chase) at: %s\n",
|
---|
5902 | actual_cwrapper_path);
|
---|
5903 | XFREE (tmp_pathspec);
|
---|
5904 |
|
---|
5905 | actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
|
---|
5906 | strendzap (actual_cwrapper_path, actual_cwrapper_name);
|
---|
5907 |
|
---|
5908 | /* wrapper name transforms */
|
---|
5909 | strendzap (actual_cwrapper_name, ".exe");
|
---|
5910 | tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
|
---|
5911 | XFREE (actual_cwrapper_name);
|
---|
5912 | actual_cwrapper_name = tmp_pathspec;
|
---|
5913 | tmp_pathspec = 0;
|
---|
5914 |
|
---|
5915 | /* target_name transforms -- use actual target program name; might have lt- prefix */
|
---|
5916 | target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
|
---|
5917 | strendzap (target_name, ".exe");
|
---|
5918 | tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
|
---|
5919 | XFREE (target_name);
|
---|
5920 | target_name = tmp_pathspec;
|
---|
5921 | tmp_pathspec = 0;
|
---|
5922 |
|
---|
5923 | lt_debugprintf (__FILE__, __LINE__,
|
---|
5924 | "(main) libtool target name: %s\n",
|
---|
5925 | target_name);
|
---|
5926 | EOF
|
---|
5927 |
|
---|
5928 | cat <<EOF
|
---|
5929 | newargz[0] =
|
---|
5930 | XMALLOC (char, (strlen (actual_cwrapper_path) +
|
---|
5931 | strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
|
---|
5932 | strcpy (newargz[0], actual_cwrapper_path);
|
---|
5933 | strcat (newargz[0], "$objdir");
|
---|
5934 | strcat (newargz[0], "/");
|
---|
5935 | EOF
|
---|
5936 |
|
---|
5937 | cat <<"EOF"
|
---|
5938 | /* stop here, and copy so we don't have to do this twice */
|
---|
5939 | tmp_pathspec = xstrdup (newargz[0]);
|
---|
5940 |
|
---|
5941 | /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
|
---|
5942 | strcat (newargz[0], actual_cwrapper_name);
|
---|
5943 |
|
---|
5944 | /* DO want the lt- prefix here if it exists, so use target_name */
|
---|
5945 | lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
|
---|
5946 | XFREE (tmp_pathspec);
|
---|
5947 | tmp_pathspec = NULL;
|
---|
5948 | EOF
|
---|
5949 |
|
---|
5950 | case $host_os in
|
---|
5951 | mingw*)
|
---|
5952 | cat <<"EOF"
|
---|
5953 | {
|
---|
5954 | char* p;
|
---|
5955 | while ((p = strchr (newargz[0], '\\')) != NULL)
|
---|
5956 | {
|
---|
5957 | *p = '/';
|
---|
5958 | }
|
---|
5959 | while ((p = strchr (lt_argv_zero, '\\')) != NULL)
|
---|
5960 | {
|
---|
5961 | *p = '/';
|
---|
5962 | }
|
---|
5963 | }
|
---|
5964 | EOF
|
---|
5965 | ;;
|
---|
5966 | esac
|
---|
5967 |
|
---|
5968 | cat <<"EOF"
|
---|
5969 | XFREE (target_name);
|
---|
5970 | XFREE (actual_cwrapper_path);
|
---|
5971 | XFREE (actual_cwrapper_name);
|
---|
5972 |
|
---|
5973 | lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
|
---|
5974 | lt_setenv ("DUALCASE", "1"); /* for MSK sh */
|
---|
5975 | /* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must
|
---|
5976 | be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
|
---|
5977 | because on Windows, both *_VARNAMEs are PATH but uninstalled
|
---|
5978 | libraries must come first. */
|
---|
5979 | lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
|
---|
5980 | lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
|
---|
5981 |
|
---|
5982 | lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
|
---|
5983 | nonnull (lt_argv_zero));
|
---|
5984 | for (i = 0; i < newargc; i++)
|
---|
5985 | {
|
---|
5986 | lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
|
---|
5987 | i, nonnull (newargz[i]));
|
---|
5988 | }
|
---|
5989 |
|
---|
5990 | EOF
|
---|
5991 |
|
---|
5992 | case $host_os in
|
---|
5993 | mingw*)
|
---|
5994 | cat <<"EOF"
|
---|
5995 | /* execv doesn't actually work on mingw as expected on unix */
|
---|
5996 | newargz = prepare_spawn (newargz);
|
---|
5997 | rval = (int) _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
|
---|
5998 | if (rval == -1)
|
---|
5999 | {
|
---|
6000 | /* failed to start process */
|
---|
6001 | lt_debugprintf (__FILE__, __LINE__,
|
---|
6002 | "(main) failed to launch target \"%s\": %s\n",
|
---|
6003 | lt_argv_zero, nonnull (strerror (errno)));
|
---|
6004 | return 127;
|
---|
6005 | }
|
---|
6006 | return rval;
|
---|
6007 | EOF
|
---|
6008 | ;;
|
---|
6009 | *)
|
---|
6010 | cat <<"EOF"
|
---|
6011 | execv (lt_argv_zero, newargz);
|
---|
6012 | return rval; /* =127, but avoids unused variable warning */
|
---|
6013 | EOF
|
---|
6014 | ;;
|
---|
6015 | esac
|
---|
6016 |
|
---|
6017 | cat <<"EOF"
|
---|
6018 | }
|
---|
6019 |
|
---|
6020 | void *
|
---|
6021 | xmalloc (size_t num)
|
---|
6022 | {
|
---|
6023 | void *p = (void *) malloc (num);
|
---|
6024 | if (!p)
|
---|
6025 | lt_fatal (__FILE__, __LINE__, "memory exhausted");
|
---|
6026 |
|
---|
6027 | return p;
|
---|
6028 | }
|
---|
6029 |
|
---|
6030 | char *
|
---|
6031 | xstrdup (const char *string)
|
---|
6032 | {
|
---|
6033 | return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
|
---|
6034 | string) : NULL;
|
---|
6035 | }
|
---|
6036 |
|
---|
6037 | const char *
|
---|
6038 | base_name (const char *name)
|
---|
6039 | {
|
---|
6040 | const char *base;
|
---|
6041 |
|
---|
6042 | #if defined HAVE_DOS_BASED_FILE_SYSTEM
|
---|
6043 | /* Skip over the disk name in MSDOS pathnames. */
|
---|
6044 | if (isalpha ((unsigned char) name[0]) && name[1] == ':')
|
---|
6045 | name += 2;
|
---|
6046 | #endif
|
---|
6047 |
|
---|
6048 | for (base = name; *name; name++)
|
---|
6049 | if (IS_DIR_SEPARATOR (*name))
|
---|
6050 | base = name + 1;
|
---|
6051 | return base;
|
---|
6052 | }
|
---|
6053 |
|
---|
6054 | int
|
---|
6055 | check_executable (const char *path)
|
---|
6056 | {
|
---|
6057 | struct stat st;
|
---|
6058 |
|
---|
6059 | lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
|
---|
6060 | nonempty (path));
|
---|
6061 | if ((!path) || (!*path))
|
---|
6062 | return 0;
|
---|
6063 |
|
---|
6064 | if ((stat (path, &st) >= 0)
|
---|
6065 | && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
|
---|
6066 | return 1;
|
---|
6067 | else
|
---|
6068 | return 0;
|
---|
6069 | }
|
---|
6070 |
|
---|
6071 | int
|
---|
6072 | make_executable (const char *path)
|
---|
6073 | {
|
---|
6074 | int rval = 0;
|
---|
6075 | struct stat st;
|
---|
6076 |
|
---|
6077 | lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
|
---|
6078 | nonempty (path));
|
---|
6079 | if ((!path) || (!*path))
|
---|
6080 | return 0;
|
---|
6081 |
|
---|
6082 | if (stat (path, &st) >= 0)
|
---|
6083 | {
|
---|
6084 | rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
|
---|
6085 | }
|
---|
6086 | return rval;
|
---|
6087 | }
|
---|
6088 |
|
---|
6089 | /* Searches for the full path of the wrapper. Returns
|
---|
6090 | newly allocated full path name if found, NULL otherwise
|
---|
6091 | Does not chase symlinks, even on platforms that support them.
|
---|
6092 | */
|
---|
6093 | char *
|
---|
6094 | find_executable (const char *wrapper)
|
---|
6095 | {
|
---|
6096 | int has_slash = 0;
|
---|
6097 | const char *p;
|
---|
6098 | const char *p_next;
|
---|
6099 | /* static buffer for getcwd */
|
---|
6100 | char tmp[LT_PATHMAX + 1];
|
---|
6101 | size_t tmp_len;
|
---|
6102 | char *concat_name;
|
---|
6103 |
|
---|
6104 | lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
|
---|
6105 | nonempty (wrapper));
|
---|
6106 |
|
---|
6107 | if ((wrapper == NULL) || (*wrapper == '\0'))
|
---|
6108 | return NULL;
|
---|
6109 |
|
---|
6110 | /* Absolute path? */
|
---|
6111 | #if defined HAVE_DOS_BASED_FILE_SYSTEM
|
---|
6112 | if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
|
---|
6113 | {
|
---|
6114 | concat_name = xstrdup (wrapper);
|
---|
6115 | if (check_executable (concat_name))
|
---|
6116 | return concat_name;
|
---|
6117 | XFREE (concat_name);
|
---|
6118 | }
|
---|
6119 | else
|
---|
6120 | {
|
---|
6121 | #endif
|
---|
6122 | if (IS_DIR_SEPARATOR (wrapper[0]))
|
---|
6123 | {
|
---|
6124 | concat_name = xstrdup (wrapper);
|
---|
6125 | if (check_executable (concat_name))
|
---|
6126 | return concat_name;
|
---|
6127 | XFREE (concat_name);
|
---|
6128 | }
|
---|
6129 | #if defined HAVE_DOS_BASED_FILE_SYSTEM
|
---|
6130 | }
|
---|
6131 | #endif
|
---|
6132 |
|
---|
6133 | for (p = wrapper; *p; p++)
|
---|
6134 | if (*p == '/')
|
---|
6135 | {
|
---|
6136 | has_slash = 1;
|
---|
6137 | break;
|
---|
6138 | }
|
---|
6139 | if (!has_slash)
|
---|
6140 | {
|
---|
6141 | /* no slashes; search PATH */
|
---|
6142 | const char *path = getenv ("PATH");
|
---|
6143 | if (path != NULL)
|
---|
6144 | {
|
---|
6145 | for (p = path; *p; p = p_next)
|
---|
6146 | {
|
---|
6147 | const char *q;
|
---|
6148 | size_t p_len;
|
---|
6149 | for (q = p; *q; q++)
|
---|
6150 | if (IS_PATH_SEPARATOR (*q))
|
---|
6151 | break;
|
---|
6152 | p_len = (size_t) (q - p);
|
---|
6153 | p_next = (*q == '\0' ? q : q + 1);
|
---|
6154 | if (p_len == 0)
|
---|
6155 | {
|
---|
6156 | /* empty path: current directory */
|
---|
6157 | if (getcwd (tmp, LT_PATHMAX) == NULL)
|
---|
6158 | lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
|
---|
6159 | nonnull (strerror (errno)));
|
---|
6160 | tmp_len = strlen (tmp);
|
---|
6161 | concat_name =
|
---|
6162 | XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
|
---|
6163 | memcpy (concat_name, tmp, tmp_len);
|
---|
6164 | concat_name[tmp_len] = '/';
|
---|
6165 | strcpy (concat_name + tmp_len + 1, wrapper);
|
---|
6166 | }
|
---|
6167 | else
|
---|
6168 | {
|
---|
6169 | concat_name =
|
---|
6170 | XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
|
---|
6171 | memcpy (concat_name, p, p_len);
|
---|
6172 | concat_name[p_len] = '/';
|
---|
6173 | strcpy (concat_name + p_len + 1, wrapper);
|
---|
6174 | }
|
---|
6175 | if (check_executable (concat_name))
|
---|
6176 | return concat_name;
|
---|
6177 | XFREE (concat_name);
|
---|
6178 | }
|
---|
6179 | }
|
---|
6180 | /* not found in PATH; assume curdir */
|
---|
6181 | }
|
---|
6182 | /* Relative path | not found in path: prepend cwd */
|
---|
6183 | if (getcwd (tmp, LT_PATHMAX) == NULL)
|
---|
6184 | lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
|
---|
6185 | nonnull (strerror (errno)));
|
---|
6186 | tmp_len = strlen (tmp);
|
---|
6187 | concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
|
---|
6188 | memcpy (concat_name, tmp, tmp_len);
|
---|
6189 | concat_name[tmp_len] = '/';
|
---|
6190 | strcpy (concat_name + tmp_len + 1, wrapper);
|
---|
6191 |
|
---|
6192 | if (check_executable (concat_name))
|
---|
6193 | return concat_name;
|
---|
6194 | XFREE (concat_name);
|
---|
6195 | return NULL;
|
---|
6196 | }
|
---|
6197 |
|
---|
6198 | char *
|
---|
6199 | chase_symlinks (const char *pathspec)
|
---|
6200 | {
|
---|
6201 | #ifndef S_ISLNK
|
---|
6202 | return xstrdup (pathspec);
|
---|
6203 | #else
|
---|
6204 | char buf[LT_PATHMAX];
|
---|
6205 | struct stat s;
|
---|
6206 | char *tmp_pathspec = xstrdup (pathspec);
|
---|
6207 | char *p;
|
---|
6208 | int has_symlinks = 0;
|
---|
6209 | while (strlen (tmp_pathspec) && !has_symlinks)
|
---|
6210 | {
|
---|
6211 | lt_debugprintf (__FILE__, __LINE__,
|
---|
6212 | "checking path component for symlinks: %s\n",
|
---|
6213 | tmp_pathspec);
|
---|
6214 | if (lstat (tmp_pathspec, &s) == 0)
|
---|
6215 | {
|
---|
6216 | if (S_ISLNK (s.st_mode) != 0)
|
---|
6217 | {
|
---|
6218 | has_symlinks = 1;
|
---|
6219 | break;
|
---|
6220 | }
|
---|
6221 |
|
---|
6222 | /* search backwards for last DIR_SEPARATOR */
|
---|
6223 | p = tmp_pathspec + strlen (tmp_pathspec) - 1;
|
---|
6224 | while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
|
---|
6225 | p--;
|
---|
6226 | if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
|
---|
6227 | {
|
---|
6228 | /* no more DIR_SEPARATORS left */
|
---|
6229 | break;
|
---|
6230 | }
|
---|
6231 | *p = '\0';
|
---|
6232 | }
|
---|
6233 | else
|
---|
6234 | {
|
---|
6235 | lt_fatal (__FILE__, __LINE__,
|
---|
6236 | "error accessing file \"%s\": %s",
|
---|
6237 | tmp_pathspec, nonnull (strerror (errno)));
|
---|
6238 | }
|
---|
6239 | }
|
---|
6240 | XFREE (tmp_pathspec);
|
---|
6241 |
|
---|
6242 | if (!has_symlinks)
|
---|
6243 | {
|
---|
6244 | return xstrdup (pathspec);
|
---|
6245 | }
|
---|
6246 |
|
---|
6247 | tmp_pathspec = realpath (pathspec, buf);
|
---|
6248 | if (tmp_pathspec == 0)
|
---|
6249 | {
|
---|
6250 | lt_fatal (__FILE__, __LINE__,
|
---|
6251 | "could not follow symlinks for %s", pathspec);
|
---|
6252 | }
|
---|
6253 | return xstrdup (tmp_pathspec);
|
---|
6254 | #endif
|
---|
6255 | }
|
---|
6256 |
|
---|
6257 | char *
|
---|
6258 | strendzap (char *str, const char *pat)
|
---|
6259 | {
|
---|
6260 | size_t len, patlen;
|
---|
6261 |
|
---|
6262 | assert (str != NULL);
|
---|
6263 | assert (pat != NULL);
|
---|
6264 |
|
---|
6265 | len = strlen (str);
|
---|
6266 | patlen = strlen (pat);
|
---|
6267 |
|
---|
6268 | if (patlen <= len)
|
---|
6269 | {
|
---|
6270 | str += len - patlen;
|
---|
6271 | if (STREQ (str, pat))
|
---|
6272 | *str = '\0';
|
---|
6273 | }
|
---|
6274 | return str;
|
---|
6275 | }
|
---|
6276 |
|
---|
6277 | void
|
---|
6278 | lt_debugprintf (const char *file, int line, const char *fmt, ...)
|
---|
6279 | {
|
---|
6280 | va_list args;
|
---|
6281 | if (lt_debug)
|
---|
6282 | {
|
---|
6283 | (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
|
---|
6284 | va_start (args, fmt);
|
---|
6285 | (void) vfprintf (stderr, fmt, args);
|
---|
6286 | va_end (args);
|
---|
6287 | }
|
---|
6288 | }
|
---|
6289 |
|
---|
6290 | static void
|
---|
6291 | lt_error_core (int exit_status, const char *file,
|
---|
6292 | int line, const char *mode,
|
---|
6293 | const char *message, va_list ap)
|
---|
6294 | {
|
---|
6295 | fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
|
---|
6296 | vfprintf (stderr, message, ap);
|
---|
6297 | fprintf (stderr, ".\n");
|
---|
6298 |
|
---|
6299 | if (exit_status >= 0)
|
---|
6300 | exit (exit_status);
|
---|
6301 | }
|
---|
6302 |
|
---|
6303 | void
|
---|
6304 | lt_fatal (const char *file, int line, const char *message, ...)
|
---|
6305 | {
|
---|
6306 | va_list ap;
|
---|
6307 | va_start (ap, message);
|
---|
6308 | lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
|
---|
6309 | va_end (ap);
|
---|
6310 | }
|
---|
6311 |
|
---|
6312 | static const char *
|
---|
6313 | nonnull (const char *s)
|
---|
6314 | {
|
---|
6315 | return s ? s : "(null)";
|
---|
6316 | }
|
---|
6317 |
|
---|
6318 | static const char *
|
---|
6319 | nonempty (const char *s)
|
---|
6320 | {
|
---|
6321 | return (s && !*s) ? "(empty)" : nonnull (s);
|
---|
6322 | }
|
---|
6323 |
|
---|
6324 | void
|
---|
6325 | lt_setenv (const char *name, const char *value)
|
---|
6326 | {
|
---|
6327 | lt_debugprintf (__FILE__, __LINE__,
|
---|
6328 | "(lt_setenv) setting '%s' to '%s'\n",
|
---|
6329 | nonnull (name), nonnull (value));
|
---|
6330 | {
|
---|
6331 | #ifdef HAVE_SETENV
|
---|
6332 | /* always make a copy, for consistency with !HAVE_SETENV */
|
---|
6333 | char *str = xstrdup (value);
|
---|
6334 | setenv (name, str, 1);
|
---|
6335 | #else
|
---|
6336 | size_t len = strlen (name) + 1 + strlen (value) + 1;
|
---|
6337 | char *str = XMALLOC (char, len);
|
---|
6338 | sprintf (str, "%s=%s", name, value);
|
---|
6339 | if (putenv (str) != EXIT_SUCCESS)
|
---|
6340 | {
|
---|
6341 | XFREE (str);
|
---|
6342 | }
|
---|
6343 | #endif
|
---|
6344 | }
|
---|
6345 | }
|
---|
6346 |
|
---|
6347 | char *
|
---|
6348 | lt_extend_str (const char *orig_value, const char *add, int to_end)
|
---|
6349 | {
|
---|
6350 | char *new_value;
|
---|
6351 | if (orig_value && *orig_value)
|
---|
6352 | {
|
---|
6353 | size_t orig_value_len = strlen (orig_value);
|
---|
6354 | size_t add_len = strlen (add);
|
---|
6355 | new_value = XMALLOC (char, add_len + orig_value_len + 1);
|
---|
6356 | if (to_end)
|
---|
6357 | {
|
---|
6358 | strcpy (new_value, orig_value);
|
---|
6359 | strcpy (new_value + orig_value_len, add);
|
---|
6360 | }
|
---|
6361 | else
|
---|
6362 | {
|
---|
6363 | strcpy (new_value, add);
|
---|
6364 | strcpy (new_value + add_len, orig_value);
|
---|
6365 | }
|
---|
6366 | }
|
---|
6367 | else
|
---|
6368 | {
|
---|
6369 | new_value = xstrdup (add);
|
---|
6370 | }
|
---|
6371 | return new_value;
|
---|
6372 | }
|
---|
6373 |
|
---|
6374 | void
|
---|
6375 | lt_update_exe_path (const char *name, const char *value)
|
---|
6376 | {
|
---|
6377 | lt_debugprintf (__FILE__, __LINE__,
|
---|
6378 | "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
|
---|
6379 | nonnull (name), nonnull (value));
|
---|
6380 |
|
---|
6381 | if (name && *name && value && *value)
|
---|
6382 | {
|
---|
6383 | char *new_value = lt_extend_str (getenv (name), value, 0);
|
---|
6384 | /* some systems can't cope with a ':'-terminated path #' */
|
---|
6385 | size_t len = strlen (new_value);
|
---|
6386 | while ((len > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
|
---|
6387 | {
|
---|
6388 | new_value[--len] = '\0';
|
---|
6389 | }
|
---|
6390 | lt_setenv (name, new_value);
|
---|
6391 | XFREE (new_value);
|
---|
6392 | }
|
---|
6393 | }
|
---|
6394 |
|
---|
6395 | void
|
---|
6396 | lt_update_lib_path (const char *name, const char *value)
|
---|
6397 | {
|
---|
6398 | lt_debugprintf (__FILE__, __LINE__,
|
---|
6399 | "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
|
---|
6400 | nonnull (name), nonnull (value));
|
---|
6401 |
|
---|
6402 | if (name && *name && value && *value)
|
---|
6403 | {
|
---|
6404 | char *new_value = lt_extend_str (getenv (name), value, 0);
|
---|
6405 | lt_setenv (name, new_value);
|
---|
6406 | XFREE (new_value);
|
---|
6407 | }
|
---|
6408 | }
|
---|
6409 |
|
---|
6410 | EOF
|
---|
6411 | case $host_os in
|
---|
6412 | mingw*)
|
---|
6413 | cat <<"EOF"
|
---|
6414 |
|
---|
6415 | /* Prepares an argument vector before calling spawn().
|
---|
6416 | Note that spawn() does not by itself call the command interpreter
|
---|
6417 | (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
|
---|
6418 | ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
|
---|
6419 | GetVersionEx(&v);
|
---|
6420 | v.dwPlatformId == VER_PLATFORM_WIN32_NT;
|
---|
6421 | }) ? "cmd.exe" : "command.com").
|
---|
6422 | Instead it simply concatenates the arguments, separated by ' ', and calls
|
---|
6423 | CreateProcess(). We must quote the arguments since Win32 CreateProcess()
|
---|
6424 | interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
|
---|
6425 | special way:
|
---|
6426 | - Space and tab are interpreted as delimiters. They are not treated as
|
---|
6427 | delimiters if they are surrounded by double quotes: "...".
|
---|
6428 | - Unescaped double quotes are removed from the input. Their only effect is
|
---|
6429 | that within double quotes, space and tab are treated like normal
|
---|
6430 | characters.
|
---|
6431 | - Backslashes not followed by double quotes are not special.
|
---|
6432 | - But 2*n+1 backslashes followed by a double quote become
|
---|
6433 | n backslashes followed by a double quote (n >= 0):
|
---|
6434 | \" -> "
|
---|
6435 | \\\" -> \"
|
---|
6436 | \\\\\" -> \\"
|
---|
6437 | */
|
---|
6438 | #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"
|
---|
6439 | #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"
|
---|
6440 | char **
|
---|
6441 | prepare_spawn (char **argv)
|
---|
6442 | {
|
---|
6443 | size_t argc;
|
---|
6444 | char **new_argv;
|
---|
6445 | size_t i;
|
---|
6446 |
|
---|
6447 | /* Count number of arguments. */
|
---|
6448 | for (argc = 0; argv[argc] != NULL; argc++)
|
---|
6449 | ;
|
---|
6450 |
|
---|
6451 | /* Allocate new argument vector. */
|
---|
6452 | new_argv = XMALLOC (char *, argc + 1);
|
---|
6453 |
|
---|
6454 | /* Put quoted arguments into the new argument vector. */
|
---|
6455 | for (i = 0; i < argc; i++)
|
---|
6456 | {
|
---|
6457 | const char *string = argv[i];
|
---|
6458 |
|
---|
6459 | if (string[0] == '\0')
|
---|
6460 | new_argv[i] = xstrdup ("\"\"");
|
---|
6461 | else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
|
---|
6462 | {
|
---|
6463 | int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
|
---|
6464 | size_t length;
|
---|
6465 | unsigned int backslashes;
|
---|
6466 | const char *s;
|
---|
6467 | char *quoted_string;
|
---|
6468 | char *p;
|
---|
6469 |
|
---|
6470 | length = 0;
|
---|
6471 | backslashes = 0;
|
---|
6472 | if (quote_around)
|
---|
6473 | length++;
|
---|
6474 | for (s = string; *s != '\0'; s++)
|
---|
6475 | {
|
---|
6476 | char c = *s;
|
---|
6477 | if (c == '"')
|
---|
6478 | length += backslashes + 1;
|
---|
6479 | length++;
|
---|
6480 | if (c == '\\')
|
---|
6481 | backslashes++;
|
---|
6482 | else
|
---|
6483 | backslashes = 0;
|
---|
6484 | }
|
---|
6485 | if (quote_around)
|
---|
6486 | length += backslashes + 1;
|
---|
6487 |
|
---|
6488 | quoted_string = XMALLOC (char, length + 1);
|
---|
6489 |
|
---|
6490 | p = quoted_string;
|
---|
6491 | backslashes = 0;
|
---|
6492 | if (quote_around)
|
---|
6493 | *p++ = '"';
|
---|
6494 | for (s = string; *s != '\0'; s++)
|
---|
6495 | {
|
---|
6496 | char c = *s;
|
---|
6497 | if (c == '"')
|
---|
6498 | {
|
---|
6499 | unsigned int j;
|
---|
6500 | for (j = backslashes + 1; j > 0; j--)
|
---|
6501 | *p++ = '\\';
|
---|
6502 | }
|
---|
6503 | *p++ = c;
|
---|
6504 | if (c == '\\')
|
---|
6505 | backslashes++;
|
---|
6506 | else
|
---|
6507 | backslashes = 0;
|
---|
6508 | }
|
---|
6509 | if (quote_around)
|
---|
6510 | {
|
---|
6511 | unsigned int j;
|
---|
6512 | for (j = backslashes; j > 0; j--)
|
---|
6513 | *p++ = '\\';
|
---|
6514 | *p++ = '"';
|
---|
6515 | }
|
---|
6516 | *p = '\0';
|
---|
6517 |
|
---|
6518 | new_argv[i] = quoted_string;
|
---|
6519 | }
|
---|
6520 | else
|
---|
6521 | new_argv[i] = (char *) string;
|
---|
6522 | }
|
---|
6523 | new_argv[argc] = NULL;
|
---|
6524 |
|
---|
6525 | return new_argv;
|
---|
6526 | }
|
---|
6527 | EOF
|
---|
6528 | ;;
|
---|
6529 | esac
|
---|
6530 |
|
---|
6531 | cat <<"EOF"
|
---|
6532 | void lt_dump_script (FILE* f)
|
---|
6533 | {
|
---|
6534 | EOF
|
---|
6535 | func_emit_wrapper yes |
|
---|
6536 | $SED -n -e '
|
---|
6537 | s/^\(.\{79\}\)\(..*\)/\1\
|
---|
6538 | \2/
|
---|
6539 | h
|
---|
6540 | s/\([\\"]\)/\\\1/g
|
---|
6541 | s/$/\\n/
|
---|
6542 | s/\([^\n]*\).*/ fputs ("\1", f);/p
|
---|
6543 | g
|
---|
6544 | D'
|
---|
6545 | cat <<"EOF"
|
---|
6546 | }
|
---|
6547 | EOF
|
---|
6548 | }
|
---|
6549 | # end: func_emit_cwrapperexe_src
|
---|
6550 |
|
---|
6551 | # func_win32_import_lib_p ARG
|
---|
6552 | # True if ARG is an import lib, as indicated by $file_magic_cmd
|
---|
6553 | func_win32_import_lib_p ()
|
---|
6554 | {
|
---|
6555 | $debug_cmd
|
---|
6556 |
|
---|
6557 | case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
|
---|
6558 | *import*) : ;;
|
---|
6559 | *) false ;;
|
---|
6560 | esac
|
---|
6561 | }
|
---|
6562 |
|
---|
6563 | # func_suncc_cstd_abi
|
---|
6564 | # !!ONLY CALL THIS FOR SUN CC AFTER $compile_command IS FULLY EXPANDED!!
|
---|
6565 | # Several compiler flags select an ABI that is incompatible with the
|
---|
6566 | # Cstd library. Avoid specifying it if any are in CXXFLAGS.
|
---|
6567 | func_suncc_cstd_abi ()
|
---|
6568 | {
|
---|
6569 | $debug_cmd
|
---|
6570 |
|
---|
6571 | case " $compile_command " in
|
---|
6572 | *" -compat=g "*|*\ -std=c++[0-9][0-9]\ *|*" -library=stdcxx4 "*|*" -library=stlport4 "*)
|
---|
6573 | suncc_use_cstd_abi=no
|
---|
6574 | ;;
|
---|
6575 | *)
|
---|
6576 | suncc_use_cstd_abi=yes
|
---|
6577 | ;;
|
---|
6578 | esac
|
---|
6579 | }
|
---|
6580 |
|
---|
6581 | # func_mode_link arg...
|
---|
6582 | func_mode_link ()
|
---|
6583 | {
|
---|
6584 | $debug_cmd
|
---|
6585 |
|
---|
6586 | case $host in
|
---|
6587 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
|
---|
6588 | # It is impossible to link a dll without this setting, and
|
---|
6589 | # we shouldn't force the makefile maintainer to figure out
|
---|
6590 | # what system we are compiling for in order to pass an extra
|
---|
6591 | # flag for every libtool invocation.
|
---|
6592 | # allow_undefined=no
|
---|
6593 |
|
---|
6594 | # FIXME: Unfortunately, there are problems with the above when trying
|
---|
6595 | # to make a dll that has undefined symbols, in which case not
|
---|
6596 | # even a static library is built. For now, we need to specify
|
---|
6597 | # -no-undefined on the libtool link line when we can be certain
|
---|
6598 | # that all symbols are satisfied, otherwise we get a static library.
|
---|
6599 | allow_undefined=yes
|
---|
6600 | ;;
|
---|
6601 | *)
|
---|
6602 | allow_undefined=yes
|
---|
6603 | ;;
|
---|
6604 | esac
|
---|
6605 | libtool_args=$nonopt
|
---|
6606 | base_compile="$nonopt $@"
|
---|
6607 | compile_command=$nonopt
|
---|
6608 | finalize_command=$nonopt
|
---|
6609 |
|
---|
6610 | compile_rpath=
|
---|
6611 | finalize_rpath=
|
---|
6612 | compile_shlibpath=
|
---|
6613 | finalize_shlibpath=
|
---|
6614 | convenience=
|
---|
6615 | old_convenience=
|
---|
6616 | deplibs=
|
---|
6617 | old_deplibs=
|
---|
6618 | compiler_flags=
|
---|
6619 | linker_flags=
|
---|
6620 | dllsearchpath=
|
---|
6621 | lib_search_path=`pwd`
|
---|
6622 | inst_prefix_dir=
|
---|
6623 | new_inherited_linker_flags=
|
---|
6624 |
|
---|
6625 | avoid_version=no
|
---|
6626 | bindir=
|
---|
6627 | dlfiles=
|
---|
6628 | dlprefiles=
|
---|
6629 | dlself=no
|
---|
6630 | export_dynamic=no
|
---|
6631 | export_symbols=
|
---|
6632 | export_symbols_regex=
|
---|
6633 | generated=
|
---|
6634 | libobjs=
|
---|
6635 | ltlibs=
|
---|
6636 | module=no
|
---|
6637 | no_install=no
|
---|
6638 | objs=
|
---|
6639 | os2dllname=
|
---|
6640 | non_pic_objects=
|
---|
6641 | precious_files_regex=
|
---|
6642 | prefer_static_libs=no
|
---|
6643 | preload=false
|
---|
6644 | prev=
|
---|
6645 | prevarg=
|
---|
6646 | release=
|
---|
6647 | rpath=
|
---|
6648 | xrpath=
|
---|
6649 | perm_rpath=
|
---|
6650 | temp_rpath=
|
---|
6651 | thread_safe=no
|
---|
6652 | vinfo=
|
---|
6653 | vinfo_number=no
|
---|
6654 | weak_libs=
|
---|
6655 | single_module=$wl-single_module
|
---|
6656 | func_infer_tag $base_compile
|
---|
6657 |
|
---|
6658 | # We need to know -static, to get the right output filenames.
|
---|
6659 | for arg
|
---|
6660 | do
|
---|
6661 | case $arg in
|
---|
6662 | -shared)
|
---|
6663 | test yes != "$build_libtool_libs" \
|
---|
6664 | && func_fatal_configuration "cannot build a shared library"
|
---|
6665 | build_old_libs=no
|
---|
6666 | break
|
---|
6667 | ;;
|
---|
6668 | -all-static | -static | -static-libtool-libs)
|
---|
6669 | case $arg in
|
---|
6670 | -all-static)
|
---|
6671 | if test yes = "$build_libtool_libs" && test -z "$link_static_flag"; then
|
---|
6672 | func_warning "complete static linking is impossible in this configuration"
|
---|
6673 | fi
|
---|
6674 | if test -n "$link_static_flag"; then
|
---|
6675 | dlopen_self=$dlopen_self_static
|
---|
6676 | fi
|
---|
6677 | prefer_static_libs=yes
|
---|
6678 | ;;
|
---|
6679 | -static)
|
---|
6680 | if test -z "$pic_flag" && test -n "$link_static_flag"; then
|
---|
6681 | dlopen_self=$dlopen_self_static
|
---|
6682 | fi
|
---|
6683 | prefer_static_libs=built
|
---|
6684 | ;;
|
---|
6685 | -static-libtool-libs)
|
---|
6686 | if test -z "$pic_flag" && test -n "$link_static_flag"; then
|
---|
6687 | dlopen_self=$dlopen_self_static
|
---|
6688 | fi
|
---|
6689 | prefer_static_libs=yes
|
---|
6690 | ;;
|
---|
6691 | esac
|
---|
6692 | build_libtool_libs=no
|
---|
6693 | build_old_libs=yes
|
---|
6694 | break
|
---|
6695 | ;;
|
---|
6696 | esac
|
---|
6697 | done
|
---|
6698 |
|
---|
6699 | # See if our shared archives depend on static archives.
|
---|
6700 | test -n "$old_archive_from_new_cmds" && build_old_libs=yes
|
---|
6701 |
|
---|
6702 | # Go through the arguments, transforming them on the way.
|
---|
6703 | while test "$#" -gt 0; do
|
---|
6704 | arg=$1
|
---|
6705 | shift
|
---|
6706 | func_quote_for_eval "$arg"
|
---|
6707 | qarg=$func_quote_for_eval_unquoted_result
|
---|
6708 | func_append libtool_args " $func_quote_for_eval_result"
|
---|
6709 |
|
---|
6710 | # If the previous option needs an argument, assign it.
|
---|
6711 | if test -n "$prev"; then
|
---|
6712 | case $prev in
|
---|
6713 | output)
|
---|
6714 | func_append compile_command " @OUTPUT@"
|
---|
6715 | func_append finalize_command " @OUTPUT@"
|
---|
6716 | ;;
|
---|
6717 | esac
|
---|
6718 |
|
---|
6719 | case $prev in
|
---|
6720 | bindir)
|
---|
6721 | bindir=$arg
|
---|
6722 | prev=
|
---|
6723 | continue
|
---|
6724 | ;;
|
---|
6725 | dlfiles|dlprefiles)
|
---|
6726 | $preload || {
|
---|
6727 | # Add the symbol object into the linking commands.
|
---|
6728 | func_append compile_command " @SYMFILE@"
|
---|
6729 | func_append finalize_command " @SYMFILE@"
|
---|
6730 | preload=:
|
---|
6731 | }
|
---|
6732 | case $arg in
|
---|
6733 | *.la | *.lo) ;; # We handle these cases below.
|
---|
6734 | force)
|
---|
6735 | if test no = "$dlself"; then
|
---|
6736 | dlself=needless
|
---|
6737 | export_dynamic=yes
|
---|
6738 | fi
|
---|
6739 | prev=
|
---|
6740 | continue
|
---|
6741 | ;;
|
---|
6742 | self)
|
---|
6743 | if test dlprefiles = "$prev"; then
|
---|
6744 | dlself=yes
|
---|
6745 | elif test dlfiles = "$prev" && test yes != "$dlopen_self"; then
|
---|
6746 | dlself=yes
|
---|
6747 | else
|
---|
6748 | dlself=needless
|
---|
6749 | export_dynamic=yes
|
---|
6750 | fi
|
---|
6751 | prev=
|
---|
6752 | continue
|
---|
6753 | ;;
|
---|
6754 | *)
|
---|
6755 | if test dlfiles = "$prev"; then
|
---|
6756 | func_append dlfiles " $arg"
|
---|
6757 | else
|
---|
6758 | func_append dlprefiles " $arg"
|
---|
6759 | fi
|
---|
6760 | prev=
|
---|
6761 | continue
|
---|
6762 | ;;
|
---|
6763 | esac
|
---|
6764 | ;;
|
---|
6765 | expsyms)
|
---|
6766 | export_symbols=$arg
|
---|
6767 | test -f "$arg" \
|
---|
6768 | || func_fatal_error "symbol file '$arg' does not exist"
|
---|
6769 | prev=
|
---|
6770 | continue
|
---|
6771 | ;;
|
---|
6772 | expsyms_regex)
|
---|
6773 | export_symbols_regex=$arg
|
---|
6774 | prev=
|
---|
6775 | continue
|
---|
6776 | ;;
|
---|
6777 | framework)
|
---|
6778 | case $host in
|
---|
6779 | *-*-darwin*)
|
---|
6780 | case "$deplibs " in
|
---|
6781 | *" $qarg.ltframework "*) ;;
|
---|
6782 | *) func_append deplibs " $qarg.ltframework" # this is fixed later
|
---|
6783 | ;;
|
---|
6784 | esac
|
---|
6785 | ;;
|
---|
6786 | esac
|
---|
6787 | prev=
|
---|
6788 | continue
|
---|
6789 | ;;
|
---|
6790 | inst_prefix)
|
---|
6791 | inst_prefix_dir=$arg
|
---|
6792 | prev=
|
---|
6793 | continue
|
---|
6794 | ;;
|
---|
6795 | mllvm)
|
---|
6796 | # Clang does not use LLVM to link, so we can simply discard any
|
---|
6797 | # '-mllvm $arg' options when doing the link step.
|
---|
6798 | prev=
|
---|
6799 | continue
|
---|
6800 | ;;
|
---|
6801 | objectlist)
|
---|
6802 | if test -f "$arg"; then
|
---|
6803 | save_arg=$arg
|
---|
6804 | moreargs=
|
---|
6805 | for fil in `cat "$save_arg"`
|
---|
6806 | do
|
---|
6807 | # func_append moreargs " $fil"
|
---|
6808 | arg=$fil
|
---|
6809 | # A libtool-controlled object.
|
---|
6810 |
|
---|
6811 | # Check to see that this really is a libtool object.
|
---|
6812 | if func_lalib_unsafe_p "$arg"; then
|
---|
6813 | pic_object=
|
---|
6814 | non_pic_object=
|
---|
6815 |
|
---|
6816 | # Read the .lo file
|
---|
6817 | func_source "$arg"
|
---|
6818 |
|
---|
6819 | if test -z "$pic_object" ||
|
---|
6820 | test -z "$non_pic_object" ||
|
---|
6821 | test none = "$pic_object" &&
|
---|
6822 | test none = "$non_pic_object"; then
|
---|
6823 | func_fatal_error "cannot find name of object for '$arg'"
|
---|
6824 | fi
|
---|
6825 |
|
---|
6826 | # Extract subdirectory from the argument.
|
---|
6827 | func_dirname "$arg" "/" ""
|
---|
6828 | xdir=$func_dirname_result
|
---|
6829 |
|
---|
6830 | if test none != "$pic_object"; then
|
---|
6831 | # Prepend the subdirectory the object is found in.
|
---|
6832 | pic_object=$xdir$pic_object
|
---|
6833 |
|
---|
6834 | if test dlfiles = "$prev"; then
|
---|
6835 | if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
|
---|
6836 | func_append dlfiles " $pic_object"
|
---|
6837 | prev=
|
---|
6838 | continue
|
---|
6839 | else
|
---|
6840 | # If libtool objects are unsupported, then we need to preload.
|
---|
6841 | prev=dlprefiles
|
---|
6842 | fi
|
---|
6843 | fi
|
---|
6844 |
|
---|
6845 | # CHECK ME: I think I busted this. -Ossama
|
---|
6846 | if test dlprefiles = "$prev"; then
|
---|
6847 | # Preload the old-style object.
|
---|
6848 | func_append dlprefiles " $pic_object"
|
---|
6849 | prev=
|
---|
6850 | fi
|
---|
6851 |
|
---|
6852 | # A PIC object.
|
---|
6853 | func_append libobjs " $pic_object"
|
---|
6854 | arg=$pic_object
|
---|
6855 | fi
|
---|
6856 |
|
---|
6857 | # Non-PIC object.
|
---|
6858 | if test none != "$non_pic_object"; then
|
---|
6859 | # Prepend the subdirectory the object is found in.
|
---|
6860 | non_pic_object=$xdir$non_pic_object
|
---|
6861 |
|
---|
6862 | # A standard non-PIC object
|
---|
6863 | func_append non_pic_objects " $non_pic_object"
|
---|
6864 | if test -z "$pic_object" || test none = "$pic_object"; then
|
---|
6865 | arg=$non_pic_object
|
---|
6866 | fi
|
---|
6867 | else
|
---|
6868 | # If the PIC object exists, use it instead.
|
---|
6869 | # $xdir was prepended to $pic_object above.
|
---|
6870 | non_pic_object=$pic_object
|
---|
6871 | func_append non_pic_objects " $non_pic_object"
|
---|
6872 | fi
|
---|
6873 | else
|
---|
6874 | # Only an error if not doing a dry-run.
|
---|
6875 | if $opt_dry_run; then
|
---|
6876 | # Extract subdirectory from the argument.
|
---|
6877 | func_dirname "$arg" "/" ""
|
---|
6878 | xdir=$func_dirname_result
|
---|
6879 |
|
---|
6880 | func_lo2o "$arg"
|
---|
6881 | pic_object=$xdir$objdir/$func_lo2o_result
|
---|
6882 | non_pic_object=$xdir$func_lo2o_result
|
---|
6883 | func_append libobjs " $pic_object"
|
---|
6884 | func_append non_pic_objects " $non_pic_object"
|
---|
6885 | else
|
---|
6886 | func_fatal_error "'$arg' is not a valid libtool object"
|
---|
6887 | fi
|
---|
6888 | fi
|
---|
6889 | done
|
---|
6890 | else
|
---|
6891 | func_fatal_error "link input file '$arg' does not exist"
|
---|
6892 | fi
|
---|
6893 | arg=$save_arg
|
---|
6894 | prev=
|
---|
6895 | continue
|
---|
6896 | ;;
|
---|
6897 | os2dllname)
|
---|
6898 | os2dllname=$arg
|
---|
6899 | prev=
|
---|
6900 | continue
|
---|
6901 | ;;
|
---|
6902 | precious_regex)
|
---|
6903 | precious_files_regex=$arg
|
---|
6904 | prev=
|
---|
6905 | continue
|
---|
6906 | ;;
|
---|
6907 | release)
|
---|
6908 | release=-$arg
|
---|
6909 | prev=
|
---|
6910 | continue
|
---|
6911 | ;;
|
---|
6912 | rpath | xrpath)
|
---|
6913 | # We need an absolute path.
|
---|
6914 | case $arg in
|
---|
6915 | [\\/]* | [A-Za-z]:[\\/]*) ;;
|
---|
6916 | *)
|
---|
6917 | func_fatal_error "only absolute run-paths are allowed"
|
---|
6918 | ;;
|
---|
6919 | esac
|
---|
6920 | if test rpath = "$prev"; then
|
---|
6921 | case "$rpath " in
|
---|
6922 | *" $arg "*) ;;
|
---|
6923 | *) func_append rpath " $arg" ;;
|
---|
6924 | esac
|
---|
6925 | else
|
---|
6926 | case "$xrpath " in
|
---|
6927 | *" $arg "*) ;;
|
---|
6928 | *) func_append xrpath " $arg" ;;
|
---|
6929 | esac
|
---|
6930 | fi
|
---|
6931 | prev=
|
---|
6932 | continue
|
---|
6933 | ;;
|
---|
6934 | shrext)
|
---|
6935 | shrext_cmds=$arg
|
---|
6936 | prev=
|
---|
6937 | continue
|
---|
6938 | ;;
|
---|
6939 | weak)
|
---|
6940 | func_append weak_libs " $arg"
|
---|
6941 | prev=
|
---|
6942 | continue
|
---|
6943 | ;;
|
---|
6944 | xcclinker)
|
---|
6945 | func_append linker_flags " $qarg"
|
---|
6946 | func_append compiler_flags " $qarg"
|
---|
6947 | prev=
|
---|
6948 | func_append compile_command " $qarg"
|
---|
6949 | func_append finalize_command " $qarg"
|
---|
6950 | continue
|
---|
6951 | ;;
|
---|
6952 | xcompiler)
|
---|
6953 | func_append compiler_flags " $qarg"
|
---|
6954 | prev=
|
---|
6955 | func_append compile_command " $qarg"
|
---|
6956 | func_append finalize_command " $qarg"
|
---|
6957 | continue
|
---|
6958 | ;;
|
---|
6959 | xlinker)
|
---|
6960 | func_append linker_flags " $qarg"
|
---|
6961 | func_append compiler_flags " $wl$qarg"
|
---|
6962 | prev=
|
---|
6963 | func_append compile_command " $wl$qarg"
|
---|
6964 | func_append finalize_command " $wl$qarg"
|
---|
6965 | continue
|
---|
6966 | ;;
|
---|
6967 | *)
|
---|
6968 | eval "$prev=\"\$arg\""
|
---|
6969 | prev=
|
---|
6970 | continue
|
---|
6971 | ;;
|
---|
6972 | esac
|
---|
6973 | fi # test -n "$prev"
|
---|
6974 |
|
---|
6975 | prevarg=$arg
|
---|
6976 |
|
---|
6977 | case $arg in
|
---|
6978 | -all-static)
|
---|
6979 | if test -n "$link_static_flag"; then
|
---|
6980 | # See comment for -static flag below, for more details.
|
---|
6981 | func_append compile_command " $link_static_flag"
|
---|
6982 | func_append finalize_command " $link_static_flag"
|
---|
6983 | fi
|
---|
6984 | continue
|
---|
6985 | ;;
|
---|
6986 |
|
---|
6987 | -allow-undefined)
|
---|
6988 | # FIXME: remove this flag sometime in the future.
|
---|
6989 | func_fatal_error "'-allow-undefined' must not be used because it is the default"
|
---|
6990 | ;;
|
---|
6991 |
|
---|
6992 | -avoid-version)
|
---|
6993 | avoid_version=yes
|
---|
6994 | continue
|
---|
6995 | ;;
|
---|
6996 |
|
---|
6997 | -bindir)
|
---|
6998 | prev=bindir
|
---|
6999 | continue
|
---|
7000 | ;;
|
---|
7001 |
|
---|
7002 | -dlopen)
|
---|
7003 | prev=dlfiles
|
---|
7004 | continue
|
---|
7005 | ;;
|
---|
7006 |
|
---|
7007 | -dlpreopen)
|
---|
7008 | prev=dlprefiles
|
---|
7009 | continue
|
---|
7010 | ;;
|
---|
7011 |
|
---|
7012 | -export-dynamic)
|
---|
7013 | export_dynamic=yes
|
---|
7014 | continue
|
---|
7015 | ;;
|
---|
7016 |
|
---|
7017 | -export-symbols | -export-symbols-regex)
|
---|
7018 | if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
|
---|
7019 | func_fatal_error "more than one -exported-symbols argument is not allowed"
|
---|
7020 | fi
|
---|
7021 | if test X-export-symbols = "X$arg"; then
|
---|
7022 | prev=expsyms
|
---|
7023 | else
|
---|
7024 | prev=expsyms_regex
|
---|
7025 | fi
|
---|
7026 | continue
|
---|
7027 | ;;
|
---|
7028 |
|
---|
7029 | -framework)
|
---|
7030 | prev=framework
|
---|
7031 | continue
|
---|
7032 | ;;
|
---|
7033 |
|
---|
7034 | -inst-prefix-dir)
|
---|
7035 | prev=inst_prefix
|
---|
7036 | continue
|
---|
7037 | ;;
|
---|
7038 |
|
---|
7039 | # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
|
---|
7040 | # so, if we see these flags be careful not to treat them like -L
|
---|
7041 | -L[A-Z][A-Z]*:*)
|
---|
7042 | case $with_gcc/$host in
|
---|
7043 | no/*-*-irix* | /*-*-irix*)
|
---|
7044 | func_append compile_command " $arg"
|
---|
7045 | func_append finalize_command " $arg"
|
---|
7046 | ;;
|
---|
7047 | esac
|
---|
7048 | continue
|
---|
7049 | ;;
|
---|
7050 |
|
---|
7051 | -L*)
|
---|
7052 | func_stripname "-L" '' "$arg"
|
---|
7053 | if test -z "$func_stripname_result"; then
|
---|
7054 | if test "$#" -gt 0; then
|
---|
7055 | func_fatal_error "require no space between '-L' and '$1'"
|
---|
7056 | else
|
---|
7057 | func_fatal_error "need path for '-L' option"
|
---|
7058 | fi
|
---|
7059 | fi
|
---|
7060 | func_resolve_sysroot "$func_stripname_result"
|
---|
7061 | dir=$func_resolve_sysroot_result
|
---|
7062 | # We need an absolute path.
|
---|
7063 | case $dir in
|
---|
7064 | [\\/]* | [A-Za-z]:[\\/]*) ;;
|
---|
7065 | *)
|
---|
7066 | absdir=`cd "$dir" && pwd`
|
---|
7067 | test -z "$absdir" && \
|
---|
7068 | func_fatal_error "cannot determine absolute directory name of '$dir'"
|
---|
7069 | dir=$absdir
|
---|
7070 | ;;
|
---|
7071 | esac
|
---|
7072 | case "$deplibs " in
|
---|
7073 | *" -L$dir "* | *" $arg "*)
|
---|
7074 | # Will only happen for absolute or sysroot arguments
|
---|
7075 | ;;
|
---|
7076 | *)
|
---|
7077 | # Preserve sysroot, but never include relative directories
|
---|
7078 | case $dir in
|
---|
7079 | [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;;
|
---|
7080 | *) func_append deplibs " -L$dir" ;;
|
---|
7081 | esac
|
---|
7082 | func_append lib_search_path " $dir"
|
---|
7083 | ;;
|
---|
7084 | esac
|
---|
7085 | case $host in
|
---|
7086 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
|
---|
7087 | testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
|
---|
7088 | case :$dllsearchpath: in
|
---|
7089 | *":$dir:"*) ;;
|
---|
7090 | ::) dllsearchpath=$dir;;
|
---|
7091 | *) func_append dllsearchpath ":$dir";;
|
---|
7092 | esac
|
---|
7093 | case :$dllsearchpath: in
|
---|
7094 | *":$testbindir:"*) ;;
|
---|
7095 | ::) dllsearchpath=$testbindir;;
|
---|
7096 | *) func_append dllsearchpath ":$testbindir";;
|
---|
7097 | esac
|
---|
7098 | ;;
|
---|
7099 | esac
|
---|
7100 | continue
|
---|
7101 | ;;
|
---|
7102 |
|
---|
7103 | -l*)
|
---|
7104 | if test X-lc = "X$arg" || test X-lm = "X$arg"; then
|
---|
7105 | case $host in
|
---|
7106 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
|
---|
7107 | # These systems don't actually have a C or math library (as such)
|
---|
7108 | continue
|
---|
7109 | ;;
|
---|
7110 | *-*-os2*)
|
---|
7111 | # These systems don't actually have a C library (as such)
|
---|
7112 | test X-lc = "X$arg" && continue
|
---|
7113 | ;;
|
---|
7114 | *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
|
---|
7115 | # Do not include libc due to us having libc/libc_r.
|
---|
7116 | test X-lc = "X$arg" && continue
|
---|
7117 | ;;
|
---|
7118 | *-*-rhapsody* | *-*-darwin1.[012])
|
---|
7119 | # Rhapsody C and math libraries are in the System framework
|
---|
7120 | func_append deplibs " System.ltframework"
|
---|
7121 | continue
|
---|
7122 | ;;
|
---|
7123 | *-*-sco3.2v5* | *-*-sco5v6*)
|
---|
7124 | # Causes problems with __ctype
|
---|
7125 | test X-lc = "X$arg" && continue
|
---|
7126 | ;;
|
---|
7127 | *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
|
---|
7128 | # Compiler inserts libc in the correct place for threads to work
|
---|
7129 | test X-lc = "X$arg" && continue
|
---|
7130 | ;;
|
---|
7131 | esac
|
---|
7132 | elif test X-lc_r = "X$arg"; then
|
---|
7133 | case $host in
|
---|
7134 | *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
|
---|
7135 | # Do not include libc_r directly, use -pthread flag.
|
---|
7136 | continue
|
---|
7137 | ;;
|
---|
7138 | esac
|
---|
7139 | fi
|
---|
7140 | func_append deplibs " $arg"
|
---|
7141 | continue
|
---|
7142 | ;;
|
---|
7143 |
|
---|
7144 | -mllvm)
|
---|
7145 | prev=mllvm
|
---|
7146 | continue
|
---|
7147 | ;;
|
---|
7148 |
|
---|
7149 | -module)
|
---|
7150 | module=yes
|
---|
7151 | continue
|
---|
7152 | ;;
|
---|
7153 |
|
---|
7154 | # Tru64 UNIX uses -model [arg] to determine the layout of C++
|
---|
7155 | # classes, name mangling, and exception handling.
|
---|
7156 | # Darwin uses the -arch flag to determine output architecture.
|
---|
7157 | -model|-arch|-isysroot|--sysroot)
|
---|
7158 | func_append compiler_flags " $arg"
|
---|
7159 | func_append compile_command " $arg"
|
---|
7160 | func_append finalize_command " $arg"
|
---|
7161 | prev=xcompiler
|
---|
7162 | continue
|
---|
7163 | ;;
|
---|
7164 |
|
---|
7165 | -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
|
---|
7166 | |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
|
---|
7167 | func_append compiler_flags " $arg"
|
---|
7168 | func_append compile_command " $arg"
|
---|
7169 | func_append finalize_command " $arg"
|
---|
7170 | case "$new_inherited_linker_flags " in
|
---|
7171 | *" $arg "*) ;;
|
---|
7172 | * ) func_append new_inherited_linker_flags " $arg" ;;
|
---|
7173 | esac
|
---|
7174 | continue
|
---|
7175 | ;;
|
---|
7176 |
|
---|
7177 | -multi_module)
|
---|
7178 | single_module=$wl-multi_module
|
---|
7179 | continue
|
---|
7180 | ;;
|
---|
7181 |
|
---|
7182 | -no-fast-install)
|
---|
7183 | fast_install=no
|
---|
7184 | continue
|
---|
7185 | ;;
|
---|
7186 |
|
---|
7187 | -no-install)
|
---|
7188 | case $host in
|
---|
7189 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
|
---|
7190 | # The PATH hackery in wrapper scripts is required on Windows
|
---|
7191 | # and Darwin in order for the loader to find any dlls it needs.
|
---|
7192 | func_warning "'-no-install' is ignored for $host"
|
---|
7193 | func_warning "assuming '-no-fast-install' instead"
|
---|
7194 | fast_install=no
|
---|
7195 | ;;
|
---|
7196 | *) no_install=yes ;;
|
---|
7197 | esac
|
---|
7198 | continue
|
---|
7199 | ;;
|
---|
7200 |
|
---|
7201 | -no-undefined)
|
---|
7202 | allow_undefined=no
|
---|
7203 | continue
|
---|
7204 | ;;
|
---|
7205 |
|
---|
7206 | -objectlist)
|
---|
7207 | prev=objectlist
|
---|
7208 | continue
|
---|
7209 | ;;
|
---|
7210 |
|
---|
7211 | -os2dllname)
|
---|
7212 | prev=os2dllname
|
---|
7213 | continue
|
---|
7214 | ;;
|
---|
7215 |
|
---|
7216 | -o) prev=output ;;
|
---|
7217 |
|
---|
7218 | -precious-files-regex)
|
---|
7219 | prev=precious_regex
|
---|
7220 | continue
|
---|
7221 | ;;
|
---|
7222 |
|
---|
7223 | -release)
|
---|
7224 | prev=release
|
---|
7225 | continue
|
---|
7226 | ;;
|
---|
7227 |
|
---|
7228 | -rpath)
|
---|
7229 | prev=rpath
|
---|
7230 | continue
|
---|
7231 | ;;
|
---|
7232 |
|
---|
7233 | -R)
|
---|
7234 | prev=xrpath
|
---|
7235 | continue
|
---|
7236 | ;;
|
---|
7237 |
|
---|
7238 | -R*)
|
---|
7239 | func_stripname '-R' '' "$arg"
|
---|
7240 | dir=$func_stripname_result
|
---|
7241 | # We need an absolute path.
|
---|
7242 | case $dir in
|
---|
7243 | [\\/]* | [A-Za-z]:[\\/]*) ;;
|
---|
7244 | =*)
|
---|
7245 | func_stripname '=' '' "$dir"
|
---|
7246 | dir=$lt_sysroot$func_stripname_result
|
---|
7247 | ;;
|
---|
7248 | *)
|
---|
7249 | func_fatal_error "only absolute run-paths are allowed"
|
---|
7250 | ;;
|
---|
7251 | esac
|
---|
7252 | case "$xrpath " in
|
---|
7253 | *" $dir "*) ;;
|
---|
7254 | *) func_append xrpath " $dir" ;;
|
---|
7255 | esac
|
---|
7256 | continue
|
---|
7257 | ;;
|
---|
7258 |
|
---|
7259 | -shared)
|
---|
7260 | # The effects of -shared are defined in a previous loop.
|
---|
7261 | continue
|
---|
7262 | ;;
|
---|
7263 |
|
---|
7264 | -shrext)
|
---|
7265 | prev=shrext
|
---|
7266 | continue
|
---|
7267 | ;;
|
---|
7268 |
|
---|
7269 | -static | -static-libtool-libs)
|
---|
7270 | # The effects of -static are defined in a previous loop.
|
---|
7271 | # We used to do the same as -all-static on platforms that
|
---|
7272 | # didn't have a PIC flag, but the assumption that the effects
|
---|
7273 | # would be equivalent was wrong. It would break on at least
|
---|
7274 | # Digital Unix and AIX.
|
---|
7275 | continue
|
---|
7276 | ;;
|
---|
7277 |
|
---|
7278 | -thread-safe)
|
---|
7279 | thread_safe=yes
|
---|
7280 | continue
|
---|
7281 | ;;
|
---|
7282 |
|
---|
7283 | -version-info)
|
---|
7284 | prev=vinfo
|
---|
7285 | continue
|
---|
7286 | ;;
|
---|
7287 |
|
---|
7288 | -version-number)
|
---|
7289 | prev=vinfo
|
---|
7290 | vinfo_number=yes
|
---|
7291 | continue
|
---|
7292 | ;;
|
---|
7293 |
|
---|
7294 | -weak)
|
---|
7295 | prev=weak
|
---|
7296 | continue
|
---|
7297 | ;;
|
---|
7298 |
|
---|
7299 | -Wc,*)
|
---|
7300 | func_stripname '-Wc,' '' "$arg"
|
---|
7301 | args=$func_stripname_result
|
---|
7302 | arg=
|
---|
7303 | save_ifs=$IFS; IFS=,
|
---|
7304 | for flag in $args; do
|
---|
7305 | IFS=$save_ifs
|
---|
7306 | func_quote_for_eval "$flag"
|
---|
7307 | func_append arg " $func_quote_for_eval_result"
|
---|
7308 | func_append compiler_flags " $func_quote_for_eval_result"
|
---|
7309 | done
|
---|
7310 | IFS=$save_ifs
|
---|
7311 | func_stripname ' ' '' "$arg"
|
---|
7312 | arg=$func_stripname_result
|
---|
7313 | ;;
|
---|
7314 |
|
---|
7315 | -Wl,*)
|
---|
7316 | func_stripname '-Wl,' '' "$arg"
|
---|
7317 | args=$func_stripname_result
|
---|
7318 | arg=
|
---|
7319 | save_ifs=$IFS; IFS=,
|
---|
7320 | for flag in $args; do
|
---|
7321 | IFS=$save_ifs
|
---|
7322 | func_quote_for_eval "$flag"
|
---|
7323 | func_append arg " $wl$func_quote_for_eval_result"
|
---|
7324 | func_append compiler_flags " $wl$func_quote_for_eval_result"
|
---|
7325 | func_append linker_flags " $func_quote_for_eval_result"
|
---|
7326 | done
|
---|
7327 | IFS=$save_ifs
|
---|
7328 | func_stripname ' ' '' "$arg"
|
---|
7329 | arg=$func_stripname_result
|
---|
7330 | ;;
|
---|
7331 |
|
---|
7332 | -Xcompiler)
|
---|
7333 | prev=xcompiler
|
---|
7334 | continue
|
---|
7335 | ;;
|
---|
7336 |
|
---|
7337 | -Xlinker)
|
---|
7338 | prev=xlinker
|
---|
7339 | continue
|
---|
7340 | ;;
|
---|
7341 |
|
---|
7342 | -XCClinker)
|
---|
7343 | prev=xcclinker
|
---|
7344 | continue
|
---|
7345 | ;;
|
---|
7346 |
|
---|
7347 | # -msg_* for osf cc
|
---|
7348 | -msg_*)
|
---|
7349 | func_quote_for_eval "$arg"
|
---|
7350 | arg=$func_quote_for_eval_result
|
---|
7351 | ;;
|
---|
7352 |
|
---|
7353 | # Flags to be passed through unchanged, with rationale:
|
---|
7354 | # -64, -mips[0-9] enable 64-bit mode for the SGI compiler
|
---|
7355 | # -r[0-9][0-9]* specify processor for the SGI compiler
|
---|
7356 | # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
|
---|
7357 | # +DA*, +DD* enable 64-bit mode for the HP compiler
|
---|
7358 | # -q* compiler args for the IBM compiler
|
---|
7359 | # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
|
---|
7360 | # -F/path path to uninstalled frameworks, gcc on darwin
|
---|
7361 | # -p, -pg, --coverage, -fprofile-* profiling flags for GCC
|
---|
7362 | # -fstack-protector* stack protector flags for GCC
|
---|
7363 | # @file GCC response files
|
---|
7364 | # -tp=* Portland pgcc target processor selection
|
---|
7365 | # --sysroot=* for sysroot support
|
---|
7366 | # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
|
---|
7367 | # -specs=* GCC specs files
|
---|
7368 | # -stdlib=* select c++ std lib with clang
|
---|
7369 | # -fsanitize=* Clang/GCC memory and address sanitizer
|
---|
7370 | # -fuse-ld=* Linker select flags for GCC
|
---|
7371 | # -static-* direct GCC to link specific libraries statically
|
---|
7372 | # -fcilkplus Cilk Plus language extension features for C/C++
|
---|
7373 | -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
|
---|
7374 | -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
|
---|
7375 | -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \
|
---|
7376 | -specs=*|-fsanitize=*|-fuse-ld=*|-static-*|-fcilkplus)
|
---|
7377 | func_quote_for_eval "$arg"
|
---|
7378 | arg=$func_quote_for_eval_result
|
---|
7379 | func_append compile_command " $arg"
|
---|
7380 | func_append finalize_command " $arg"
|
---|
7381 | func_append compiler_flags " $arg"
|
---|
7382 | continue
|
---|
7383 | ;;
|
---|
7384 |
|
---|
7385 | -Z*)
|
---|
7386 | if test os2 = "`expr $host : '.*\(os2\)'`"; then
|
---|
7387 | # OS/2 uses -Zxxx to specify OS/2-specific options
|
---|
7388 | compiler_flags="$compiler_flags $arg"
|
---|
7389 | func_append compile_command " $arg"
|
---|
7390 | func_append finalize_command " $arg"
|
---|
7391 | case $arg in
|
---|
7392 | -Zlinker | -Zstack)
|
---|
7393 | prev=xcompiler
|
---|
7394 | ;;
|
---|
7395 | esac
|
---|
7396 | continue
|
---|
7397 | else
|
---|
7398 | # Otherwise treat like 'Some other compiler flag' below
|
---|
7399 | func_quote_for_eval "$arg"
|
---|
7400 | arg=$func_quote_for_eval_result
|
---|
7401 | fi
|
---|
7402 | ;;
|
---|
7403 |
|
---|
7404 | # Some other compiler flag.
|
---|
7405 | -* | +*)
|
---|
7406 | func_quote_for_eval "$arg"
|
---|
7407 | arg=$func_quote_for_eval_result
|
---|
7408 | ;;
|
---|
7409 |
|
---|
7410 | *.$objext)
|
---|
7411 | # A standard object.
|
---|
7412 | func_append objs " $arg"
|
---|
7413 | ;;
|
---|
7414 |
|
---|
7415 | *.lo)
|
---|
7416 | # A libtool-controlled object.
|
---|
7417 |
|
---|
7418 | # Check to see that this really is a libtool object.
|
---|
7419 | if func_lalib_unsafe_p "$arg"; then
|
---|
7420 | pic_object=
|
---|
7421 | non_pic_object=
|
---|
7422 |
|
---|
7423 | # Read the .lo file
|
---|
7424 | func_source "$arg"
|
---|
7425 |
|
---|
7426 | if test -z "$pic_object" ||
|
---|
7427 | test -z "$non_pic_object" ||
|
---|
7428 | test none = "$pic_object" &&
|
---|
7429 | test none = "$non_pic_object"; then
|
---|
7430 | func_fatal_error "cannot find name of object for '$arg'"
|
---|
7431 | fi
|
---|
7432 |
|
---|
7433 | # Extract subdirectory from the argument.
|
---|
7434 | func_dirname "$arg" "/" ""
|
---|
7435 | xdir=$func_dirname_result
|
---|
7436 |
|
---|
7437 | test none = "$pic_object" || {
|
---|
7438 | # Prepend the subdirectory the object is found in.
|
---|
7439 | pic_object=$xdir$pic_object
|
---|
7440 |
|
---|
7441 | if test dlfiles = "$prev"; then
|
---|
7442 | if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
|
---|
7443 | func_append dlfiles " $pic_object"
|
---|
7444 | prev=
|
---|
7445 | continue
|
---|
7446 | else
|
---|
7447 | # If libtool objects are unsupported, then we need to preload.
|
---|
7448 | prev=dlprefiles
|
---|
7449 | fi
|
---|
7450 | fi
|
---|
7451 |
|
---|
7452 | # CHECK ME: I think I busted this. -Ossama
|
---|
7453 | if test dlprefiles = "$prev"; then
|
---|
7454 | # Preload the old-style object.
|
---|
7455 | func_append dlprefiles " $pic_object"
|
---|
7456 | prev=
|
---|
7457 | fi
|
---|
7458 |
|
---|
7459 | # A PIC object.
|
---|
7460 | func_append libobjs " $pic_object"
|
---|
7461 | arg=$pic_object
|
---|
7462 | }
|
---|
7463 |
|
---|
7464 | # Non-PIC object.
|
---|
7465 | if test none != "$non_pic_object"; then
|
---|
7466 | # Prepend the subdirectory the object is found in.
|
---|
7467 | non_pic_object=$xdir$non_pic_object
|
---|
7468 |
|
---|
7469 | # A standard non-PIC object
|
---|
7470 | func_append non_pic_objects " $non_pic_object"
|
---|
7471 | if test -z "$pic_object" || test none = "$pic_object"; then
|
---|
7472 | arg=$non_pic_object
|
---|
7473 | fi
|
---|
7474 | else
|
---|
7475 | # If the PIC object exists, use it instead.
|
---|
7476 | # $xdir was prepended to $pic_object above.
|
---|
7477 | non_pic_object=$pic_object
|
---|
7478 | func_append non_pic_objects " $non_pic_object"
|
---|
7479 | fi
|
---|
7480 | else
|
---|
7481 | # Only an error if not doing a dry-run.
|
---|
7482 | if $opt_dry_run; then
|
---|
7483 | # Extract subdirectory from the argument.
|
---|
7484 | func_dirname "$arg" "/" ""
|
---|
7485 | xdir=$func_dirname_result
|
---|
7486 |
|
---|
7487 | func_lo2o "$arg"
|
---|
7488 | pic_object=$xdir$objdir/$func_lo2o_result
|
---|
7489 | non_pic_object=$xdir$func_lo2o_result
|
---|
7490 | func_append libobjs " $pic_object"
|
---|
7491 | func_append non_pic_objects " $non_pic_object"
|
---|
7492 | else
|
---|
7493 | func_fatal_error "'$arg' is not a valid libtool object"
|
---|
7494 | fi
|
---|
7495 | fi
|
---|
7496 | ;;
|
---|
7497 |
|
---|
7498 | *.$libext)
|
---|
7499 | # An archive.
|
---|
7500 | func_append deplibs " $arg"
|
---|
7501 | func_append old_deplibs " $arg"
|
---|
7502 | continue
|
---|
7503 | ;;
|
---|
7504 |
|
---|
7505 | *.la)
|
---|
7506 | # A libtool-controlled library.
|
---|
7507 |
|
---|
7508 | func_resolve_sysroot "$arg"
|
---|
7509 | if test dlfiles = "$prev"; then
|
---|
7510 | # This library was specified with -dlopen.
|
---|
7511 | func_append dlfiles " $func_resolve_sysroot_result"
|
---|
7512 | prev=
|
---|
7513 | elif test dlprefiles = "$prev"; then
|
---|
7514 | # The library was specified with -dlpreopen.
|
---|
7515 | func_append dlprefiles " $func_resolve_sysroot_result"
|
---|
7516 | prev=
|
---|
7517 | else
|
---|
7518 | func_append deplibs " $func_resolve_sysroot_result"
|
---|
7519 | fi
|
---|
7520 | continue
|
---|
7521 | ;;
|
---|
7522 |
|
---|
7523 | # Some other compiler argument.
|
---|
7524 | *)
|
---|
7525 | # Unknown arguments in both finalize_command and compile_command need
|
---|
7526 | # to be aesthetically quoted because they are evaled later.
|
---|
7527 | func_quote_for_eval "$arg"
|
---|
7528 | arg=$func_quote_for_eval_result
|
---|
7529 | ;;
|
---|
7530 | esac # arg
|
---|
7531 |
|
---|
7532 | # Now actually substitute the argument into the commands.
|
---|
7533 | if test -n "$arg"; then
|
---|
7534 | func_append compile_command " $arg"
|
---|
7535 | func_append finalize_command " $arg"
|
---|
7536 | fi
|
---|
7537 | done # argument parsing loop
|
---|
7538 |
|
---|
7539 | test -n "$prev" && \
|
---|
7540 | func_fatal_help "the '$prevarg' option requires an argument"
|
---|
7541 |
|
---|
7542 | if test yes = "$export_dynamic" && test -n "$export_dynamic_flag_spec"; then
|
---|
7543 | eval arg=\"$export_dynamic_flag_spec\"
|
---|
7544 | func_append compile_command " $arg"
|
---|
7545 | func_append finalize_command " $arg"
|
---|
7546 | fi
|
---|
7547 |
|
---|
7548 | oldlibs=
|
---|
7549 | # calculate the name of the file, without its directory
|
---|
7550 | func_basename "$output"
|
---|
7551 | outputname=$func_basename_result
|
---|
7552 | libobjs_save=$libobjs
|
---|
7553 |
|
---|
7554 | if test -n "$shlibpath_var"; then
|
---|
7555 | # get the directories listed in $shlibpath_var
|
---|
7556 | eval shlib_search_path=\`\$ECHO \"\$$shlibpath_var\" \| \$SED \'s/:/ /g\'\`
|
---|
7557 | else
|
---|
7558 | shlib_search_path=
|
---|
7559 | fi
|
---|
7560 | eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
|
---|
7561 | eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
|
---|
7562 |
|
---|
7563 | # Definition is injected by LT_CONFIG during libtool generation.
|
---|
7564 | func_munge_path_list sys_lib_dlsearch_path "$LT_SYS_LIBRARY_PATH"
|
---|
7565 |
|
---|
7566 | func_dirname "$output" "/" ""
|
---|
7567 | output_objdir=$func_dirname_result$objdir
|
---|
7568 | func_to_tool_file "$output_objdir/"
|
---|
7569 | tool_output_objdir=$func_to_tool_file_result
|
---|
7570 | # Create the object directory.
|
---|
7571 | func_mkdir_p "$output_objdir"
|
---|
7572 |
|
---|
7573 | # Determine the type of output
|
---|
7574 | case $output in
|
---|
7575 | "")
|
---|
7576 | func_fatal_help "you must specify an output file"
|
---|
7577 | ;;
|
---|
7578 | *.$libext) linkmode=oldlib ;;
|
---|
7579 | *.lo | *.$objext) linkmode=obj ;;
|
---|
7580 | *.la) linkmode=lib ;;
|
---|
7581 | *) linkmode=prog ;; # Anything else should be a program.
|
---|
7582 | esac
|
---|
7583 |
|
---|
7584 | specialdeplibs=
|
---|
7585 |
|
---|
7586 | libs=
|
---|
7587 | # Find all interdependent deplibs by searching for libraries
|
---|
7588 | # that are linked more than once (e.g. -la -lb -la)
|
---|
7589 | for deplib in $deplibs; do
|
---|
7590 | if $opt_preserve_dup_deps; then
|
---|
7591 | case "$libs " in
|
---|
7592 | *" $deplib "*) func_append specialdeplibs " $deplib" ;;
|
---|
7593 | esac
|
---|
7594 | fi
|
---|
7595 | func_append libs " $deplib"
|
---|
7596 | done
|
---|
7597 |
|
---|
7598 | if test lib = "$linkmode"; then
|
---|
7599 | libs="$predeps $libs $compiler_lib_search_path $postdeps"
|
---|
7600 |
|
---|
7601 | # Compute libraries that are listed more than once in $predeps
|
---|
7602 | # $postdeps and mark them as special (i.e., whose duplicates are
|
---|
7603 | # not to be eliminated).
|
---|
7604 | pre_post_deps=
|
---|
7605 | if $opt_duplicate_compiler_generated_deps; then
|
---|
7606 | for pre_post_dep in $predeps $postdeps; do
|
---|
7607 | case "$pre_post_deps " in
|
---|
7608 | *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;;
|
---|
7609 | esac
|
---|
7610 | func_append pre_post_deps " $pre_post_dep"
|
---|
7611 | done
|
---|
7612 | fi
|
---|
7613 | pre_post_deps=
|
---|
7614 | fi
|
---|
7615 |
|
---|
7616 | deplibs=
|
---|
7617 | newdependency_libs=
|
---|
7618 | newlib_search_path=
|
---|
7619 | need_relink=no # whether we're linking any uninstalled libtool libraries
|
---|
7620 | notinst_deplibs= # not-installed libtool libraries
|
---|
7621 | notinst_path= # paths that contain not-installed libtool libraries
|
---|
7622 |
|
---|
7623 | case $linkmode in
|
---|
7624 | lib)
|
---|
7625 | passes="conv dlpreopen link"
|
---|
7626 | for file in $dlfiles $dlprefiles; do
|
---|
7627 | case $file in
|
---|
7628 | *.la) ;;
|
---|
7629 | *)
|
---|
7630 | func_fatal_help "libraries can '-dlopen' only libtool libraries: $file"
|
---|
7631 | ;;
|
---|
7632 | esac
|
---|
7633 | done
|
---|
7634 | ;;
|
---|
7635 | prog)
|
---|
7636 | compile_deplibs=
|
---|
7637 | finalize_deplibs=
|
---|
7638 | alldeplibs=false
|
---|
7639 | newdlfiles=
|
---|
7640 | newdlprefiles=
|
---|
7641 | passes="conv scan dlopen dlpreopen link"
|
---|
7642 | ;;
|
---|
7643 | *) passes="conv"
|
---|
7644 | ;;
|
---|
7645 | esac
|
---|
7646 |
|
---|
7647 | for pass in $passes; do
|
---|
7648 | # The preopen pass in lib mode reverses $deplibs; put it back here
|
---|
7649 | # so that -L comes before libs that need it for instance...
|
---|
7650 | if test lib,link = "$linkmode,$pass"; then
|
---|
7651 | ## FIXME: Find the place where the list is rebuilt in the wrong
|
---|
7652 | ## order, and fix it there properly
|
---|
7653 | tmp_deplibs=
|
---|
7654 | for deplib in $deplibs; do
|
---|
7655 | tmp_deplibs="$deplib $tmp_deplibs"
|
---|
7656 | done
|
---|
7657 | deplibs=$tmp_deplibs
|
---|
7658 | fi
|
---|
7659 |
|
---|
7660 | if test lib,link = "$linkmode,$pass" ||
|
---|
7661 | test prog,scan = "$linkmode,$pass"; then
|
---|
7662 | libs=$deplibs
|
---|
7663 | deplibs=
|
---|
7664 | fi
|
---|
7665 | if test prog = "$linkmode"; then
|
---|
7666 | case $pass in
|
---|
7667 | dlopen) libs=$dlfiles ;;
|
---|
7668 | dlpreopen) libs=$dlprefiles ;;
|
---|
7669 | link)
|
---|
7670 | libs="$deplibs %DEPLIBS%"
|
---|
7671 | test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
|
---|
7672 | ;;
|
---|
7673 | esac
|
---|
7674 | fi
|
---|
7675 | if test lib,dlpreopen = "$linkmode,$pass"; then
|
---|
7676 | # Collect and forward deplibs of preopened libtool libs
|
---|
7677 | for lib in $dlprefiles; do
|
---|
7678 | # Ignore non-libtool-libs
|
---|
7679 | dependency_libs=
|
---|
7680 | func_resolve_sysroot "$lib"
|
---|
7681 | case $lib in
|
---|
7682 | *.la) func_source "$func_resolve_sysroot_result" ;;
|
---|
7683 | esac
|
---|
7684 |
|
---|
7685 | # Collect preopened libtool deplibs, except any this library
|
---|
7686 | # has declared as weak libs
|
---|
7687 | for deplib in $dependency_libs; do
|
---|
7688 | func_basename "$deplib"
|
---|
7689 | deplib_base=$func_basename_result
|
---|
7690 | case " $weak_libs " in
|
---|
7691 | *" $deplib_base "*) ;;
|
---|
7692 | *) func_append deplibs " $deplib" ;;
|
---|
7693 | esac
|
---|
7694 | done
|
---|
7695 | done
|
---|
7696 | libs=$dlprefiles
|
---|
7697 | fi
|
---|
7698 | if test dlopen = "$pass"; then
|
---|
7699 | # Collect dlpreopened libraries
|
---|
7700 | save_deplibs=$deplibs
|
---|
7701 | deplibs=
|
---|
7702 | fi
|
---|
7703 |
|
---|
7704 | for deplib in $libs; do
|
---|
7705 | lib=
|
---|
7706 | found=false
|
---|
7707 | case $deplib in
|
---|
7708 | -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
|
---|
7709 | |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
|
---|
7710 | if test prog,link = "$linkmode,$pass"; then
|
---|
7711 | compile_deplibs="$deplib $compile_deplibs"
|
---|
7712 | finalize_deplibs="$deplib $finalize_deplibs"
|
---|
7713 | else
|
---|
7714 | func_append compiler_flags " $deplib"
|
---|
7715 | if test lib = "$linkmode"; then
|
---|
7716 | case "$new_inherited_linker_flags " in
|
---|
7717 | *" $deplib "*) ;;
|
---|
7718 | * ) func_append new_inherited_linker_flags " $deplib" ;;
|
---|
7719 | esac
|
---|
7720 | fi
|
---|
7721 | fi
|
---|
7722 | continue
|
---|
7723 | ;;
|
---|
7724 | -l*)
|
---|
7725 | if test lib != "$linkmode" && test prog != "$linkmode"; then
|
---|
7726 | func_warning "'-l' is ignored for archives/objects"
|
---|
7727 | continue
|
---|
7728 | fi
|
---|
7729 | func_stripname '-l' '' "$deplib"
|
---|
7730 | name=$func_stripname_result
|
---|
7731 | if test lib = "$linkmode"; then
|
---|
7732 | searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
|
---|
7733 | else
|
---|
7734 | searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
|
---|
7735 | fi
|
---|
7736 | for searchdir in $searchdirs; do
|
---|
7737 | for search_ext in .la $std_shrext .so .a; do
|
---|
7738 | # Search the libtool library
|
---|
7739 | lib=$searchdir/lib$name$search_ext
|
---|
7740 | if test -f "$lib"; then
|
---|
7741 | if test .la = "$search_ext"; then
|
---|
7742 | found=:
|
---|
7743 | else
|
---|
7744 | found=false
|
---|
7745 | fi
|
---|
7746 | break 2
|
---|
7747 | fi
|
---|
7748 | done
|
---|
7749 | done
|
---|
7750 | if $found; then
|
---|
7751 | # deplib is a libtool library
|
---|
7752 | # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
|
---|
7753 | # We need to do some special things here, and not later.
|
---|
7754 | if test yes = "$allow_libtool_libs_with_static_runtimes"; then
|
---|
7755 | case " $predeps $postdeps " in
|
---|
7756 | *" $deplib "*)
|
---|
7757 | if func_lalib_p "$lib"; then
|
---|
7758 | library_names=
|
---|
7759 | old_library=
|
---|
7760 | func_source "$lib"
|
---|
7761 | for l in $old_library $library_names; do
|
---|
7762 | ll=$l
|
---|
7763 | done
|
---|
7764 | if test "X$ll" = "X$old_library"; then # only static version available
|
---|
7765 | found=false
|
---|
7766 | func_dirname "$lib" "" "."
|
---|
7767 | ladir=$func_dirname_result
|
---|
7768 | lib=$ladir/$old_library
|
---|
7769 | if test prog,link = "$linkmode,$pass"; then
|
---|
7770 | compile_deplibs="$deplib $compile_deplibs"
|
---|
7771 | finalize_deplibs="$deplib $finalize_deplibs"
|
---|
7772 | else
|
---|
7773 | deplibs="$deplib $deplibs"
|
---|
7774 | test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
|
---|
7775 | fi
|
---|
7776 | continue
|
---|
7777 | fi
|
---|
7778 | fi
|
---|
7779 | ;;
|
---|
7780 | *) ;;
|
---|
7781 | esac
|
---|
7782 | fi
|
---|
7783 | else
|
---|
7784 | # deplib doesn't seem to be a libtool library
|
---|
7785 | if test prog,link = "$linkmode,$pass"; then
|
---|
7786 | compile_deplibs="$deplib $compile_deplibs"
|
---|
7787 | finalize_deplibs="$deplib $finalize_deplibs"
|
---|
7788 | else
|
---|
7789 | deplibs="$deplib $deplibs"
|
---|
7790 | test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
|
---|
7791 | fi
|
---|
7792 | continue
|
---|
7793 | fi
|
---|
7794 | ;; # -l
|
---|
7795 | *.ltframework)
|
---|
7796 | if test prog,link = "$linkmode,$pass"; then
|
---|
7797 | compile_deplibs="$deplib $compile_deplibs"
|
---|
7798 | finalize_deplibs="$deplib $finalize_deplibs"
|
---|
7799 | else
|
---|
7800 | deplibs="$deplib $deplibs"
|
---|
7801 | if test lib = "$linkmode"; then
|
---|
7802 | case "$new_inherited_linker_flags " in
|
---|
7803 | *" $deplib "*) ;;
|
---|
7804 | * ) func_append new_inherited_linker_flags " $deplib" ;;
|
---|
7805 | esac
|
---|
7806 | fi
|
---|
7807 | fi
|
---|
7808 | continue
|
---|
7809 | ;;
|
---|
7810 | -L*)
|
---|
7811 | case $linkmode in
|
---|
7812 | lib)
|
---|
7813 | deplibs="$deplib $deplibs"
|
---|
7814 | test conv = "$pass" && continue
|
---|
7815 | newdependency_libs="$deplib $newdependency_libs"
|
---|
7816 | func_stripname '-L' '' "$deplib"
|
---|
7817 | func_resolve_sysroot "$func_stripname_result"
|
---|
7818 | func_append newlib_search_path " $func_resolve_sysroot_result"
|
---|
7819 | ;;
|
---|
7820 | prog)
|
---|
7821 | if test conv = "$pass"; then
|
---|
7822 | deplibs="$deplib $deplibs"
|
---|
7823 | continue
|
---|
7824 | fi
|
---|
7825 | if test scan = "$pass"; then
|
---|
7826 | deplibs="$deplib $deplibs"
|
---|
7827 | else
|
---|
7828 | compile_deplibs="$deplib $compile_deplibs"
|
---|
7829 | finalize_deplibs="$deplib $finalize_deplibs"
|
---|
7830 | fi
|
---|
7831 | func_stripname '-L' '' "$deplib"
|
---|
7832 | func_resolve_sysroot "$func_stripname_result"
|
---|
7833 | func_append newlib_search_path " $func_resolve_sysroot_result"
|
---|
7834 | ;;
|
---|
7835 | *)
|
---|
7836 | func_warning "'-L' is ignored for archives/objects"
|
---|