Fixing battery alarm when measurement of current is missing (Closes: #854643).
[debian/lxpanel.git] / ltmain.sh
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-2"
35 package_revision=2.4.6
36
37
38 ## ------ ##
39 ## Usage. ##
40 ## ------ ##
41
42 # Run './libtool --help' for help with using this script from the
43 # command line.
44
45
46 ## ------------------------------- ##
47 ## User overridable command paths. ##
48 ## ------------------------------- ##
49
50 # After configure completes, it has a better idea of some of the
51 # shell tools we need than the defaults used by the functions shared
52 # with bootstrap, so set those here where they can still be over-
53 # ridden by the user, but otherwise take precedence.
54
55 : ${AUTOCONF="autoconf"}
56 : ${AUTOMAKE="automake"}
57
58
59 ## -------------------------- ##
60 ## Source external libraries. ##
61 ## -------------------------- ##
62
63 # Much of our low-level functionality needs to be sourced from external
64 # libraries, which are installed to $pkgauxdir.
65
66 # Set a version string for this script.
67 scriptversion=2015-01-20.17; # UTC
68
69 # General shell script boiler plate, and helper functions.
70 # Written by Gary V. Vaughan, 2004
71
72 # Copyright (C) 2004-2015 Free Software Foundation, Inc.
73 # This is free software; see the source for copying conditions. There is NO
74 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
75
76 # This program is free software; you can redistribute it and/or modify
77 # it under the terms of the GNU General Public License as published by
78 # the Free Software Foundation; either version 3 of the License, or
79 # (at your option) any later version.
80
81 # As a special exception to the GNU General Public License, if you distribute
82 # this file as part of a program or library that is built using GNU Libtool,
83 # you may include this file under the same distribution terms that you use
84 # for the rest of that program.
85
86 # This program is distributed in the hope that it will be useful,
87 # but WITHOUT ANY WARRANTY; without even the implied warranty of
88 # MERCHANTABILITY or FITNES FOR A PARTICULAR PURPOSE. See the GNU
89 # General Public License for more details.
90
91 # You should have received a copy of the GNU General Public License
92 # along with this program. If not, see <http://www.gnu.org/licenses/>.
93
94 # Please report bugs or propose patches to gary@gnu.org.
95
96
97 ## ------ ##
98 ## Usage. ##
99 ## ------ ##
100
101 # Evaluate this file near the top of your script to gain access to
102 # the functions and variables defined here:
103 #
104 # . `echo "$0" | ${SED-sed} 's|[^/]*$||'`/build-aux/funclib.sh
105 #
106 # If you need to override any of the default environment variable
107 # settings, do that before evaluating this file.
108
109
110 ## -------------------- ##
111 ## Shell normalisation. ##
112 ## -------------------- ##
113
114 # Some shells need a little help to be as Bourne compatible as possible.
115 # Before doing anything else, make sure all that help has been provided!
116
117 DUALCASE=1; export DUALCASE # for MKS sh
118 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
119 emulate sh
120 NULLCMD=:
121 # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
122 # is contrary to our usage. Disable this feature.
123 alias -g '${1+"$@"}'='"$@"'
124 setopt NO_GLOB_SUBST
125 else
126 case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac
127 fi
128
129 # NLS nuisances: We save the old values in case they are required later.
130 _G_user_locale=
131 _G_safe_locale=
132 for _G_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
133 do
134 eval "if test set = \"\${$_G_var+set}\"; then
135 save_$_G_var=\$$_G_var
136 $_G_var=C
137 export $_G_var
138 _G_user_locale=\"$_G_var=\\\$save_\$_G_var; \$_G_user_locale\"
139 _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\"
140 fi"
141 done
142
143 # CDPATH.
144 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
145
146 # Make sure IFS has a sensible default
147 sp=' '
148 nl='
149 '
150 IFS="$sp $nl"
151
152 # There are apparently some retarded systems that use ';' as a PATH separator!
153 if test "${PATH_SEPARATOR+set}" != set; then
154 PATH_SEPARATOR=:
155 (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
156 (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
157 PATH_SEPARATOR=';'
158 }
159 fi
160
161
162
163 ## ------------------------- ##
164 ## Locate command utilities. ##
165 ## ------------------------- ##
166
167
168 # func_executable_p FILE
169 # ----------------------
170 # Check that FILE is an executable regular file.
171 func_executable_p ()
172 {
173 test -f "$1" && test -x "$1"
174 }
175
176
177 # func_path_progs PROGS_LIST CHECK_FUNC [PATH]
178 # --------------------------------------------
179 # Search for either a program that responds to --version with output
180 # containing "GNU", or else returned by CHECK_FUNC otherwise, by
181 # trying all the directories in PATH with each of the elements of
182 # PROGS_LIST.
183 #
184 # CHECK_FUNC should accept the path to a candidate program, and
185 # set $func_check_prog_result if it truncates its output less than
186 # $_G_path_prog_max characters.
187 func_path_progs ()
188 {
189 _G_progs_list=$1
190 _G_check_func=$2
191 _G_PATH=${3-"$PATH"}
192
193 _G_path_prog_max=0
194 _G_path_prog_found=false
195 _G_save_IFS=$IFS; IFS=${PATH_SEPARATOR-:}
196 for _G_dir in $_G_PATH; do
197 IFS=$_G_save_IFS
198 test -z "$_G_dir" && _G_dir=.
199 for _G_prog_name in $_G_progs_list; do
200 for _exeext in '' .EXE; do
201 _G_path_prog=$_G_dir/$_G_prog_name$_exeext
202 func_executable_p "$_G_path_prog" || continue
203 case `"$_G_path_prog" --version 2>&1` in
204 *GNU*) func_path_progs_result=$_G_path_prog _G_path_prog_found=: ;;
205 *) $_G_check_func $_G_path_prog
206 func_path_progs_result=$func_check_prog_result
207 ;;
208 esac
209 $_G_path_prog_found && break 3
210 done
211 done
212 done
213 IFS=$_G_save_IFS
214 test -z "$func_path_progs_result" && {
215 echo "no acceptable sed could be found in \$PATH" >&2
216 exit 1
217 }
218 }
219
220
221 # We want to be able to use the functions in this file before configure
222 # has figured out where the best binaries are kept, which means we have
223 # to search for them ourselves - except when the results are already set
224 # where we skip the searches.
225
226 # Unless the user overrides by setting SED, search the path for either GNU
227 # sed, or the sed that truncates its output the least.
228 test -z "$SED" && {
229 _G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
230 for _G_i in 1 2 3 4 5 6 7; do
231 _G_sed_script=$_G_sed_script$nl$_G_sed_script
232 done
233 echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed
234 _G_sed_script=
235
236 func_check_prog_sed ()
237 {
238 _G_path_prog=$1
239
240 _G_count=0
241 printf 0123456789 >conftest.in
242 while :
243 do
244 cat conftest.in conftest.in >conftest.tmp
245 mv conftest.tmp conftest.in
246 cp conftest.in conftest.nl
247 echo '' >> conftest.nl
248 "$_G_path_prog" -f conftest.sed <conftest.nl >conftest.out 2>/dev/null || break
249 diff conftest.out conftest.nl >/dev/null 2>&1 || break
250 _G_count=`expr $_G_count + 1`
251 if test "$_G_count" -gt "$_G_path_prog_max"; then
252 # Best one so far, save it but keep looking for a better one
253 func_check_prog_result=$_G_path_prog
254 _G_path_prog_max=$_G_count
255 fi
256 # 10*(2^10) chars as input seems more than enough
257 test 10 -lt "$_G_count" && break
258 done
259 rm -f conftest.in conftest.tmp conftest.nl conftest.out
260 }
261
262 func_path_progs "sed gsed" func_check_prog_sed $PATH:/usr/xpg4/bin
263 rm -f conftest.sed
264 SED=$func_path_progs_result
265 }
266
267
268 # Unless the user overrides by setting GREP, search the path for either GNU
269 # grep, or the grep that truncates its output the least.
270 test -z "$GREP" && {
271 func_check_prog_grep ()
272 {
273 _G_path_prog=$1
274
275 _G_count=0
276 _G_path_prog_max=0
277 printf 0123456789 >conftest.in
278 while :
279 do
280 cat conftest.in conftest.in >conftest.tmp
281 mv conftest.tmp conftest.in
282 cp conftest.in conftest.nl
283 echo 'GREP' >> conftest.nl
284 "$_G_path_prog" -e 'GREP$' -e '-(cannot match)-' <conftest.nl >conftest.out 2>/dev/null || break
285 diff conftest.out conftest.nl >/dev/null 2>&1 || break
286 _G_count=`expr $_G_count + 1`
287 if test "$_G_count" -gt "$_G_path_prog_max"; then
288 # Best one so far, save it but keep looking for a better one
289 func_check_prog_result=$_G_path_prog
290 _G_path_prog_max=$_G_count
291 fi
292 # 10*(2^10) chars as input seems more than enough
293 test 10 -lt "$_G_count" && break
294 done
295 rm -f conftest.in conftest.tmp conftest.nl conftest.out
296 }
297
298 func_path_progs "grep ggrep" func_check_prog_grep $PATH:/usr/xpg4/bin
299 GREP=$func_path_progs_result
300 }
301
302
303 ## ------------------------------- ##
304 ## User overridable command paths. ##
305 ## ------------------------------- ##
306
307 # All uppercase variable names are used for environment variables. These
308 # variables can be overridden by the user before calling a script that
309 # uses them if a suitable command of that name is not already available
310 # in the command search PATH.
311
312 : ${CP="cp -f"}
313 : ${ECHO="printf %s\n"}
314 : ${EGREP="$GREP -E"}
315 : ${FGREP="$GREP -F"}
316 : ${LN_S="ln -s"}
317 : ${MAKE="make"}
318 : ${MKDIR="mkdir"}
319 : ${MV="mv -f"}
320 : ${RM="rm -f"}
321 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
322
323
324 ## -------------------- ##
325 ## Useful sed snippets. ##
326 ## -------------------- ##
327
328 sed_dirname='s|/[^/]*$||'
329 sed_basename='s|^.*/||'
330
331 # Sed substitution that helps us do robust quoting. It backslashifies
332 # metacharacters that are still active within double-quoted strings.
333 sed_quote_subst='s|\([`"$\\]\)|\\\1|g'
334
335 # Same as above, but do not quote variable references.
336 sed_double_quote_subst='s/\(["`\\]\)/\\\1/g'
337
338 # Sed substitution that turns a string into a regex matching for the
339 # string literally.
340 sed_make_literal_regex='s|[].[^$\\*\/]|\\&|g'
341
342 # Sed substitution that converts a w32 file name or path
343 # that contains forward slashes, into one that contains
344 # (escaped) backslashes. A very naive implementation.
345 sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
346
347 # Re-'\' parameter expansions in output of sed_double_quote_subst that
348 # were '\'-ed in input to the same. If an odd number of '\' preceded a
349 # '$' in input to sed_double_quote_subst, that '$' was protected from
350 # expansion. Since each input '\' is now two '\'s, look for any number
351 # of runs of four '\'s followed by two '\'s and then a '$'. '\' that '$'.
352 _G_bs='\\'
353 _G_bs2='\\\\'
354 _G_bs4='\\\\\\\\'
355 _G_dollar='\$'
356 sed_double_backslash="\
357 s/$_G_bs4/&\\
358 /g
359 s/^$_G_bs2$_G_dollar/$_G_bs&/
360 s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g
361 s/\n//g"
362
363
364 ## ----------------- ##
365 ## Global variables. ##
366 ## ----------------- ##
367
368 # Except for the global variables explicitly listed below, the following
369 # functions in the '^func_' namespace, and the '^require_' namespace
370 # variables initialised in the 'Resource management' section, sourcing
371 # this file will not pollute your global namespace with anything
372 # else. There's no portable way to scope variables in Bourne shell
373 # though, so actually running these functions will sometimes place
374 # results into a variable named after the function, and often use
375 # temporary variables in the '^_G_' namespace. If you are careful to
376 # avoid using those namespaces casually in your sourcing script, things
377 # should continue to work as you expect. And, of course, you can freely
378 # overwrite any of the functions or variables defined here before
379 # calling anything to customize them.
380
381 EXIT_SUCCESS=0
382 EXIT_FAILURE=1
383 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
384 EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
385
386 # Allow overriding, eg assuming that you follow the convention of
387 # putting '$debug_cmd' at the start of all your functions, you can get
388 # bash to show function call trace with:
389 #
390 # debug_cmd='eval echo "${FUNCNAME[0]} $*" >&2' bash your-script-name
391 debug_cmd=${debug_cmd-":"}
392 exit_cmd=:
393
394 # By convention, finish your script with:
395 #
396 # exit $exit_status
397 #
398 # so that you can set exit_status to non-zero if you want to indicate
399 # something went wrong during execution without actually bailing out at
400 # the point of failure.
401 exit_status=$EXIT_SUCCESS
402
403 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
404 # is ksh but when the shell is invoked as "sh" and the current value of
405 # the _XPG environment variable is not equal to 1 (one), the special
406 # positional parameter $0, within a function call, is the name of the
407 # function.
408 progpath=$0
409
410 # The name of this program.
411 progname=`$ECHO "$progpath" |$SED "$sed_basename"`
412
413 # Make sure we have an absolute progpath for reexecution:
414 case $progpath in
415 [\\/]*|[A-Za-z]:\\*) ;;
416 *[\\/]*)
417 progdir=`$ECHO "$progpath" |$SED "$sed_dirname"`
418 progdir=`cd "$progdir" && pwd`
419 progpath=$progdir/$progname
420 ;;
421 *)
422 _G_IFS=$IFS
423 IFS=${PATH_SEPARATOR-:}
424 for progdir in $PATH; do
425 IFS=$_G_IFS
426 test -x "$progdir/$progname" && break
427 done
428 IFS=$_G_IFS
429 test -n "$progdir" || progdir=`pwd`
430 progpath=$progdir/$progname
431 ;;
432 esac
433
434
435 ## ----------------- ##
436 ## Standard options. ##
437 ## ----------------- ##
438
439 # The following options affect the operation of the functions defined
440 # below, and should be set appropriately depending on run-time para-
441 # meters passed on the command line.
442
443 opt_dry_run=false
444 opt_quiet=false
445 opt_verbose=false
446
447 # Categories 'all' and 'none' are always available. Append any others
448 # you will pass as the first argument to func_warning from your own
449 # code.
450 warning_categories=
451
452 # By default, display warnings according to 'opt_warning_types'. Set
453 # 'warning_func' to ':' to elide all warnings, or func_fatal_error to
454 # treat the next displayed warning as a fatal error.
455 warning_func=func_warn_and_continue
456
457 # Set to 'all' to display all warnings, 'none' to suppress all
458 # warnings, or a space delimited list of some subset of
459 # 'warning_categories' to display only the listed warnings.
460 opt_warning_types=all
461
462
463 ## -------------------- ##
464 ## Resource management. ##
465 ## -------------------- ##
466
467 # This section contains definitions for functions that each ensure a
468 # particular resource (a file, or a non-empty configuration variable for
469 # example) is available, and if appropriate to extract default values
470 # from pertinent package files. Call them using their associated
471 # 'require_*' variable to ensure that they are executed, at most, once.
472 #
473 # It's entirely deliberate that calling these functions can set
474 # variables that don't obey the namespace limitations obeyed by the rest
475 # of this file, in order that that they be as useful as possible to
476 # callers.
477
478
479 # require_term_colors
480 # -------------------
481 # Allow display of bold text on terminals that support it.
482 require_term_colors=func_require_term_colors
483 func_require_term_colors ()
484 {
485 $debug_cmd
486
487 test -t 1 && {
488 # COLORTERM and USE_ANSI_COLORS environment variables take
489 # precedence, because most terminfo databases neglect to describe
490 # whether color sequences are supported.
491 test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"}
492
493 if test 1 = "$USE_ANSI_COLORS"; then
494 # Standard ANSI escape sequences
495 tc_reset='\e[0m'
496 tc_bold='\e[1m'; tc_standout='\e[7m'
497 tc_red='\e[31m'; tc_green='\e[32m'
498 tc_blue='\e[34m'; tc_cyan='\e[36m'
499 else
500 # Otherwise trust the terminfo database after all.
501 test -n "`tput sgr0 2>/dev/null`" && {
502 tc_reset=`tput sgr0`
503 test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold`
504 tc_standout=$tc_bold
505 test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso`
506 test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1`
507 test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2`
508 test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4`
509 test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5`
510 }
511 fi
512 }
513
514 require_term_colors=:
515 }
516
517
518 ## ----------------- ##
519 ## Function library. ##
520 ## ----------------- ##
521
522 # This section contains a variety of useful functions to call in your
523 # scripts. Take note of the portable wrappers for features provided by
524 # some modern shells, which will fall back to slower equivalents on
525 # less featureful shells.
526
527
528 # func_append VAR VALUE
529 # ---------------------
530 # Append VALUE onto the existing contents of VAR.
531
532 # We should try to minimise forks, especially on Windows where they are
533 # unreasonably slow, so skip the feature probes when bash or zsh are
534 # being used:
535 if test set = "${BASH_VERSION+set}${ZSH_VERSION+set}"; then
536 : ${_G_HAVE_ARITH_OP="yes"}
537 : ${_G_HAVE_XSI_OPS="yes"}
538 # The += operator was introduced in bash 3.1
539 case $BASH_VERSION in
540 [12].* | 3.0 | 3.0*) ;;
541 *)
542 : ${_G_HAVE_PLUSEQ_OP="yes"}
543 ;;
544 esac
545 fi
546
547 # _G_HAVE_PLUSEQ_OP
548 # Can be empty, in which case the shell is probed, "yes" if += is
549 # useable or anything else if it does not work.
550 test -z "$_G_HAVE_PLUSEQ_OP" \
551 && (eval 'x=a; x+=" b"; test "a b" = "$x"') 2>/dev/null \
552 && _G_HAVE_PLUSEQ_OP=yes
553
554 if test yes = "$_G_HAVE_PLUSEQ_OP"
555 then
556 # This is an XSI compatible shell, allowing a faster implementation...
557 eval 'func_append ()
558 {
559 $debug_cmd
560
561 eval "$1+=\$2"
562 }'
563 else
564 # ...otherwise fall back to using expr, which is often a shell builtin.
565 func_append ()
566 {
567 $debug_cmd
568
569 eval "$1=\$$1\$2"
570 }
571 fi
572
573
574 # func_append_quoted VAR VALUE
575 # ----------------------------
576 # Quote VALUE and append to the end of shell variable VAR, separated
577 # by a space.
578 if test yes = "$_G_HAVE_PLUSEQ_OP"; then
579 eval 'func_append_quoted ()
580 {
581 $debug_cmd
582
583 func_quote_for_eval "$2"
584 eval "$1+=\\ \$func_quote_for_eval_result"
585 }'
586 else
587 func_append_quoted ()
588 {
589 $debug_cmd
590
591 func_quote_for_eval "$2"
592 eval "$1=\$$1\\ \$func_quote_for_eval_result"
593 }
594 fi
595
596
597 # func_append_uniq VAR VALUE
598 # --------------------------
599 # Append unique VALUE onto the existing contents of VAR, assuming
600 # entries are delimited by the first character of VALUE. For example:
601 #
602 # func_append_uniq options " --another-option option-argument"
603 #
604 # will only append to $options if " --another-option option-argument "
605 # is not already present somewhere in $options already (note spaces at
606 # each end implied by leading space in second argument).
607 func_append_uniq ()
608 {
609 $debug_cmd
610
611 eval _G_current_value='`$ECHO $'$1'`'
612 _G_delim=`expr "$2" : '\(.\)'`
613
614 case $_G_delim$_G_current_value$_G_delim in
615 *"$2$_G_delim"*) ;;
616 *) func_append "$@" ;;
617 esac
618 }
619
620
621 # func_arith TERM...
622 # ------------------
623 # Set func_arith_result to the result of evaluating TERMs.
624 test -z "$_G_HAVE_ARITH_OP" \
625 && (eval 'test 2 = $(( 1 + 1 ))') 2>/dev/null \
626 && _G_HAVE_ARITH_OP=yes
627
628 if test yes = "$_G_HAVE_ARITH_OP"; then
629 eval 'func_arith ()
630 {
631 $debug_cmd
632
633 func_arith_result=$(( $* ))
634 }'
635 else
636 func_arith ()
637 {
638 $debug_cmd
639
640 func_arith_result=`expr "$@"`
641 }
642 fi
643
644
645 # func_basename FILE
646 # ------------------
647 # Set func_basename_result to FILE with everything up to and including
648 # the last / stripped.
649 if test yes = "$_G_HAVE_XSI_OPS"; then
650 # If this shell supports suffix pattern removal, then use it to avoid
651 # forking. Hide the definitions single quotes in case the shell chokes
652 # on unsupported syntax...
653 _b='func_basename_result=${1##*/}'
654 _d='case $1 in
655 */*) func_dirname_result=${1%/*}$2 ;;
656 * ) func_dirname_result=$3 ;;
657 esac'
658
659 else
660 # ...otherwise fall back to using sed.
661 _b='func_basename_result=`$ECHO "$1" |$SED "$sed_basename"`'
662 _d='func_dirname_result=`$ECHO "$1" |$SED "$sed_dirname"`
663 if test "X$func_dirname_result" = "X$1"; then
664 func_dirname_result=$3
665 else
666 func_append func_dirname_result "$2"
667 fi'
668 fi
669
670 eval 'func_basename ()
671 {
672 $debug_cmd
673
674 '"$_b"'
675 }'
676
677
678 # func_dirname FILE APPEND NONDIR_REPLACEMENT
679 # -------------------------------------------
680 # Compute the dirname of FILE. If nonempty, add APPEND to the result,
681 # otherwise set result to NONDIR_REPLACEMENT.
682 eval 'func_dirname ()
683 {
684 $debug_cmd
685
686 '"$_d"'
687 }'
688
689
690 # func_dirname_and_basename FILE APPEND NONDIR_REPLACEMENT
691 # --------------------------------------------------------
692 # Perform func_basename and func_dirname in a single function
693 # call:
694 # dirname: Compute the dirname of FILE. If nonempty,
695 # add APPEND to the result, otherwise set result
696 # to NONDIR_REPLACEMENT.
697 # value returned in "$func_dirname_result"
698 # basename: Compute filename of FILE.
699 # value retuned in "$func_basename_result"
700 # For efficiency, we do not delegate to the functions above but instead
701 # duplicate the functionality here.
702 eval 'func_dirname_and_basename ()
703 {
704 $debug_cmd
705
706 '"$_b"'
707 '"$_d"'
708 }'
709
710
711 # func_echo ARG...
712 # ----------------
713 # Echo program name prefixed message.
714 func_echo ()
715 {
716 $debug_cmd
717
718 _G_message=$*
719
720 func_echo_IFS=$IFS
721 IFS=$nl
722 for _G_line in $_G_message; do
723 IFS=$func_echo_IFS
724 $ECHO "$progname: $_G_line"
725 done
726 IFS=$func_echo_IFS
727 }
728
729
730 # func_echo_all ARG...
731 # --------------------
732 # Invoke $ECHO with all args, space-separated.
733 func_echo_all ()
734 {
735 $ECHO "$*"
736 }
737
738
739 # func_echo_infix_1 INFIX ARG...
740 # ------------------------------
741 # Echo program name, followed by INFIX on the first line, with any
742 # additional lines not showing INFIX.
743 func_echo_infix_1 ()
744 {
745 $debug_cmd
746
747 $require_term_colors
748
749 _G_infix=$1; shift
750 _G_indent=$_G_infix
751 _G_prefix="$progname: $_G_infix: "
752 _G_message=$*
753
754 # Strip color escape sequences before counting printable length
755 for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan"
756 do
757 test -n "$_G_tc" && {
758 _G_esc_tc=`$ECHO "$_G_tc" | $SED "$sed_make_literal_regex"`
759 _G_indent=`$ECHO "$_G_indent" | $SED "s|$_G_esc_tc||g"`
760 }
761 done
762 _G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`" " ## exclude from sc_prohibit_nested_quotes
763
764 func_echo_infix_1_IFS=$IFS
765 IFS=$nl
766 for _G_line in $_G_message; do
767 IFS=$func_echo_infix_1_IFS
768 $ECHO "$_G_prefix$tc_bold$_G_line$tc_reset" >&2
769 _G_prefix=$_G_indent
770 done
771 IFS=$func_echo_infix_1_IFS
772 }
773
774
775 # func_error ARG...
776 # -----------------
777 # Echo program name prefixed message to standard error.
778 func_error ()
779 {
780 $debug_cmd
781
782 $require_term_colors
783
784 func_echo_infix_1 " $tc_standout${tc_red}error$tc_reset" "$*" >&2
785 }
786
787
788 # func_fatal_error ARG...
789 # -----------------------
790 # Echo program name prefixed message to standard error, and exit.
791 func_fatal_error ()
792 {
793 $debug_cmd
794
795 func_error "$*"
796 exit $EXIT_FAILURE
797 }
798
799
800 # func_grep EXPRESSION FILENAME
801 # -----------------------------
802 # Check whether EXPRESSION matches any line of FILENAME, without output.
803 func_grep ()
804 {
805 $debug_cmd
806
807 $GREP "$1" "$2" >/dev/null 2>&1
808 }
809
810
811 # func_len STRING
812 # ---------------
813 # Set func_len_result to the length of STRING. STRING may not
814 # start with a hyphen.
815 test -z "$_G_HAVE_XSI_OPS" \
816 && (eval 'x=a/b/c;
817 test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
818 && _G_HAVE_XSI_OPS=yes
819
820 if test yes = "$_G_HAVE_XSI_OPS"; then
821 eval 'func_len ()
822 {
823 $debug_cmd
824
825 func_len_result=${#1}
826 }'
827 else
828 func_len ()
829 {
830 $debug_cmd
831
832 func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len`
833 }
834 fi
835
836
837 # func_mkdir_p DIRECTORY-PATH
838 # ---------------------------
839 # Make sure the entire path to DIRECTORY-PATH is available.
840 func_mkdir_p ()
841 {
842 $debug_cmd
843
844 _G_directory_path=$1
845 _G_dir_list=
846
847 if test -n "$_G_directory_path" && test : != "$opt_dry_run"; then
848
849 # Protect directory names starting with '-'
850 case $_G_directory_path in
851 -*) _G_directory_path=./$_G_directory_path ;;
852 esac
853
854 # While some portion of DIR does not yet exist...
855 while test ! -d "$_G_directory_path"; do
856 # ...make a list in topmost first order. Use a colon delimited
857 # list incase some portion of path contains whitespace.
858 _G_dir_list=$_G_directory_path:$_G_dir_list
859
860 # If the last portion added has no slash in it, the list is done
861 case $_G_directory_path in */*) ;; *) break ;; esac
862
863 # ...otherwise throw away the child directory and loop
864 _G_directory_path=`$ECHO "$_G_directory_path" | $SED -e "$sed_dirname"`
865 done
866 _G_dir_list=`$ECHO "$_G_dir_list" | $SED 's|:*$||'`
867
868 func_mkdir_p_IFS=$IFS; IFS=:
869 for _G_dir in $_G_dir_list; do
870 IFS=$func_mkdir_p_IFS
871 # mkdir can fail with a 'File exist' error if two processes
872 # try to create one of the directories concurrently. Don't
873 # stop in that case!
874 $MKDIR "$_G_dir" 2>/dev/null || :
875 done
876 IFS=$func_mkdir_p_IFS
877
878 # Bail out if we (or some other process) failed to create a directory.
879 test -d "$_G_directory_path" || \
880 func_fatal_error "Failed to create '$1'"
881 fi
882 }
883
884
885 # func_mktempdir [BASENAME]
886 # -------------------------
887 # Make a temporary directory that won't clash with other running
888 # libtool processes, and avoids race conditions if possible. If
889 # given, BASENAME is the basename for that directory.
890 func_mktempdir ()
891 {
892 $debug_cmd
893
894 _G_template=${TMPDIR-/tmp}/${1-$progname}
895
896 if test : = "$opt_dry_run"; then
897 # Return a directory name, but don't create it in dry-run mode
898 _G_tmpdir=$_G_template-$$
899 else
900
901 # If mktemp works, use that first and foremost
902 _G_tmpdir=`mktemp -d "$_G_template-XXXXXXXX" 2>/dev/null`
903
904 if test ! -d "$_G_tmpdir"; then
905 # Failing that, at least try and use $RANDOM to avoid a race
906 _G_tmpdir=$_G_template-${RANDOM-0}$$
907
908 func_mktempdir_umask=`umask`
909 umask 0077
910 $MKDIR "$_G_tmpdir"
911 umask $func_mktempdir_umask
912 fi
913
914 # If we're not in dry-run mode, bomb out on failure
915 test -d "$_G_tmpdir" || \
916 func_fatal_error "cannot create temporary directory '$_G_tmpdir'"
917 fi
918
919 $ECHO "$_G_tmpdir"
920 }
921
922
923 # func_normal_abspath PATH
924 # ------------------------
925 # Remove doubled-up and trailing slashes, "." path components,
926 # and cancel out any ".." path components in PATH after making
927 # it an absolute path.
928 func_normal_abspath ()
929 {
930 $debug_cmd
931
932 # These SED scripts presuppose an absolute path with a trailing slash.
933 _G_pathcar='s|^/\([^/]*\).*$|\1|'
934 _G_pathcdr='s|^/[^/]*||'
935 _G_removedotparts=':dotsl
936 s|/\./|/|g
937 t dotsl
938 s|/\.$|/|'
939 _G_collapseslashes='s|/\{1,\}|/|g'
940 _G_finalslash='s|/*$|/|'
941
942 # Start from root dir and reassemble the path.
943 func_normal_abspath_result=
944 func_normal_abspath_tpath=$1
945 func_normal_abspath_altnamespace=
946 case $func_normal_abspath_tpath in
947 "")
948 # Empty path, that just means $cwd.
949 func_stripname '' '/' "`pwd`"
950 func_normal_abspath_result=$func_stripname_result
951 return
952 ;;
953 # The next three entries are used to spot a run of precisely
954 # two leading slashes without using negated character classes;
955 # we take advantage of case's first-match behaviour.
956 ///*)
957 # Unusual form of absolute path, do nothing.
958 ;;
959 //*)
960 # Not necessarily an ordinary path; POSIX reserves leading '//'
961 # and for example Cygwin uses it to access remote file shares
962 # over CIFS/SMB, so we conserve a leading double slash if found.
963 func_normal_abspath_altnamespace=/
964 ;;
965 /*)
966 # Absolute path, do nothing.
967 ;;
968 *)
969 # Relative path, prepend $cwd.
970 func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
971 ;;
972 esac
973
974 # Cancel out all the simple stuff to save iterations. We also want
975 # the path to end with a slash for ease of parsing, so make sure
976 # there is one (and only one) here.
977 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
978 -e "$_G_removedotparts" -e "$_G_collapseslashes" -e "$_G_finalslash"`
979 while :; do
980 # Processed it all yet?
981 if test / = "$func_normal_abspath_tpath"; then
982 # If we ascended to the root using ".." the result may be empty now.
983 if test -z "$func_normal_abspath_result"; then
984 func_normal_abspath_result=/
985 fi
986 break
987 fi
988 func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
989 -e "$_G_pathcar"`
990 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
991 -e "$_G_pathcdr"`
992 # Figure out what to do with it
993 case $func_normal_abspath_tcomponent in
994 "")
995 # Trailing empty path component, ignore it.
996 ;;
997 ..)
998 # Parent dir; strip last assembled component from result.
999 func_dirname "$func_normal_abspath_result"
1000 func_normal_abspath_result=$func_dirname_result
1001 ;;
1002 *)
1003 # Actual path component, append it.
1004 func_append func_normal_abspath_result "/$func_normal_abspath_tcomponent"
1005 ;;
1006 esac
1007 done
1008 # Restore leading double-slash if one was found on entry.
1009 func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
1010 }
1011
1012
1013 # func_notquiet ARG...
1014 # --------------------
1015 # Echo program name prefixed message only when not in quiet mode.
1016 func_notquiet ()
1017 {
1018 $debug_cmd
1019
1020 $opt_quiet || func_echo ${1+"$@"}
1021
1022 # A bug in bash halts the script if the last line of a function
1023 # fails when set -e is in force, so we need another command to
1024 # work around that:
1025 :
1026 }
1027
1028
1029 # func_relative_path SRCDIR DSTDIR
1030 # --------------------------------
1031 # Set func_relative_path_result to the relative path from SRCDIR to DSTDIR.
1032 func_relative_path ()
1033 {
1034 $debug_cmd
1035
1036 func_relative_path_result=
1037 func_normal_abspath "$1"
1038 func_relative_path_tlibdir=$func_normal_abspath_result
1039 func_normal_abspath "$2"
1040 func_relative_path_tbindir=$func_normal_abspath_result
1041
1042 # Ascend the tree starting from libdir
1043 while :; do
1044 # check if we have found a prefix of bindir
1045 case $func_relative_path_tbindir in
1046 $func_relative_path_tlibdir)
1047 # found an exact match
1048 func_relative_path_tcancelled=
1049 break
1050 ;;
1051 $func_relative_path_tlibdir*)
1052 # found a matching prefix
1053 func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
1054 func_relative_path_tcancelled=$func_stripname_result
1055 if test -z "$func_relative_path_result"; then
1056 func_relative_path_result=.
1057 fi
1058 break
1059 ;;
1060 *)
1061 func_dirname $func_relative_path_tlibdir
1062 func_relative_path_tlibdir=$func_dirname_result
1063 if test -z "$func_relative_path_tlibdir"; then
1064 # Have to descend all the way to the root!
1065 func_relative_path_result=../$func_relative_path_result
1066 func_relative_path_tcancelled=$func_relative_path_tbindir
1067 break
1068 fi
1069 func_relative_path_result=../$func_relative_path_result
1070 ;;
1071 esac
1072 done
1073
1074 # Now calculate path; take care to avoid doubling-up slashes.
1075 func_stripname '' '/' "$func_relative_path_result"
1076 func_relative_path_result=$func_stripname_result
1077 func_stripname '/' '/' "$func_relative_path_tcancelled"
1078 if test -n "$func_stripname_result"; then
1079 func_append func_relative_path_result "/$func_stripname_result"
1080 fi
1081
1082 # Normalisation. If bindir is libdir, return '.' else relative path.
1083 if test -n "$func_relative_path_result"; then
1084 func_stripname './' '' "$func_relative_path_result"
1085 func_relative_path_result=$func_stripname_result
1086 fi
1087
1088 test -n "$func_relative_path_result" || func_relative_path_result=.
1089
1090 :
1091 }
1092
1093
1094 # func_quote_for_eval ARG...
1095 # --------------------------
1096 # Aesthetically quote ARGs to be evaled later.
1097 # This function returns two values:
1098 # i) func_quote_for_eval_result
1099 # double-quoted, suitable for a subsequent eval
1100 # ii) func_quote_for_eval_unquoted_result
1101 # has all characters that are still active within double
1102 # quotes backslashified.
1103 func_quote_for_eval ()
1104 {
1105 $debug_cmd
1106
1107 func_quote_for_eval_unquoted_result=
1108 func_quote_for_eval_result=
1109 while test 0 -lt $#; do
1110 case $1 in
1111 *[\\\`\"\$]*)
1112 _G_unquoted_arg=`printf '%s\n' "$1" |$SED "$sed_quote_subst"` ;;
1113 *)
1114 _G_unquoted_arg=$1 ;;
1115 esac
1116 if test -n "$func_quote_for_eval_unquoted_result"; then
1117 func_append func_quote_for_eval_unquoted_result " $_G_unquoted_arg"
1118 else
1119 func_append func_quote_for_eval_unquoted_result "$_G_unquoted_arg"
1120 fi
1121
1122 case $_G_unquoted_arg in
1123 # Double-quote args containing shell metacharacters to delay
1124 # word splitting, command substitution and variable expansion
1125 # for a subsequent eval.
1126 # Many Bourne shells cannot handle close brackets correctly
1127 # in scan sets, so we specify it separately.
1128 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1129 _G_quoted_arg=\"$_G_unquoted_arg\"
1130 ;;
1131 *)
1132 _G_quoted_arg=$_G_unquoted_arg
1133 ;;
1134 esac
1135
1136 if test -n "$func_quote_for_eval_result"; then
1137 func_append func_quote_for_eval_result " $_G_quoted_arg"
1138 else
1139 func_append func_quote_for_eval_result "$_G_quoted_arg"
1140 fi
1141 shift
1142 done
1143 }
1144
1145
1146 # func_quote_for_expand ARG
1147 # -------------------------
1148 # Aesthetically quote ARG to be evaled later; same as above,
1149 # but do not quote variable references.
1150 func_quote_for_expand ()
1151 {
1152 $debug_cmd
1153
1154 case $1 in
1155 *[\\\`\"]*)
1156 _G_arg=`$ECHO "$1" | $SED \
1157 -e "$sed_double_quote_subst" -e "$sed_double_backslash"` ;;
1158 *)
1159 _G_arg=$1 ;;
1160 esac
1161
1162 case $_G_arg in
1163 # Double-quote args containing shell metacharacters to delay
1164 # word splitting and command substitution for a subsequent eval.
1165 # Many Bourne shells cannot handle close brackets correctly
1166 # in scan sets, so we specify it separately.
1167 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1168 _G_arg=\"$_G_arg\"
1169 ;;
1170 esac
1171
1172 func_quote_for_expand_result=$_G_arg
1173 }
1174
1175
1176 # func_stripname PREFIX SUFFIX NAME
1177 # ---------------------------------
1178 # strip PREFIX and SUFFIX from NAME, and store in func_stripname_result.
1179 # PREFIX and SUFFIX must not contain globbing or regex special
1180 # characters, hashes, percent signs, but SUFFIX may contain a leading
1181 # dot (in which case that matches only a dot).
1182 if test yes = "$_G_HAVE_XSI_OPS"; then
1183 eval 'func_stripname ()
1184 {
1185 $debug_cmd
1186
1187 # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
1188 # positional parameters, so assign one to ordinary variable first.
1189 func_stripname_result=$3
1190 func_stripname_result=${func_stripname_result#"$1"}
1191 func_stripname_result=${func_stripname_result%"$2"}
1192 }'
1193 else
1194 func_stripname ()
1195 {
1196 $debug_cmd
1197
1198 case $2 in
1199 .*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%\\\\$2\$%%"`;;
1200 *) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%$2\$%%"`;;
1201 esac
1202 }
1203 fi
1204
1205
1206 # func_show_eval CMD [FAIL_EXP]
1207 # -----------------------------
1208 # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is
1209 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
1210 # is given, then evaluate it.
1211 func_show_eval ()
1212 {
1213 $debug_cmd
1214
1215 _G_cmd=$1
1216 _G_fail_exp=${2-':'}
1217
1218 func_quote_for_expand "$_G_cmd"
1219 eval "func_notquiet $func_quote_for_expand_result"
1220
1221 $opt_dry_run || {
1222 eval "$_G_cmd"
1223 _G_status=$?
1224 if test 0 -ne "$_G_status"; then
1225 eval "(exit $_G_status); $_G_fail_exp"
1226 fi
1227 }
1228 }
1229
1230
1231 # func_show_eval_locale CMD [FAIL_EXP]
1232 # ------------------------------------
1233 # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is
1234 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
1235 # is given, then evaluate it. Use the saved locale for evaluation.
1236 func_show_eval_locale ()
1237 {
1238 $debug_cmd
1239
1240 _G_cmd=$1
1241 _G_fail_exp=${2-':'}
1242
1243 $opt_quiet || {
1244 func_quote_for_expand "$_G_cmd"
1245 eval "func_echo $func_quote_for_expand_result"
1246 }
1247
1248 $opt_dry_run || {
1249 eval "$_G_user_locale
1250 $_G_cmd"
1251 _G_status=$?
1252 eval "$_G_safe_locale"
1253 if test 0 -ne "$_G_status"; then
1254 eval "(exit $_G_status); $_G_fail_exp"
1255 fi
1256 }
1257 }
1258
1259
1260 # func_tr_sh
1261 # ----------
1262 # Turn $1 into a string suitable for a shell variable name.
1263 # Result is stored in $func_tr_sh_result. All characters
1264 # not in the set a-zA-Z0-9_ are replaced with '_'. Further,
1265 # if $1 begins with a digit, a '_' is prepended as well.
1266 func_tr_sh ()
1267 {
1268 $debug_cmd
1269
1270 case $1 in
1271 [0-9]* | *[!a-zA-Z0-9_]*)
1272 func_tr_sh_result=`$ECHO "$1" | $SED -e 's/^\([0-9]\)/_\1/' -e 's/[^a-zA-Z0-9_]/_/g'`
1273 ;;
1274 * )
1275 func_tr_sh_result=$1
1276 ;;
1277 esac
1278 }
1279
1280
1281 # func_verbose ARG...
1282 # -------------------
1283 # Echo program name prefixed message in verbose mode only.
1284 func_verbose ()
1285 {
1286 $debug_cmd
1287
1288 $opt_verbose && func_echo "$*"
1289
1290 :
1291 }
1292
1293
1294 # func_warn_and_continue ARG...
1295 # -----------------------------
1296 # Echo program name prefixed warning message to standard error.
1297 func_warn_and_continue ()
1298 {
1299 $debug_cmd
1300
1301 $require_term_colors
1302
1303 func_echo_infix_1 "${tc_red}warning$tc_reset" "$*" >&2
1304 }
1305
1306
1307 # func_warning CATEGORY ARG...
1308 # ----------------------------
1309 # Echo program name prefixed warning message to standard error. Warning
1310 # messages can be filtered according to CATEGORY, where this function
1311 # elides messages where CATEGORY is not listed in the global variable
1312 # 'opt_warning_types'.
1313 func_warning ()
1314 {
1315 $debug_cmd
1316
1317 # CATEGORY must be in the warning_categories list!
1318 case " $warning_categories " in
1319 *" $1 "*) ;;
1320 *) func_internal_error "invalid warning category '$1'" ;;
1321 esac
1322
1323 _G_category=$1
1324 shift
1325
1326 case " $opt_warning_types " in
1327 *" $_G_category "*) $warning_func ${1+"$@"} ;;
1328 esac
1329 }
1330
1331
1332 # func_sort_ver VER1 VER2
1333 # -----------------------
1334 # 'sort -V' is not generally available.
1335 # Note this deviates from the version comparison in automake
1336 # in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a
1337 # but this should suffice as we won't be specifying old
1338 # version formats or redundant trailing .0 in bootstrap.conf.
1339 # If we did want full compatibility then we should probably
1340 # use m4_version_compare from autoconf.
1341 func_sort_ver ()
1342 {
1343 $debug_cmd
1344
1345 printf '%s\n%s\n' "$1" "$2" \
1346 | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n -k 5,5n -k 6,6n -k 7,7n -k 8,8n -k 9,9n
1347 }
1348
1349 # func_lt_ver PREV CURR
1350 # ---------------------
1351 # Return true if PREV and CURR are in the correct order according to
1352 # func_sort_ver, otherwise false. Use it like this:
1353 #
1354 # func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..."
1355 func_lt_ver ()
1356 {
1357 $debug_cmd
1358
1359 test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q`
1360 }
1361
1362
1363 # Local variables:
1364 # mode: shell-script
1365 # sh-indentation: 2
1366 # eval: (add-hook 'before-save-hook 'time-stamp)
1367 # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
1368 # time-stamp-time-zone: "UTC"
1369 # End:
1370 #! /bin/sh
1371
1372 # Set a version string for this script.
1373 scriptversion=2014-01-07.03; # UTC
1374
1375 # A portable, pluggable option parser for Bourne shell.
1376 # Written by Gary V. Vaughan, 2010
1377
1378 # Copyright (C) 2010-2015 Free Software Foundation, Inc.
1379 # This is free software; see the source for copying conditions. There is NO
1380 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1381
1382 # This program is free software: you can redistribute it and/or modify
1383 # it under the terms of the GNU General Public License as published by
1384 # the Free Software Foundation, either version 3 of the License, or
1385 # (at your option) any later version.
1386
1387 # This program is distributed in the hope that it will be useful,
1388 # but WITHOUT ANY WARRANTY; without even the implied warranty of
1389 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1390 # GNU General Public License for more details.
1391
1392 # You should have received a copy of the GNU General Public License
1393 # along with this program. If not, see <http://www.gnu.org/licenses/>.
1394
1395 # Please report bugs or propose patches to gary@gnu.org.
1396
1397
1398 ## ------ ##
1399 ## Usage. ##
1400 ## ------ ##
1401
1402 # This file is a library for parsing options in your shell scripts along
1403 # with assorted other useful supporting features that you can make use
1404 # of too.
1405 #
1406 # For the simplest scripts you might need only:
1407 #
1408 # #!/bin/sh
1409 # . relative/path/to/funclib.sh
1410 # . relative/path/to/options-parser
1411 # scriptversion=1.0
1412 # func_options ${1+"$@"}
1413 # eval set dummy "$func_options_result"; shift
1414 # ...rest of your script...
1415 #
1416 # In order for the '--version' option to work, you will need to have a
1417 # suitably formatted comment like the one at the top of this file
1418 # starting with '# Written by ' and ending with '# warranty; '.
1419 #
1420 # For '-h' and '--help' to work, you will also need a one line
1421 # description of your script's purpose in a comment directly above the
1422 # '# Written by ' line, like the one at the top of this file.
1423 #
1424 # The default options also support '--debug', which will turn on shell
1425 # execution tracing (see the comment above debug_cmd below for another
1426 # use), and '--verbose' and the func_verbose function to allow your script
1427 # to display verbose messages only when your user has specified
1428 # '--verbose'.
1429 #
1430 # After sourcing this file, you can plug processing for additional
1431 # options by amending the variables from the 'Configuration' section
1432 # below, and following the instructions in the 'Option parsing'
1433 # section further down.
1434
1435 ## -------------- ##
1436 ## Configuration. ##
1437 ## -------------- ##
1438
1439 # You should override these variables in your script after sourcing this
1440 # file so that they reflect the customisations you have added to the
1441 # option parser.
1442
1443 # The usage line for option parsing errors and the start of '-h' and
1444 # '--help' output messages. You can embed shell variables for delayed
1445 # expansion at the time the message is displayed, but you will need to
1446 # quote other shell meta-characters carefully to prevent them being
1447 # expanded when the contents are evaled.
1448 usage='$progpath [OPTION]...'
1449
1450 # Short help message in response to '-h' and '--help'. Add to this or
1451 # override it after sourcing this library to reflect the full set of
1452 # options your script accepts.
1453 usage_message="\
1454 --debug enable verbose shell tracing
1455 -W, --warnings=CATEGORY
1456 report the warnings falling in CATEGORY [all]
1457 -v, --verbose verbosely report processing
1458 --version print version information and exit
1459 -h, --help print short or long help message and exit
1460 "
1461
1462 # Additional text appended to 'usage_message' in response to '--help'.
1463 long_help_message="
1464 Warning categories include:
1465 'all' show all warnings
1466 'none' turn off all the warnings
1467 'error' warnings are treated as fatal errors"
1468
1469 # Help message printed before fatal option parsing errors.
1470 fatal_help="Try '\$progname --help' for more information."
1471
1472
1473
1474 ## ------------------------- ##
1475 ## Hook function management. ##
1476 ## ------------------------- ##
1477
1478 # This section contains functions for adding, removing, and running hooks
1479 # to the main code. A hook is just a named list of of function, that can
1480 # be run in order later on.
1481
1482 # func_hookable FUNC_NAME
1483 # -----------------------
1484 # Declare that FUNC_NAME will run hooks added with
1485 # 'func_add_hook FUNC_NAME ...'.
1486 func_hookable ()
1487 {
1488 $debug_cmd
1489
1490 func_append hookable_fns " $1"
1491 }
1492
1493
1494 # func_add_hook FUNC_NAME HOOK_FUNC
1495 # ---------------------------------
1496 # Request that FUNC_NAME call HOOK_FUNC before it returns. FUNC_NAME must
1497 # first have been declared "hookable" by a call to 'func_hookable'.
1498 func_add_hook ()
1499 {
1500 $debug_cmd
1501
1502 case " $hookable_fns " in
1503 *" $1 "*) ;;
1504 *) func_fatal_error "'$1' does not accept hook functions." ;;
1505 esac
1506
1507 eval func_append ${1}_hooks '" $2"'
1508 }
1509
1510
1511 # func_remove_hook FUNC_NAME HOOK_FUNC
1512 # ------------------------------------
1513 # Remove HOOK_FUNC from the list of functions called by FUNC_NAME.
1514 func_remove_hook ()
1515 {
1516 $debug_cmd
1517
1518 eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`'
1519 }
1520
1521
1522 # func_run_hooks FUNC_NAME [ARG]...
1523 # ---------------------------------
1524 # Run all hook functions registered to FUNC_NAME.
1525 # It is assumed that the list of hook functions contains nothing more
1526 # than a whitespace-delimited list of legal shell function names, and
1527 # no effort is wasted trying to catch shell meta-characters or preserve
1528 # whitespace.
1529 func_run_hooks ()
1530 {
1531 $debug_cmd
1532
1533 case " $hookable_fns " in
1534 *" $1 "*) ;;
1535 *) func_fatal_error "'$1' does not support hook funcions.n" ;;
1536 esac
1537
1538 eval _G_hook_fns=\$$1_hooks; shift
1539
1540 for _G_hook in $_G_hook_fns; do
1541 eval $_G_hook '"$@"'
1542
1543 # store returned options list back into positional
1544 # parameters for next 'cmd' execution.
1545 eval _G_hook_result=\$${_G_hook}_result
1546 eval set dummy "$_G_hook_result"; shift
1547 done
1548
1549 func_quote_for_eval ${1+"$@"}
1550 func_run_hooks_result=$func_quote_for_eval_result
1551 }
1552
1553
1554
1555 ## --------------- ##
1556 ## Option parsing. ##
1557 ## --------------- ##
1558
1559 # In order to add your own option parsing hooks, you must accept the
1560 # full positional parameter list in your hook function, remove any
1561 # options that you action, and then pass back the remaining unprocessed
1562 # options in '<hooked_function_name>_result', escaped suitably for
1563 # 'eval'. Like this:
1564 #
1565 # my_options_prep ()
1566 # {
1567 # $debug_cmd
1568 #
1569 # # Extend the existing usage message.
1570 # usage_message=$usage_message'
1571 # -s, --silent don'\''t print informational messages
1572 # '
1573 #
1574 # func_quote_for_eval ${1+"$@"}
1575 # my_options_prep_result=$func_quote_for_eval_result
1576 # }
1577 # func_add_hook func_options_prep my_options_prep
1578 #
1579 #
1580 # my_silent_option ()
1581 # {
1582 # $debug_cmd
1583 #
1584 # # Note that for efficiency, we parse as many options as we can
1585 # # recognise in a loop before passing the remainder back to the
1586 # # caller on the first unrecognised argument we encounter.
1587 # while test $# -gt 0; do
1588 # opt=$1; shift
1589 # case $opt in
1590 # --silent|-s) opt_silent=: ;;
1591 # # Separate non-argument short options:
1592 # -s*) func_split_short_opt "$_G_opt"
1593 # set dummy "$func_split_short_opt_name" \
1594 # "-$func_split_short_opt_arg" ${1+"$@"}
1595 # shift
1596 # ;;
1597 # *) set dummy "$_G_opt" "$*"; shift; break ;;
1598 # esac
1599 # done
1600 #
1601 # func_quote_for_eval ${1+"$@"}
1602 # my_silent_option_result=$func_quote_for_eval_result
1603 # }
1604 # func_add_hook func_parse_options my_silent_option
1605 #
1606 #
1607 # my_option_validation ()
1608 # {
1609 # $debug_cmd
1610 #
1611 # $opt_silent && $opt_verbose && func_fatal_help "\
1612 # '--silent' and '--verbose' options are mutually exclusive."
1613 #
1614 # func_quote_for_eval ${1+"$@"}
1615 # my_option_validation_result=$func_quote_for_eval_result
1616 # }
1617 # func_add_hook func_validate_options my_option_validation
1618 #
1619 # You'll alse need to manually amend $usage_message to reflect the extra
1620 # options you parse. It's preferable to append if you can, so that
1621 # multiple option parsing hooks can be added safely.
1622
1623
1624 # func_options [ARG]...
1625 # ---------------------
1626 # All the functions called inside func_options are hookable. See the
1627 # individual implementations for details.
1628 func_hookable func_options
1629 func_options ()
1630 {
1631 $debug_cmd
1632
1633 func_options_prep ${1+"$@"}
1634 eval func_parse_options \
1635 ${func_options_prep_result+"$func_options_prep_result"}
1636 eval func_validate_options \
1637 ${func_parse_options_result+"$func_parse_options_result"}
1638
1639 eval func_run_hooks func_options \
1640 ${func_validate_options_result+"$func_validate_options_result"}
1641
1642 # save modified positional parameters for caller
1643 func_options_result=$func_run_hooks_result
1644 }
1645
1646
1647 # func_options_prep [ARG]...
1648 # --------------------------
1649 # All initialisations required before starting the option parse loop.
1650 # Note that when calling hook functions, we pass through the list of
1651 # positional parameters. If a hook function modifies that list, and
1652 # needs to propogate that back to rest of this script, then the complete
1653 # modified list must be put in 'func_run_hooks_result' before
1654 # returning.
1655 func_hookable func_options_prep
1656 func_options_prep ()
1657 {
1658 $debug_cmd
1659
1660 # Option defaults:
1661 opt_verbose=false
1662 opt_warning_types=
1663
1664 func_run_hooks func_options_prep ${1+"$@"}
1665
1666 # save modified positional parameters for caller
1667 func_options_prep_result=$func_run_hooks_result
1668 }
1669
1670
1671 # func_parse_options [ARG]...
1672 # ---------------------------
1673 # The main option parsing loop.
1674 func_hookable func_parse_options
1675 func_parse_options ()
1676 {
1677 $debug_cmd
1678
1679 func_parse_options_result=
1680
1681 # this just eases exit handling
1682 while test $# -gt 0; do
1683 # Defer to hook functions for initial option parsing, so they
1684 # get priority in the event of reusing an option name.
1685 func_run_hooks func_parse_options ${1+"$@"}
1686
1687 # Adjust func_parse_options positional parameters to match
1688 eval set dummy "$func_run_hooks_result"; shift
1689
1690 # Break out of the loop if we already parsed every option.
1691 test $# -gt 0 || break
1692
1693 _G_opt=$1
1694 shift
1695 case $_G_opt in
1696 --debug|-x) debug_cmd='set -x'
1697 func_echo "enabling shell trace mode"
1698 $debug_cmd
1699 ;;
1700
1701 --no-warnings|--no-warning|--no-warn)
1702 set dummy --warnings none ${1+"$@"}
1703 shift
1704 ;;
1705
1706 --warnings|--warning|-W)
1707 test $# = 0 && func_missing_arg $_G_opt && break
1708 case " $warning_categories $1" in
1709 *" $1 "*)
1710 # trailing space prevents matching last $1 above
1711 func_append_uniq opt_warning_types " $1"
1712 ;;
1713 *all)
1714 opt_warning_types=$warning_categories
1715 ;;
1716 *none)
1717 opt_warning_types=none
1718 warning_func=:
1719 ;;
1720 *error)
1721 opt_warning_types=$warning_categories
1722 warning_func=func_fatal_error
1723 ;;
1724 *)
1725 func_fatal_error \
1726 "unsupported warning category: '$1'"
1727 ;;
1728 esac
1729 shift
1730 ;;
1731
1732 --verbose|-v) opt_verbose=: ;;
1733 --version) func_version ;;
1734 -\?|-h) func_usage ;;
1735 --help) func_help ;;
1736
1737 # Separate optargs to long options (plugins may need this):
1738 --*=*) func_split_equals "$_G_opt"
1739 set dummy "$func_split_equals_lhs" \
1740 "$func_split_equals_rhs" ${1+"$@"}
1741 shift
1742 ;;
1743
1744 # Separate optargs to short options:
1745 -W*)
1746 func_split_short_opt "$_G_opt"
1747 set dummy "$func_split_short_opt_name" \
1748 "$func_split_short_opt_arg" ${1+"$@"}
1749 shift
1750 ;;
1751
1752 # Separate non-argument short options:
1753 -\?*|-h*|-v*|-x*)
1754 func_split_short_opt "$_G_opt"
1755 set dummy "$func_split_short_opt_name" \
1756 "-$func_split_short_opt_arg" ${1+"$@"}
1757 shift
1758 ;;
1759
1760 --) break ;;
1761 -*) func_fatal_help "unrecognised option: '$_G_opt'" ;;
1762 *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;;
1763 esac
1764 done
1765
1766 # save modified positional parameters for caller
1767 func_quote_for_eval ${1+"$@"}
1768 func_parse_options_result=$func_quote_for_eval_result
1769 }
1770
1771
1772 # func_validate_options [ARG]...
1773 # ------------------------------
1774 # Perform any sanity checks on option settings and/or unconsumed
1775 # arguments.
1776 func_hookable func_validate_options
1777 func_validate_options ()
1778 {
1779 $debug_cmd
1780
1781 # Display all warnings if -W was not given.
1782 test -n "$opt_warning_types" || opt_warning_types=" $warning_categories"
1783
1784 func_run_hooks func_validate_options ${1+"$@"}
1785
1786 # Bail if the options were screwed!
1787 $exit_cmd $EXIT_FAILURE
1788
1789 # save modified positional parameters for caller
1790 func_validate_options_result=$func_run_hooks_result
1791 }
1792
1793
1794
1795 ## ----------------- ##
1796 ## Helper functions. ##
1797 ## ----------------- ##
1798
1799 # This section contains the helper functions used by the rest of the
1800 # hookable option parser framework in ascii-betical order.
1801
1802
1803 # func_fatal_help ARG...
1804 # ----------------------
1805 # Echo program name prefixed message to standard error, followed by
1806 # a help hint, and exit.
1807 func_fatal_help ()
1808 {
1809 $debug_cmd
1810
1811 eval \$ECHO \""Usage: $usage"\"
1812 eval \$ECHO \""$fatal_help"\"
1813 func_error ${1+"$@"}
1814 exit $EXIT_FAILURE
1815 }
1816
1817
1818 # func_help
1819 # ---------
1820 # Echo long help message to standard output and exit.
1821 func_help ()
1822 {
1823 $debug_cmd
1824
1825 func_usage_message
1826 $ECHO "$long_help_message"
1827 exit 0
1828 }
1829
1830
1831 # func_missing_arg ARGNAME
1832 # ------------------------
1833 # Echo program name prefixed message to standard error and set global
1834 # exit_cmd.
1835 func_missing_arg ()
1836 {
1837 $debug_cmd
1838
1839 func_error "Missing argument for '$1'."
1840 exit_cmd=exit
1841 }
1842
1843
1844 # func_split_equals STRING
1845 # ------------------------
1846 # Set func_split_equals_lhs and func_split_equals_rhs shell variables after
1847 # splitting STRING at the '=' sign.
1848 test -z "$_G_HAVE_XSI_OPS" \
1849 && (eval 'x=a/b/c;
1850 test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
1851 && _G_HAVE_XSI_OPS=yes
1852
1853 if test yes = "$_G_HAVE_XSI_OPS"
1854 then
1855 # This is an XSI compatible shell, allowing a faster implementation...
1856 eval 'func_split_equals ()
1857 {
1858 $debug_cmd
1859
1860 func_split_equals_lhs=${1%%=*}
1861 func_split_equals_rhs=${1#*=}
1862 test "x$func_split_equals_lhs" = "x$1" \
1863 && func_split_equals_rhs=
1864 }'
1865 else
1866 # ...otherwise fall back to using expr, which is often a shell builtin.
1867 func_split_equals ()
1868 {
1869 $debug_cmd
1870
1871 func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'`
1872 func_split_equals_rhs=
1873 test "x$func_split_equals_lhs" = "x$1" \
1874 || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'`
1875 }
1876 fi #func_split_equals
1877
1878
1879 # func_split_short_opt SHORTOPT
1880 # -----------------------------
1881 # Set func_split_short_opt_name and func_split_short_opt_arg shell
1882 # variables after splitting SHORTOPT after the 2nd character.
1883 if test yes = "$_G_HAVE_XSI_OPS"
1884 then
1885 # This is an XSI compatible shell, allowing a faster implementation...
1886 eval 'func_split_short_opt ()
1887 {
1888 $debug_cmd
1889
1890 func_split_short_opt_arg=${1#??}
1891 func_split_short_opt_name=${1%"$func_split_short_opt_arg"}
1892 }'
1893 else
1894 # ...otherwise fall back to using expr, which is often a shell builtin.
1895 func_split_short_opt ()
1896 {
1897 $debug_cmd
1898
1899 func_split_short_opt_name=`expr "x$1" : 'x-\(.\)'`
1900 func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'`
1901 }
1902 fi #func_split_short_opt
1903
1904
1905 # func_usage
1906 # ----------
1907 # Echo short help message to standard output and exit.
1908 func_usage ()
1909 {
1910 $debug_cmd
1911
1912 func_usage_message
1913 $ECHO "Run '$progname --help |${PAGER-more}' for full usage"
1914 exit 0
1915 }
1916
1917
1918 # func_usage_message
1919 # ------------------
1920 # Echo short help message to standard output.
1921 func_usage_message ()
1922 {
1923 $debug_cmd
1924
1925 eval \$ECHO \""Usage: $usage"\"
1926 echo
1927 $SED -n 's|^# ||
1928 /^Written by/{
1929 x;p;x
1930 }
1931 h
1932 /^Written by/q' < "$progpath"
1933 echo
1934 eval \$ECHO \""$usage_message"\"
1935 }
1936
1937
1938 # func_version
1939 # ------------
1940 # Echo version message to standard output and exit.
1941 func_version ()
1942 {
1943 $debug_cmd
1944
1945 printf '%s\n' "$progname $scriptversion"
1946 $SED -n '
1947 /(C)/!b go
1948 :more
1949 /\./!{
1950 N
1951 s|\n# | |
1952 b more
1953 }
1954 :go
1955 /^# Written by /,/# warranty; / {
1956 s|^# ||
1957 s|^# *$||
1958 s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2|
1959 p
1960 }
1961 /^# Written by / {
1962 s|^# ||
1963 p
1964 }
1965 /^warranty; /q' < "$progpath"
1966
1967 exit $?
1968 }
1969
1970
1971 # Local variables:
1972 # mode: shell-script
1973 # sh-indentation: 2
1974 # eval: (add-hook 'before-save-hook 'time-stamp)
1975 # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
1976 # time-stamp-time-zone: "UTC"
1977 # End:
1978
1979 # Set a version string.
1980 scriptversion='(GNU libtool) 2.4.6'
1981
1982
1983 # func_echo ARG...
1984 # ----------------
1985 # Libtool also displays the current mode in messages, so override
1986 # funclib.sh func_echo with this custom definition.
1987 func_echo ()
1988 {
1989 $debug_cmd
1990
1991 _G_message=$*
1992
1993 func_echo_IFS=$IFS
1994 IFS=$nl
1995 for _G_line in $_G_message; do
1996 IFS=$func_echo_IFS
1997 $ECHO "$progname${opt_mode+: $opt_mode}: $_G_line"
1998 done
1999 IFS=$func_echo_IFS
2000 }
2001
2002
2003 # func_warning ARG...
2004 # -------------------
2005 # Libtool warnings are not categorized, so override funclib.sh
2006 # func_warning with this simpler definition.
2007 func_warning ()
2008 {
2009 $debug_cmd
2010
2011 $warning_func ${1+"$@"}
2012 }
2013
2014
2015 ## ---------------- ##
2016 ## Options parsing. ##
2017 ## ---------------- ##
2018
2019 # Hook in the functions to make sure our own options are parsed during
2020 # the option parsing loop.
2021
2022 usage='$progpath [OPTION]... [MODE-ARG]...'
2023
2024 # Short help message in response to '-h'.
2025 usage_message="Options:
2026 --config show all configuration variables
2027 --debug enable verbose shell tracing
2028 -n, --dry-run display commands without modifying any files
2029 --features display basic configuration information and exit
2030 --mode=MODE use operation mode MODE
2031 --no-warnings equivalent to '-Wnone'
2032 --preserve-dup-deps don't remove duplicate dependency libraries
2033 --quiet, --silent don't print informational messages
2034 --tag=TAG use configuration variables from tag TAG
2035 -v, --verbose print more informational messages than default
2036 --version print version information
2037 -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all]
2038 -h, --help, --help-all print short, long, or detailed help message
2039 "
2040
2041 # Additional text appended to 'usage_message' in response to '--help'.
2042 func_help ()
2043 {
2044 $debug_cmd
2045
2046 func_usage_message
2047 $ECHO "$long_help_message
2048
2049 MODE must be one of the following:
2050
2051 clean remove files from the build directory
2052 compile compile a source file into a libtool object
2053 execute automatically set library path, then run a program
2054 finish complete the installation of libtool libraries
2055 install install libraries or executables
2056 link create a library or an executable
2057 uninstall remove libraries from an installed directory
2058
2059 MODE-ARGS vary depending on the MODE. When passed as first option,
2060 '--mode=MODE' may be abbreviated as 'MODE' or a unique abbreviation of that.
2061 Try '$progname --help --mode=MODE' for a more detailed description of MODE.
2062
2063 When reporting a bug, please describe a test case to reproduce it and
2064 include the following information:
2065
2066 host-triplet: $host
2067 shell: $SHELL
2068 compiler: $LTCC
2069 compiler flags: $LTCFLAGS
2070 linker: $LD (gnu? $with_gnu_ld)
2071 version: $progname $scriptversion Debian-2.4.6-2
2072 automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q`
2073 autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q`
2074
2075 Report bugs to <bug-libtool@gnu.org>.
2076 GNU libtool home page: <http://www.gnu.org/s/libtool/>.
2077 General help using GNU software: <http://www.gnu.org/gethelp/>."
2078 exit 0
2079 }
2080
2081
2082 # func_lo2o OBJECT-NAME
2083 # ---------------------
2084 # Transform OBJECT-NAME from a '.lo' suffix to the platform specific
2085 # object suffix.
2086
2087 lo2o=s/\\.lo\$/.$objext/
2088 o2lo=s/\\.$objext\$/.lo/
2089
2090 if test yes = "$_G_HAVE_XSI_OPS"; then
2091 eval 'func_lo2o ()
2092 {
2093 case $1 in
2094 *.lo) func_lo2o_result=${1%.lo}.$objext ;;
2095 * ) func_lo2o_result=$1 ;;
2096 esac
2097 }'
2098
2099 # func_xform LIBOBJ-OR-SOURCE
2100 # ---------------------------
2101 # Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise)
2102 # suffix to a '.lo' libtool-object suffix.
2103 eval 'func_xform ()
2104 {
2105 func_xform_result=${1%.*}.lo
2106 }'
2107 else
2108 # ...otherwise fall back to using sed.
2109 func_lo2o ()
2110 {
2111 func_lo2o_result=`$ECHO "$1" | $SED "$lo2o"`
2112 }
2113
2114 func_xform ()
2115 {
2116 func_xform_result=`$ECHO "$1" | $SED 's|\.[^.]*$|.lo|'`
2117 }
2118 fi
2119
2120
2121 # func_fatal_configuration ARG...
2122 # -------------------------------
2123 # Echo program name prefixed message to standard error, followed by
2124 # a configuration failure hint, and exit.
2125 func_fatal_configuration ()
2126 {
2127 func__fatal_error ${1+"$@"} \
2128 "See the $PACKAGE documentation for more information." \
2129 "Fatal configuration error."
2130 }
2131
2132
2133 # func_config
2134 # -----------
2135 # Display the configuration for all the tags in this script.
2136 func_config ()
2137 {
2138 re_begincf='^# ### BEGIN LIBTOOL'
2139 re_endcf='^# ### END LIBTOOL'
2140
2141 # Default configuration.
2142 $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
2143
2144 # Now print the configurations for the tags.
2145 for tagname in $taglist; do
2146 $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
2147 done
2148
2149 exit $?
2150 }
2151
2152
2153 # func_features
2154 # -------------
2155 # Display the features supported by this script.
2156 func_features ()
2157 {
2158 echo "host: $host"
2159 if test yes = "$build_libtool_libs"; then
2160 echo "enable shared libraries"
2161 else
2162 echo "disable shared libraries"
2163 fi
2164 if test yes = "$build_old_libs"; then
2165 echo "enable static libraries"
2166 else
2167 echo "disable static libraries"
2168 fi
2169
2170 exit $?
2171 }
2172
2173
2174 # func_enable_tag TAGNAME
2175 # -----------------------
2176 # Verify that TAGNAME is valid, and either flag an error and exit, or
2177 # enable the TAGNAME tag. We also add TAGNAME to the global $taglist
2178 # variable here.
2179 func_enable_tag ()
2180 {
2181 # Global variable:
2182 tagname=$1
2183
2184 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
2185 re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
2186 sed_extractcf=/$re_begincf/,/$re_endcf/p
2187
2188 # Validate tagname.
2189 case $tagname in
2190 *[!-_A-Za-z0-9,/]*)
2191 func_fatal_error "invalid tag name: $tagname"
2192 ;;
2193 esac
2194
2195 # Don't test for the "default" C tag, as we know it's
2196 # there but not specially marked.
2197 case $tagname in
2198 CC) ;;
2199 *)
2200 if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
2201 taglist="$taglist $tagname"
2202
2203 # Evaluate the configuration. Be careful to quote the path
2204 # and the sed script, to avoid splitting on whitespace, but
2205 # also don't use non-portable quotes within backquotes within
2206 # quotes we have to do it in 2 steps:
2207 extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
2208 eval "$extractedcf"
2209 else
2210 func_error "ignoring unknown tag $tagname"
2211 fi
2212 ;;
2213 esac
2214 }
2215
2216
2217 # func_check_version_match
2218 # ------------------------
2219 # Ensure that we are using m4 macros, and libtool script from the same
2220 # release of libtool.
2221 func_check_version_match ()
2222 {
2223 if test "$package_revision" != "$macro_revision"; then
2224 if test "$VERSION" != "$macro_version"; then
2225 if test -z "$macro_version"; then
2226 cat >&2 <<_LT_EOF
2227 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
2228 $progname: definition of this LT_INIT comes from an older release.
2229 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
2230 $progname: and run autoconf again.
2231 _LT_EOF
2232 else
2233 cat >&2 <<_LT_EOF
2234 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
2235 $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
2236 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
2237 $progname: and run autoconf again.
2238 _LT_EOF
2239 fi
2240 else
2241 cat >&2 <<_LT_EOF
2242 $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
2243 $progname: but the definition of this LT_INIT comes from revision $macro_revision.
2244 $progname: You should recreate aclocal.m4 with macros from revision $package_revision
2245 $progname: of $PACKAGE $VERSION and run autoconf again.
2246 _LT_EOF
2247 fi
2248
2249 exit $EXIT_MISMATCH
2250 fi
2251 }
2252
2253
2254 # libtool_options_prep [ARG]...
2255 # -----------------------------
2256 # Preparation for options parsed by libtool.
2257 libtool_options_prep ()
2258 {
2259 $debug_mode
2260
2261 # Option defaults:
2262 opt_config=false
2263 opt_dlopen=
2264 opt_dry_run=false
2265 opt_help=false
2266 opt_mode=
2267 opt_preserve_dup_deps=false
2268 opt_quiet=false
2269
2270 nonopt=
2271 preserve_args=
2272
2273 # Shorthand for --mode=foo, only valid as the first argument
2274 case $1 in
2275 clean|clea|cle|cl)
2276 shift; set dummy --mode clean ${1+"$@"}; shift
2277 ;;
2278 compile|compil|compi|comp|com|co|c)
2279 shift; set dummy --mode compile ${1+"$@"}; shift
2280 ;;
2281 execute|execut|execu|exec|exe|ex|e)
2282 shift; set dummy --mode execute ${1+"$@"}; shift
2283 ;;
2284 finish|finis|fini|fin|fi|f)
2285 shift; set dummy --mode finish ${1+"$@"}; shift
2286 ;;
2287 install|instal|insta|inst|ins|in|i)
2288 shift; set dummy --mode install ${1+"$@"}; shift
2289 ;;
2290 link|lin|li|l)
2291 shift; set dummy --mode link ${1+"$@"}; shift
2292 ;;
2293 uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
2294 shift; set dummy --mode uninstall ${1+"$@"}; shift
2295 ;;
2296 esac
2297
2298 # Pass back the list of options.
2299 func_quote_for_eval ${1+"$@"}
2300 libtool_options_prep_result=$func_quote_for_eval_result
2301 }
2302 func_add_hook func_options_prep libtool_options_prep
2303
2304
2305 # libtool_parse_options [ARG]...
2306 # ---------------------------------
2307 # Provide handling for libtool specific options.
2308 libtool_parse_options ()
2309 {
2310 $debug_cmd
2311
2312 # Perform our own loop to consume as many options as possible in
2313 # each iteration.
2314 while test $# -gt 0; do
2315 _G_opt=$1
2316 shift
2317 case $_G_opt in
2318 --dry-run|--dryrun|-n)
2319 opt_dry_run=:
2320 ;;
2321
2322 --config) func_config ;;
2323
2324 --dlopen|-dlopen)
2325 opt_dlopen="${opt_dlopen+$opt_dlopen
2326 }$1"
2327 shift
2328 ;;
2329
2330 --preserve-dup-deps)
2331 opt_preserve_dup_deps=: ;;
2332
2333 --features) func_features ;;
2334
2335 --finish) set dummy --mode finish ${1+"$@"}; shift ;;
2336
2337 --help) opt_help=: ;;
2338
2339 --help-all) opt_help=': help-all' ;;
2340
2341 --mode) test $# = 0 && func_missing_arg $_G_opt && break
2342 opt_mode=$1
2343 case $1 in
2344 # Valid mode arguments:
2345 clean|compile|execute|finish|install|link|relink|uninstall) ;;
2346
2347 # Catch anything else as an error
2348 *) func_error "invalid argument for $_G_opt"
2349 exit_cmd=exit
2350 break
2351 ;;
2352 esac
2353 shift
2354 ;;
2355
2356 --no-silent|--no-quiet)
2357 opt_quiet=false
2358 func_append preserve_args " $_G_opt"
2359 ;;
2360
2361 --no-warnings|--no-warning|--no-warn)
2362 opt_warning=false
2363 func_append preserve_args " $_G_opt"
2364 ;;
2365
2366 --no-verbose)
2367 opt_verbose=false
2368 func_append preserve_args " $_G_opt"
2369 ;;
2370
2371 --silent|--quiet)
2372 opt_quiet=:
2373 opt_verbose=false
2374 func_append preserve_args " $_G_opt"
2375 ;;
2376
2377 --tag) test $# = 0 && func_missing_arg $_G_opt && break
2378 opt_tag=$1
2379 func_append preserve_args " $_G_opt $1"
2380 func_enable_tag "$1"
2381 shift
2382 ;;
2383
2384 --verbose|-v) opt_quiet=false
2385 opt_verbose=:
2386 func_append preserve_args " $_G_opt"
2387 ;;
2388
2389 # An option not handled by this hook function:
2390 *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;;
2391 esac
2392 done
2393
2394
2395 # save modified positional parameters for caller
2396 func_quote_for_eval ${1+"$@"}
2397 libtool_parse_options_result=$func_quote_for_eval_result
2398 }
2399 func_add_hook func_parse_options libtool_parse_options
2400
2401
2402
2403 # libtool_validate_options [ARG]...
2404 # ---------------------------------
2405 # Perform any sanity checks on option settings and/or unconsumed
2406 # arguments.
2407 libtool_validate_options ()
2408 {
2409 # save first non-option argument
2410 if test 0 -lt $#; then
2411 nonopt=$1
2412 shift
2413 fi
2414
2415 # preserve --debug
2416 test : = "$debug_cmd" || func_append preserve_args " --debug"
2417
2418 case $host in
2419 # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452
2420 # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788
2421 *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*)
2422 # don't eliminate duplications in $postdeps and $predeps
2423 opt_duplicate_compiler_generated_deps=:
2424 ;;
2425 *)
2426 opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
2427 ;;
2428 esac
2429
2430 $opt_help || {
2431 # Sanity checks first:
2432 func_check_version_match
2433
2434 test yes != "$build_libtool_libs" \
2435 && test yes != "$build_old_libs" \
2436 && func_fatal_configuration "not configured to build any kind of library"
2437
2438 # Darwin sucks
2439 eval std_shrext=\"$shrext_cmds\"
2440
2441 # Only execute mode is allowed to have -dlopen flags.
2442 if test -n "$opt_dlopen" && test execute != "$opt_mode"; then
2443 func_error "unrecognized option '-dlopen'"
2444 $ECHO "$help" 1>&2
2445 exit $EXIT_FAILURE
2446 fi
2447
2448 # Change the help message to a mode-specific one.
2449 generic_help=$help
2450 help="Try '$progname --help --mode=$opt_mode' for more information."
2451 }
2452
2453 # Pass back the unparsed argument list
2454 func_quote_for_eval ${1+"$@"}
2455 libtool_validate_options_result=$func_quote_for_eval_result
2456 }
2457 func_add_hook func_validate_options libtool_validate_options
2458
2459
2460 # Process options as early as possible so that --help and --version
2461 # can return quickly.
2462 func_options ${1+"$@"}
2463 eval set dummy "$func_options_result"; shift
2464
2465
2466
2467 ## ----------- ##
2468 ## Main. ##
2469 ## ----------- ##
2470
2471 magic='%%%MAGIC variable%%%'
2472 magic_exe='%%%MAGIC EXE variable%%%'
2473
2474 # Global variables.
2475 extracted_archives=
2476 extracted_serial=0
2477
2478 # If this variable is set in any of the actions, the command in it
2479 # will be execed at the end. This prevents here-documents from being
2480 # left over by shells.
2481 exec_cmd=
2482
2483
2484 # A function that is used when there is no print builtin or printf.
2485 func_fallback_echo ()
2486 {
2487 eval 'cat <<_LTECHO_EOF
2488 $1
2489 _LTECHO_EOF'
2490 }
2491
2492 # func_generated_by_libtool
2493 # True iff stdin has been generated by Libtool. This function is only
2494 # a basic sanity check; it will hardly flush out determined imposters.
2495 func_generated_by_libtool_p ()
2496 {
2497 $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
2498 }
2499
2500 # func_lalib_p file
2501 # True iff FILE is a libtool '.la' library or '.lo' object file.
2502 # This function is only a basic sanity check; it will hardly flush out
2503 # determined imposters.
2504 func_lalib_p ()
2505 {
2506 test -f "$1" &&
2507 $SED -e 4q "$1" 2>/dev/null | func_generated_by_libtool_p
2508 }
2509
2510 # func_lalib_unsafe_p file
2511 # True iff FILE is a libtool '.la' library or '.lo' object file.
2512 # This function implements the same check as func_lalib_p without
2513 # resorting to external programs. To this end, it redirects stdin and
2514 # closes it afterwards, without saving the original file descriptor.
2515 # As a safety measure, use it only where a negative result would be
2516 # fatal anyway. Works if 'file' does not exist.
2517 func_lalib_unsafe_p ()
2518 {
2519 lalib_p=no
2520 if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
2521 for lalib_p_l in 1 2 3 4
2522 do
2523 read lalib_p_line
2524 case $lalib_p_line in
2525 \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
2526 esac
2527 done
2528 exec 0<&5 5<&-
2529 fi
2530 test yes = "$lalib_p"
2531 }
2532
2533 # func_ltwrapper_script_p file
2534 # True iff FILE is a libtool wrapper script
2535 # This function is only a basic sanity check; it will hardly flush out
2536 # determined imposters.
2537 func_ltwrapper_script_p ()
2538 {
2539 test -f "$1" &&
2540 $lt_truncate_bin < "$1" 2>/dev/null | func_generated_by_libtool_p
2541 }
2542
2543 # func_ltwrapper_executable_p file
2544 # True iff FILE is a libtool wrapper executable
2545 # This function is only a basic sanity check; it will hardly flush out
2546 # determined imposters.
2547 func_ltwrapper_executable_p ()
2548 {
2549 func_ltwrapper_exec_suffix=
2550 case $1 in
2551 *.exe) ;;
2552 *) func_ltwrapper_exec_suffix=.exe ;;
2553 esac
2554 $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
2555 }
2556
2557 # func_ltwrapper_scriptname file
2558 # Assumes file is an ltwrapper_executable
2559 # uses $file to determine the appropriate filename for a
2560 # temporary ltwrapper_script.
2561 func_ltwrapper_scriptname ()
2562 {
2563 func_dirname_and_basename "$1" "" "."
2564 func_stripname '' '.exe' "$func_basename_result"
2565 func_ltwrapper_scriptname_result=$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper
2566 }
2567
2568 # func_ltwrapper_p file
2569 # True iff FILE is a libtool wrapper script or wrapper executable
2570 # This function is only a basic sanity check; it will hardly flush out
2571 # determined imposters.
2572 func_ltwrapper_p ()
2573 {
2574 func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
2575 }
2576
2577
2578 # func_execute_cmds commands fail_cmd
2579 # Execute tilde-delimited COMMANDS.
2580 # If FAIL_CMD is given, eval that upon failure.
2581 # FAIL_CMD may read-access the current command in variable CMD!
2582 func_execute_cmds ()
2583 {
2584 $debug_cmd
2585
2586 save_ifs=$IFS; IFS='~'
2587 for cmd in $1; do
2588 IFS=$sp$nl
2589 eval cmd=\"$cmd\"
2590 IFS=$save_ifs
2591 func_show_eval "$cmd" "${2-:}"
2592 done
2593 IFS=$save_ifs
2594 }
2595
2596
2597 # func_source file
2598 # Source FILE, adding directory component if necessary.
2599 # Note that it is not necessary on cygwin/mingw to append a dot to
2600 # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
2601 # behavior happens only for exec(3), not for open(2)! Also, sourcing
2602 # 'FILE.' does not work on cygwin managed mounts.
2603 func_source ()
2604 {
2605 $debug_cmd
2606
2607 case $1 in
2608 */* | *\\*) . "$1" ;;
2609 *) . "./$1" ;;
2610 esac
2611 }
2612
2613
2614 # func_resolve_sysroot PATH
2615 # Replace a leading = in PATH with a sysroot. Store the result into
2616 # func_resolve_sysroot_result
2617 func_resolve_sysroot ()
2618 {
2619 func_resolve_sysroot_result=$1
2620 case $func_resolve_sysroot_result in
2621 =*)
2622 func_stripname '=' '' "$func_resolve_sysroot_result"
2623 func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
2624 ;;
2625 esac
2626 }
2627
2628 # func_replace_sysroot PATH
2629 # If PATH begins with the sysroot, replace it with = and
2630 # store the result into func_replace_sysroot_result.
2631 func_replace_sysroot ()
2632 {
2633 case $lt_sysroot:$1 in
2634 ?*:"$lt_sysroot"*)
2635 func_stripname "$lt_sysroot" '' "$1"
2636 func_replace_sysroot_result='='$func_stripname_result
2637 ;;
2638 *)
2639 # Including no sysroot.
2640 func_replace_sysroot_result=$1
2641 ;;
2642 esac
2643 }
2644
2645 # func_infer_tag arg
2646 # Infer tagged configuration to use if any are available and
2647 # if one wasn't chosen via the "--tag" command line option.
2648 # Only attempt this if the compiler in the base compile
2649 # command doesn't match the default compiler.
2650 # arg is usually of the form 'gcc ...'
2651 func_infer_tag ()
2652 {
2653 $debug_cmd
2654
2655 if test -n "$available_tags" && test -z "$tagname"; then
2656 CC_quoted=
2657 for arg in $CC; do
2658 func_append_quoted CC_quoted "$arg"
2659 done
2660 CC_expanded=`func_echo_all $CC`
2661 CC_quoted_expanded=`func_echo_all $CC_quoted`
2662 case $@ in
2663 # Blanks in the command may have been stripped by the calling shell,
2664 # but not from the CC environment variable when configure was run.
2665 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
2666 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
2667 # Blanks at the start of $base_compile will cause this to fail
2668 # if we don't check for them as well.
2669 *)
2670 for z in $available_tags; do
2671 if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
2672 # Evaluate the configuration.
2673 eval "`$SED -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
2674 CC_quoted=
2675 for arg in $CC; do
2676 # Double-quote args containing other shell metacharacters.
2677 func_append_quoted CC_quoted "$arg"
2678 done
2679 CC_expanded=`func_echo_all $CC`
2680 CC_quoted_expanded=`func_echo_all $CC_quoted`
2681 case "$@ " in
2682 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
2683 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
2684 # The compiler in the base compile command matches
2685 # the one in the tagged configuration.
2686 # Assume this is the tagged configuration we want.
2687 tagname=$z
2688 break
2689 ;;
2690 esac
2691 fi
2692 done
2693 # If $tagname still isn't set, then no tagged configuration
2694 # was found and let the user know that the "--tag" command
2695 # line option must be used.
2696 if test -z "$tagname"; then
2697 func_echo "unable to infer tagged configuration"
2698 func_fatal_error "specify a tag with '--tag'"
2699 # else
2700 # func_verbose "using $tagname tagged configuration"
2701 fi
2702 ;;
2703 esac
2704 fi
2705 }
2706
2707
2708
2709 # func_write_libtool_object output_name pic_name nonpic_name
2710 # Create a libtool object file (analogous to a ".la" file),
2711 # but don't create it if we're doing a dry run.
2712 func_write_libtool_object ()
2713 {
2714 write_libobj=$1
2715 if test yes = "$build_libtool_libs"; then
2716 write_lobj=\'$2\'
2717 else
2718 write_lobj=none
2719 fi
2720
2721 if test yes = "$build_old_libs"; then
2722 write_oldobj=\'$3\'
2723 else
2724 write_oldobj=none
2725 fi
2726
2727 $opt_dry_run || {
2728 cat >${write_libobj}T <<EOF
2729 # $write_libobj - a libtool object file
2730 # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
2731 #
2732 # Please DO NOT delete this file!
2733 # It is necessary for linking the library.
2734
2735 # Name of the PIC object.
2736 pic_object=$write_lobj
2737
2738 # Name of the non-PIC object
2739 non_pic_object=$write_oldobj
2740
2741 EOF
2742 $MV "${write_libobj}T" "$write_libobj"
2743 }
2744 }
2745
2746
2747 ##################################################
2748 # FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
2749 ##################################################
2750
2751 # func_convert_core_file_wine_to_w32 ARG
2752 # Helper function used by file name conversion functions when $build is *nix,
2753 # and $host is mingw, cygwin, or some other w32 environment. Relies on a
2754 # correctly configured wine environment available, with the winepath program
2755 # in $build's $PATH.
2756 #
2757 # ARG is the $build file name to be converted to w32 format.
2758 # Result is available in $func_convert_core_file_wine_to_w32_result, and will
2759 # be empty on error (or when ARG is empty)
2760 func_convert_core_file_wine_to_w32 ()
2761 {
2762 $debug_cmd
2763
2764 func_convert_core_file_wine_to_w32_result=$1
2765 if test -n "$1"; then
2766 # Unfortunately, winepath does not exit with a non-zero error code, so we
2767 # are forced to check the contents of stdout. On the other hand, if the
2768 # command is not found, the shell will set an exit code of 127 and print
2769 # *an error message* to stdout. So we must check for both error code of
2770 # zero AND non-empty stdout, which explains the odd construction:
2771 func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
2772 if test "$?" -eq 0 && test -n "$func_convert_core_file_wine_to_w32_tmp"; then
2773 func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
2774 $SED -e "$sed_naive_backslashify"`
2775 else
2776 func_convert_core_file_wine_to_w32_result=
2777 fi
2778 fi
2779 }
2780 # end: func_convert_core_file_wine_to_w32
2781
2782
2783 # func_convert_core_path_wine_to_w32 ARG
2784 # Helper function used by path conversion functions when $build is *nix, and
2785 # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
2786 # configured wine environment available, with the winepath program in $build's
2787 # $PATH. Assumes ARG has no leading or trailing path separator characters.
2788 #
2789 # ARG is path to be converted from $build format to win32.
2790 # Result is available in $func_convert_core_path_wine_to_w32_result.
2791 # Unconvertible file (directory) names in ARG are skipped; if no directory names
2792 # are convertible, then the result may be empty.
2793 func_convert_core_path_wine_to_w32 ()
2794 {
2795 $debug_cmd
2796
2797 # unfortunately, winepath doesn't convert paths, only file names
2798 func_convert_core_path_wine_to_w32_result=
2799 if test -n "$1"; then
2800 oldIFS=$IFS
2801 IFS=:
2802 for func_convert_core_path_wine_to_w32_f in $1; do
2803 IFS=$oldIFS
2804 func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
2805 if test -n "$func_convert_core_file_wine_to_w32_result"; then
2806 if test -z "$func_convert_core_path_wine_to_w32_result"; then
2807 func_convert_core_path_wine_to_w32_result=$func_convert_core_file_wine_to_w32_result
2808 else
2809 func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
2810 fi
2811 fi
2812 done
2813 IFS=$oldIFS
2814 fi
2815 }
2816 # end: func_convert_core_path_wine_to_w32
2817
2818
2819 # func_cygpath ARGS...
2820 # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
2821 # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
2822 # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
2823 # (2), returns the Cygwin file name or path in func_cygpath_result (input
2824 # file name or path is assumed to be in w32 format, as previously converted
2825 # from $build's *nix or MSYS format). In case (3), returns the w32 file name
2826 # or path in func_cygpath_result (input file name or path is assumed to be in
2827 # Cygwin format). Returns an empty string on error.
2828 #
2829 # ARGS are passed to cygpath, with the last one being the file name or path to
2830 # be converted.
2831 #
2832 # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
2833 # environment variable; do not put it in $PATH.
2834 func_cygpath ()
2835 {
2836 $debug_cmd
2837
2838 if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
2839 func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
2840 if test "$?" -ne 0; then
2841 # on failure, ensure result is empty
2842 func_cygpath_result=
2843 fi
2844 else
2845 func_cygpath_result=
2846 func_error "LT_CYGPATH is empty or specifies non-existent file: '$LT_CYGPATH'"
2847 fi
2848 }
2849 #end: func_cygpath
2850
2851
2852 # func_convert_core_msys_to_w32 ARG
2853 # Convert file name or path ARG from MSYS format to w32 format. Return
2854 # result in func_convert_core_msys_to_w32_result.
2855 func_convert_core_msys_to_w32 ()
2856 {
2857 $debug_cmd
2858
2859 # awkward: cmd appends spaces to result
2860 func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
2861 $SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"`
2862 }
2863 #end: func_convert_core_msys_to_w32
2864
2865
2866 # func_convert_file_check ARG1 ARG2
2867 # Verify that ARG1 (a file name in $build format) was converted to $host
2868 # format in ARG2. Otherwise, emit an error message, but continue (resetting
2869 # func_to_host_file_result to ARG1).
2870 func_convert_file_check ()
2871 {
2872 $debug_cmd
2873
2874 if test -z "$2" && test -n "$1"; then
2875 func_error "Could not determine host file name corresponding to"
2876 func_error " '$1'"
2877 func_error "Continuing, but uninstalled executables may not work."
2878 # Fallback:
2879 func_to_host_file_result=$1
2880 fi
2881 }
2882 # end func_convert_file_check
2883
2884
2885 # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
2886 # Verify that FROM_PATH (a path in $build format) was converted to $host
2887 # format in TO_PATH. Otherwise, emit an error message, but continue, resetting
2888 # func_to_host_file_result to a simplistic fallback value (see below).
2889 func_convert_path_check ()
2890 {
2891 $debug_cmd
2892
2893 if test -z "$4" && test -n "$3"; then
2894 func_error "Could not determine the host path corresponding to"
2895 func_error " '$3'"
2896 func_error "Continuing, but uninstalled executables may not work."
2897 # Fallback. This is a deliberately simplistic "conversion" and
2898 # should not be "improved". See libtool.info.
2899 if test "x$1" != "x$2"; then
2900 lt_replace_pathsep_chars="s|$1|$2|g"
2901 func_to_host_path_result=`echo "$3" |
2902 $SED -e "$lt_replace_pathsep_chars"`
2903 else
2904 func_to_host_path_result=$3
2905 fi
2906 fi
2907 }
2908 # end func_convert_path_check
2909
2910
2911 # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
2912 # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
2913 # and appending REPL if ORIG matches BACKPAT.
2914 func_convert_path_front_back_pathsep ()
2915 {
2916 $debug_cmd
2917
2918 case $4 in
2919 $1 ) func_to_host_path_result=$3$func_to_host_path_result
2920 ;;
2921 esac
2922 case $4 in
2923 $2 ) func_append func_to_host_path_result "$3"
2924 ;;
2925 esac
2926 }
2927 # end func_convert_path_front_back_pathsep
2928
2929
2930 ##################################################
2931 # $build to $host FILE NAME CONVERSION FUNCTIONS #
2932 ##################################################
2933 # invoked via '$to_host_file_cmd ARG'
2934 #
2935 # In each case, ARG is the path to be converted from $build to $host format.
2936 # Result will be available in $func_to_host_file_result.
2937
2938
2939 # func_to_host_file ARG
2940 # Converts the file name ARG from $build format to $host format. Return result
2941 # in func_to_host_file_result.
2942 func_to_host_file ()
2943 {
2944 $debug_cmd
2945
2946 $to_host_file_cmd "$1"
2947 }
2948 # end func_to_host_file
2949
2950
2951 # func_to_tool_file ARG LAZY
2952 # converts the file name ARG from $build format to toolchain format. Return
2953 # result in func_to_tool_file_result. If the conversion in use is listed
2954 # in (the comma separated) LAZY, no conversion takes place.
2955 func_to_tool_file ()
2956 {
2957 $debug_cmd
2958
2959 case ,$2, in
2960 *,"$to_tool_file_cmd",*)
2961 func_to_tool_file_result=$1
2962 ;;
2963 *)
2964 $to_tool_file_cmd "$1"
2965 func_to_tool_file_result=$func_to_host_file_result
2966 ;;
2967 esac
2968 }
2969 # end func_to_tool_file
2970
2971
2972 # func_convert_file_noop ARG
2973 # Copy ARG to func_to_host_file_result.
2974 func_convert_file_noop ()
2975 {
2976 func_to_host_file_result=$1
2977 }
2978 # end func_convert_file_noop
2979
2980
2981 # func_convert_file_msys_to_w32 ARG
2982 # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
2983 # conversion to w32 is not available inside the cwrapper. Returns result in
2984 # func_to_host_file_result.
2985 func_convert_file_msys_to_w32 ()
2986 {
2987 $debug_cmd
2988
2989 func_to_host_file_result=$1
2990 if test -n "$1"; then
2991 func_convert_core_msys_to_w32 "$1"
2992 func_to_host_file_result=$func_convert_core_msys_to_w32_result
2993 fi
2994 func_convert_file_check "$1" "$func_to_host_file_result"
2995 }
2996 # end func_convert_file_msys_to_w32
2997
2998
2999 # func_convert_file_cygwin_to_w32 ARG
3000 # Convert file name ARG from Cygwin to w32 format. Returns result in
3001 # func_to_host_file_result.
3002 func_convert_file_cygwin_to_w32 ()
3003 {
3004 $debug_cmd
3005
3006 func_to_host_file_result=$1
3007 if test -n "$1"; then
3008 # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
3009 # LT_CYGPATH in this case.
3010 func_to_host_file_result=`cygpath -m "$1"`
3011 fi
3012 func_convert_file_check "$1" "$func_to_host_file_result"
3013 }
3014 # end func_convert_file_cygwin_to_w32
3015
3016
3017 # func_convert_file_nix_to_w32 ARG
3018 # Convert file name ARG from *nix to w32 format. Requires a wine environment
3019 # and a working winepath. Returns result in func_to_host_file_result.
3020 func_convert_file_nix_to_w32 ()
3021 {
3022 $debug_cmd
3023
3024 func_to_host_file_result=$1
3025 if test -n "$1"; then
3026 func_convert_core_file_wine_to_w32 "$1"
3027 func_to_host_file_result=$func_convert_core_file_wine_to_w32_result
3028 fi
3029 func_convert_file_check "$1" "$func_to_host_file_result"
3030 }
3031 # end func_convert_file_nix_to_w32
3032
3033
3034 # func_convert_file_msys_to_cygwin ARG
3035 # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
3036 # Returns result in func_to_host_file_result.
3037 func_convert_file_msys_to_cygwin ()
3038 {
3039 $debug_cmd
3040
3041 func_to_host_file_result=$1
3042 if test -n "$1"; then
3043 func_convert_core_msys_to_w32 "$1"
3044 func_cygpath -u "$func_convert_core_msys_to_w32_result"
3045 func_to_host_file_result=$func_cygpath_result
3046 fi
3047 func_convert_file_check "$1" "$func_to_host_file_result"
3048 }
3049 # end func_convert_file_msys_to_cygwin
3050
3051
3052 # func_convert_file_nix_to_cygwin ARG
3053 # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed
3054 # in a wine environment, working winepath, and LT_CYGPATH set. Returns result
3055 # in func_to_host_file_result.
3056 func_convert_file_nix_to_cygwin ()
3057 {
3058 $debug_cmd
3059
3060 func_to_host_file_result=$1
3061 if test -n "$1"; then
3062 # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
3063 func_convert_core_file_wine_to_w32 "$1"
3064 func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
3065 func_to_host_file_result=$func_cygpath_result
3066 fi
3067 func_convert_file_check "$1" "$func_to_host_file_result"
3068 }
3069 # end func_convert_file_nix_to_cygwin
3070
3071
3072 #############################################
3073 # $build to $host PATH CONVERSION FUNCTIONS #
3074 #############################################
3075 # invoked via '$to_host_path_cmd ARG'
3076 #
3077 # In each case, ARG is the path to be converted from $build to $host format.
3078 # The result will be available in $func_to_host_path_result.
3079 #
3080 # Path separators are also converted from $build format to $host format. If
3081 # ARG begins or ends with a path separator character, it is preserved (but
3082 # converted to $host format) on output.
3083 #
3084 # All path conversion functions are named using the following convention:
3085 # file name conversion function : func_convert_file_X_to_Y ()
3086 # path conversion function : func_convert_path_X_to_Y ()
3087 # where, for any given $build/$host combination the 'X_to_Y' value is the
3088 # same. If conversion functions are added for new $build/$host combinations,
3089 # the two new functions must follow this pattern, or func_init_to_host_path_cmd
3090 # will break.
3091
3092
3093 # func_init_to_host_path_cmd
3094 # Ensures that function "pointer" variable $to_host_path_cmd is set to the
3095 # appropriate value, based on the value of $to_host_file_cmd.
3096 to_host_path_cmd=
3097 func_init_to_host_path_cmd ()
3098 {
3099 $debug_cmd
3100
3101 if test -z "$to_host_path_cmd"; then
3102 func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
3103 to_host_path_cmd=func_convert_path_$func_stripname_result
3104 fi
3105 }
3106
3107
3108 # func_to_host_path ARG
3109 # Converts the path ARG from $build format to $host format. Return result
3110 # in func_to_host_path_result.
3111 func_to_host_path ()
3112 {
3113 $debug_cmd
3114
3115 func_init_to_host_path_cmd
3116 $to_host_path_cmd "$1"
3117 }
3118 # end func_to_host_path
3119
3120
3121 # func_convert_path_noop ARG
3122 # Copy ARG to func_to_host_path_result.
3123 func_convert_path_noop ()
3124 {
3125 func_to_host_path_result=$1
3126 }
3127 # end func_convert_path_noop
3128
3129
3130 # func_convert_path_msys_to_w32 ARG
3131 # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
3132 # conversion to w32 is not available inside the cwrapper. Returns result in
3133 # func_to_host_path_result.
3134 func_convert_path_msys_to_w32 ()
3135 {
3136 $debug_cmd
3137
3138 func_to_host_path_result=$1
3139 if test -n "$1"; then
3140 # Remove leading and trailing path separator characters from ARG. MSYS
3141 # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
3142 # and winepath ignores them completely.
3143 func_stripname : : "$1"
3144 func_to_host_path_tmp1=$func_stripname_result
3145 func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
3146 func_to_host_path_result=$func_convert_core_msys_to_w32_result
3147 func_convert_path_check : ";" \
3148 "$func_to_host_path_tmp1" "$func_to_host_path_result"
3149 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
3150 fi
3151 }
3152 # end func_convert_path_msys_to_w32
3153
3154
3155 # func_convert_path_cygwin_to_w32 ARG
3156 # Convert path ARG from Cygwin to w32 format. Returns result in
3157 # func_to_host_file_result.
3158 func_convert_path_cygwin_to_w32 ()
3159 {
3160 $debug_cmd
3161
3162 func_to_host_path_result=$1
3163 if test -n "$1"; then
3164 # See func_convert_path_msys_to_w32:
3165 func_stripname : : "$1"
3166 func_to_host_path_tmp1=$func_stripname_result
3167 func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
3168 func_convert_path_check : ";" \
3169 "$func_to_host_path_tmp1" "$func_to_host_path_result"
3170 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
3171 fi
3172 }
3173 # end func_convert_path_cygwin_to_w32
3174
3175
3176 # func_convert_path_nix_to_w32 ARG
3177 # Convert path ARG from *nix to w32 format. Requires a wine environment and
3178 # a working winepath. Returns result in func_to_host_file_result.
3179 func_convert_path_nix_to_w32 ()
3180 {
3181 $debug_cmd
3182
3183 func_to_host_path_result=$1
3184 if test -n "$1"; then
3185 # See func_convert_path_msys_to_w32:
3186 func_stripname : : "$1"
3187 func_to_host_path_tmp1=$func_stripname_result
3188 func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
3189 func_to_host_path_result=$func_convert_core_path_wine_to_w32_result
3190 func_convert_path_check : ";" \
3191 "$func_to_host_path_tmp1" "$func_to_host_path_result"
3192 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
3193 fi
3194 }
3195 # end func_convert_path_nix_to_w32
3196
3197
3198 # func_convert_path_msys_to_cygwin ARG
3199 # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
3200 # Returns result in func_to_host_file_result.
3201 func_convert_path_msys_to_cygwin ()
3202 {
3203 $debug_cmd
3204
3205 func_to_host_path_result=$1
3206 if test -n "$1"; then
3207 # See func_convert_path_msys_to_w32:
3208 func_stripname : : "$1"
3209 func_to_host_path_tmp1=$func_stripname_result
3210 func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
3211 func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
3212 func_to_host_path_result=$func_cygpath_result
3213 func_convert_path_check : : \
3214 "$func_to_host_path_tmp1" "$func_to_host_path_result"
3215 func_convert_path_front_back_pathsep ":*" "*:" : "$1"
3216 fi
3217 }
3218 # end func_convert_path_msys_to_cygwin
3219
3220
3221 # func_convert_path_nix_to_cygwin ARG
3222 # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a
3223 # a wine environment, working winepath, and LT_CYGPATH set. Returns result in
3224 # func_to_host_file_result.
3225 func_convert_path_nix_to_cygwin ()
3226 {
3227 $debug_cmd
3228
3229 func_to_host_path_result=$1
3230 if test -n "$1"; then
3231 # Remove leading and trailing path separator characters from
3232 # ARG. msys behavior is inconsistent here, cygpath turns them
3233 # into '.;' and ';.', and winepath ignores them completely.
3234 func_stripname : : "$1"
3235 func_to_host_path_tmp1=$func_stripname_result
3236 func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
3237 func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
3238 func_to_host_path_result=$func_cygpath_result
3239 func_convert_path_check : : \
3240 "$func_to_host_path_tmp1" "$func_to_host_path_result"
3241 func_convert_path_front_back_pathsep ":*" "*:" : "$1"
3242 fi
3243 }
3244 # end func_convert_path_nix_to_cygwin
3245
3246
3247 # func_dll_def_p FILE
3248 # True iff FILE is a Windows DLL '.def' file.
3249 # Keep in sync with _LT_DLL_DEF_P in libtool.m4
3250 func_dll_def_p ()
3251 {
3252 $debug_cmd
3253
3254 func_dll_def_p_tmp=`$SED -n \
3255 -e 's/^[ ]*//' \
3256 -e '/^\(;.*\)*$/d' \
3257 -e 's/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p' \
3258 -e q \
3259 "$1"`
3260 test DEF = "$func_dll_def_p_tmp"
3261 }
3262
3263
3264 # func_mode_compile arg...
3265 func_mode_compile ()
3266 {
3267 $debug_cmd
3268
3269 # Get the compilation command and the source file.
3270 base_compile=
3271 srcfile=$nonopt # always keep a non-empty value in "srcfile"
3272 suppress_opt=yes
3273 suppress_output=
3274 arg_mode=normal
3275 libobj=
3276 later=
3277 pie_flag=
3278
3279 for arg
3280 do
3281 case $arg_mode in
3282 arg )
3283 # do not "continue". Instead, add this to base_compile
3284 lastarg=$arg
3285 arg_mode=normal
3286 ;;
3287
3288 target )
3289 libobj=$arg
3290 arg_mode=normal
3291 continue
3292 ;;
3293
3294 normal )
3295 # Accept any command-line options.
3296 case $arg in
3297 -o)
3298 test -n "$libobj" && \
3299 func_fatal_error "you cannot specify '-o' more than once"
3300 arg_mode=target
3301 continue
3302 ;;
3303
3304 -pie | -fpie | -fPIE)
3305 func_append pie_flag " $arg"
3306 continue
3307 ;;
3308
3309 -shared | -static | -prefer-pic | -prefer-non-pic)
3310 func_append later " $arg"
3311 continue
3312 ;;
3313
3314 -no-suppress)
3315 suppress_opt=no
3316 continue
3317 ;;
3318
3319 -Xcompiler)
3320 arg_mode=arg # the next one goes into the "base_compile" arg list
3321 continue # The current "srcfile" will either be retained or
3322 ;; # replaced later. I would guess that would be a bug.
3323
3324 -Wc,*)
3325 func_stripname '-Wc,' '' "$arg"
3326 args=$func_stripname_result
3327 lastarg=
3328 save_ifs=$IFS; IFS=,
3329 for arg in $args; do
3330 IFS=$save_ifs
3331 func_append_quoted lastarg "$arg"
3332 done
3333 IFS=$save_ifs
3334 func_stripname ' ' '' "$lastarg"
3335 lastarg=$func_stripname_result
3336
3337 # Add the arguments to base_compile.
3338 func_append base_compile " $lastarg"
3339 continue
3340 ;;
3341
3342 *)
3343 # Accept the current argument as the source file.
3344 # The previous "srcfile" becomes the current argument.
3345 #
3346 lastarg=$srcfile
3347 srcfile=$arg
3348 ;;
3349 esac # case $arg
3350 ;;
3351 esac # case $arg_mode
3352
3353 # Aesthetically quote the previous argument.
3354 func_append_quoted base_compile "$lastarg"
3355 done # for arg
3356
3357 case $arg_mode in
3358 arg)
3359 func_fatal_error "you must specify an argument for -Xcompile"
3360 ;;
3361 target)
3362 func_fatal_error "you must specify a target with '-o'"
3363 ;;
3364 *)
3365 # Get the name of the library object.
3366 test -z "$libobj" && {
3367 func_basename "$srcfile"
3368 libobj=$func_basename_result
3369 }
3370 ;;
3371 esac
3372
3373 # Recognize several different file suffixes.
3374 # If the user specifies -o file.o, it is replaced with file.lo
3375 case $libobj in
3376 *.[cCFSifmso] | \
3377 *.ada | *.adb | *.ads | *.asm | \
3378 *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
3379 *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)
3380 func_xform "$libobj"
3381 libobj=$func_xform_result
3382 ;;
3383 esac
3384
3385 case $libobj in
3386 *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
3387 *)
3388 func_fatal_error "cannot determine name of library object from '$libobj'"
3389 ;;
3390 esac
3391
3392 func_infer_tag $base_compile
3393
3394 for arg in $later; do
3395 case $arg in
3396 -shared)
3397 test yes = "$build_libtool_libs" \
3398 || func_fatal_configuration "cannot build a shared library"
3399 build_old_libs=no
3400 continue
3401 ;;
3402
3403 -static)
3404 build_libtool_libs=no
3405 build_old_libs=yes
3406 continue
3407 ;;
3408
3409 -prefer-pic)
3410 pic_mode=yes
3411 continue
3412 ;;
3413
3414 -prefer-non-pic)
3415 pic_mode=no
3416 continue
3417 ;;
3418 esac
3419 done
3420
3421 func_quote_for_eval "$libobj"
3422 test "X$libobj" != "X$func_quote_for_eval_result" \
3423 && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
3424 && func_warning "libobj name '$libobj' may not contain shell special characters."
3425 func_dirname_and_basename "$obj" "/" ""
3426 objname=$func_basename_result
3427 xdir=$func_dirname_result
3428 lobj=$xdir$objdir/$objname
3429
3430 test -z "$base_compile" && \
3431 func_fatal_help "you must specify a compilation command"
3432
3433 # Delete any leftover library objects.
3434 if test yes = "$build_old_libs"; then
3435 removelist="$obj $lobj $libobj ${libobj}T"
3436 else
3437 removelist="$lobj $libobj ${libobj}T"
3438 fi
3439
3440 # On Cygwin there's no "real" PIC flag so we must build both object types
3441 case $host_os in
3442 cygwin* | mingw* | pw32* | os2* | cegcc*)
3443 pic_mode=default
3444 ;;
3445 esac
3446 if test no = "$pic_mode" && test pass_all != "$deplibs_check_method"; then
3447 # non-PIC code in shared libraries is not supported
3448 pic_mode=default
3449 fi
3450
3451 # Calculate the filename of the output object if compiler does
3452 # not support -o with -c
3453 if test no = "$compiler_c_o"; then
3454 output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.$objext
3455 lockfile=$output_obj.lock
3456 else
3457 output_obj=
3458 need_locks=no
3459 lockfile=
3460 fi
3461
3462 # Lock this critical section if it is needed
3463 # We use this script file to make the link, it avoids creating a new file
3464 if test yes = "$need_locks"; then
3465 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
3466 func_echo "Waiting for $lockfile to be removed"
3467 sleep 2
3468 done
3469 elif test warn = "$need_locks"; then
3470 if test -f "$lockfile"; then
3471 $ECHO "\
3472 *** ERROR, $lockfile exists and contains:
3473 `cat $lockfile 2>/dev/null`
3474
3475 This indicates that another process is trying to use the same
3476 temporary object file, and libtool could not work around it because
3477 your compiler does not support '-c' and '-o' together. If you
3478 repeat this compilation, it may succeed, by chance, but you had better
3479 avoid parallel builds (make -j) in this platform, or get a better
3480 compiler."
3481
3482 $opt_dry_run || $RM $removelist
3483 exit $EXIT_FAILURE
3484 fi
3485 func_append removelist " $output_obj"
3486 $ECHO "$srcfile" > "$lockfile"
3487 fi
3488
3489 $opt_dry_run || $RM $removelist
3490 func_append removelist " $lockfile"
3491 trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
3492
3493 func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
3494 srcfile=$func_to_tool_file_result
3495 func_quote_for_eval "$srcfile"
3496 qsrcfile=$func_quote_for_eval_result
3497
3498 # Only build a PIC object if we are building libtool libraries.
3499 if test yes = "$build_libtool_libs"; then
3500 # Without this assignment, base_compile gets emptied.
3501 fbsd_hideous_sh_bug=$base_compile
3502
3503 if test no != "$pic_mode"; then
3504 command="$base_compile $qsrcfile $pic_flag"
3505 else
3506 # Don't build PIC code
3507 command="$base_compile $qsrcfile"
3508 fi
3509
3510 func_mkdir_p "$xdir$objdir"
3511
3512 if test -z "$output_obj"; then
3513 # Place PIC objects in $objdir
3514 func_append command " -o $lobj"
3515 fi
3516
3517 func_show_eval_locale "$command" \
3518 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
3519
3520 if test warn = "$need_locks" &&
3521 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
3522 $ECHO "\
3523 *** ERROR, $lockfile contains:
3524 `cat $lockfile 2>/dev/null`
3525
3526 but it should contain:
3527 $srcfile
3528
3529 This indicates that another process is trying to use the same
3530 temporary object file, and libtool could not work around it because
3531 your compiler does not support '-c' and '-o' together. If you
3532 repeat this compilation, it may succeed, by chance, but you had better
3533 avoid parallel builds (make -j) in this platform, or get a better
3534 compiler."
3535
3536 $opt_dry_run || $RM $removelist
3537 exit $EXIT_FAILURE
3538 fi
3539
3540 # Just move the object if needed, then go on to compile the next one
3541 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
3542 func_show_eval '$MV "$output_obj" "$lobj"' \
3543 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
3544 fi
3545
3546 # Allow error messages only from the first compilation.
3547 if test yes = "$suppress_opt"; then
3548 suppress_output=' >/dev/null 2>&1'
3549 fi
3550 fi
3551
3552 # Only build a position-dependent object if we build old libraries.
3553 if test yes = "$build_old_libs"; then
3554 if test yes != "$pic_mode"; then
3555 # Don't build PIC code
3556 command="$base_compile $qsrcfile$pie_flag"
3557 else
3558 command="$base_compile $qsrcfile $pic_flag"
3559 fi
3560 if test yes = "$compiler_c_o"; then
3561 func_append command " -o $obj"
3562 fi
3563
3564 # Suppress compiler output if we already did a PIC compilation.
3565 func_append command "$suppress_output"
3566 func_show_eval_locale "$command" \
3567 '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
3568
3569 if test warn = "$need_locks" &&
3570 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
3571 $ECHO "\
3572 *** ERROR, $lockfile contains:
3573 `cat $lockfile 2>/dev/null`
3574
3575 but it should contain:
3576 $srcfile
3577