Do not check for $LINENO in generated scripts.
[autoconf.git] / lib / m4sugar / m4sh.m4
blob1a61729896cdec1c600eb6fd0ff95a1fd43956ae
1 # This file is part of Autoconf.                          -*- Autoconf -*-
2 # M4 sugar for common shell constructs.
3 # Requires GNU M4 and M4sugar.
5 # Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
6 # Free Software Foundation, Inc.
8 # This program is free software: you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2, or (at your option)
11 # any later version.
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 # 02110-1301, USA.
23 # As a special exception, the Free Software Foundation gives unlimited
24 # permission to copy, distribute and modify the configure scripts that
25 # are the output of Autoconf.  You need not follow the terms of the GNU
26 # General Public License when using or distributing such scripts, even
27 # though portions of the text of Autoconf appear in them.  The GNU
28 # General Public License (GPL) does govern all other use of the material
29 # that constitutes the Autoconf program.
31 # Certain portions of the Autoconf source text are designed to be copied
32 # (in certain cases, depending on the input) into the output of
33 # Autoconf.  We call these the "data" portions.  The rest of the Autoconf
34 # source text consists of comments plus executable code that decides which
35 # of the data portions to output in any given case.  We call these
36 # comments and executable code the "non-data" portions.  Autoconf never
37 # copies any of the non-data portions into its output.
39 # This special exception to the GPL applies to versions of Autoconf
40 # released by the Free Software Foundation.  When you make and
41 # distribute a modified version of Autoconf, you may extend this special
42 # exception to the GPL to apply to your modified version as well, *unless*
43 # your modified version has the potential to copy into its output some
44 # of the text that was the non-data portion of the version that you started
45 # with.  (In other words, unless your change moves or copies text from
46 # the non-data portions to the data portions.)  If your modification has
47 # such potential, you must delete any notice of this special exception
48 # to the GPL from your modified version.
50 # Written by Akim Demaille, Pavel Roskin, Alexandre Oliva, Lars J. Aas
51 # and many other people.
54 # We heavily use m4's diversions both for the initializations and for
55 # required macros, because in both cases we have to issue soon in
56 # output something which is discovered late.
59 # KILL is only used to suppress output.
61 # - BINSH
62 #   AC_REQUIRE'd #! /bin/sh line
63 # - HEADER-REVISION
64 #   RCS keywords etc.
65 # - HEADER-COMMENT
66 #   Purpose of the script etc.
67 # - HEADER-COPYRIGHT
68 #   Copyright notice(s)
69 # - M4SH-SANITIZE
70 #   M4sh's shell setup
71 # - M4SH-INIT-FN
72 #   M4sh initialization (shell functions)
73 # - M4SH-INIT
74 #   M4sh initialization (detection code)
75 # - BODY
76 #   The body of the script.
79 # _m4_divert(DIVERSION-NAME)
80 # --------------------------
81 # Convert a diversion name into its number.  Otherwise, return
82 # DIVERSION-NAME which is supposed to be an actual diversion number.
83 # Of course it would be nicer to use m4_case here, instead of zillions
84 # of little macros, but it then takes twice longer to run `autoconf'!
85 m4_define([_m4_divert(BINSH)],             0)
86 m4_define([_m4_divert(HEADER-REVISION)],   1)
87 m4_define([_m4_divert(HEADER-COMMENT)],    2)
88 m4_define([_m4_divert(HEADER-COPYRIGHT)],  3)
89 m4_define([_m4_divert(M4SH-SANITIZE)],     4)
90 m4_define([_m4_divert(M4SH-INIT-FN)],      5)
91 m4_define([_m4_divert(M4SH-INIT)],         6)
92 m4_define([_m4_divert(BODY)],           1000)
94 # Aaarg.  Yet it starts with compatibility issues...  Libtool wants to
95 # use NOTICE to insert its own LIBTOOL-INIT stuff.  People should ask
96 # before diving into our internals :(
97 m4_copy([_m4_divert(M4SH-INIT)], [_m4_divert(NOTICE)])
101 ## ------------------------- ##
102 ## 1. Sanitizing the shell.  ##
103 ## ------------------------- ##
104 # Please maintain lexicographic sorting of this section, ignoring leading _.
106 # AS_BOURNE_COMPATIBLE
107 # --------------------
108 # Try to be as Bourne and/or POSIX as possible.
110 # This does not set BIN_SH, due to the problems described in
111 # <http://lists.gnu.org/archive/html/autoconf-patches/2006-03/msg00081.html>.
112 # People who need BIN_SH should set it in their environment before invoking
113 # configure; apparently this would include UnixWare, as described in
114 # <http://lists.gnu.org/archive/html/bug-autoconf/2006-06/msg00025.html>.
115 m4_define([AS_BOURNE_COMPATIBLE],
116 [# Be more Bourne compatible
117 DUALCASE=1; export DUALCASE # for MKS sh
121 # _AS_BOURNE_COMPATIBLE
122 # ---------------------
123 # This is the part of AS_BOURNE_COMPATIBLE which has to be repeated inside
124 # each instance.
125 m4_define([_AS_BOURNE_COMPATIBLE],
126 [AS_IF([test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1],
127  [emulate sh
128   NULLCMD=:
129   [#] Pre-4.2 versions of Zsh do word splitting on ${1+"$[@]"}, which
130   # is contrary to our usage.  Disable this feature.
131   alias -g '${1+"$[@]"}'='"$[@]"'
132   setopt NO_GLOB_SUBST],
133  [AS_CASE([`(set -o) 2>/dev/null`], [*posix*], [set -o posix])])
137 # _AS_CLEANUP
138 # -----------
139 # Expanded as the last thing before m4sugar cleanup begins.  Macros
140 # may append m4sh cleanup hooks to this as appropriate.
141 m4_define([_AS_CLEANUP],
142 [m4_divert_text([M4SH-SANITIZE], [_AS_DETECT_BETTER_SHELL])])
145 # AS_COPYRIGHT(TEXT)
146 # ------------------
147 # Emit TEXT, a copyright notice, as a shell comment near the top of the
148 # script.  TEXT is evaluated once; to accomplish that, we do not prepend
149 # `# ' but `@%:@ '.
150 m4_define([AS_COPYRIGHT],
151 [m4_divert_text([HEADER-COPYRIGHT],
152 [m4_bpatsubst([
153 $1], [^], [@%:@ ])])])
156 # _AS_DETECT_EXPAND(VAR, SET)
157 # ---------------------------
158 # Assign the contents of VAR from the contents of SET, expanded in such
159 # a manner that VAR can be passed to _AS_RUN.  In order to make
160 # _AS_LINENO_WORKS operate correctly, we must specially handle the
161 # first instance of $LINENO within any line being expanded (the first
162 # instance is important to tests using the current shell, leaving
163 # remaining instances for tests using a candidate shell).  Bash loses
164 # track of line numbers if a double quote contains a newline, hence,
165 # we must piece-meal the assignment of VAR such that $LINENO expansion
166 # occurs in a single line.
167 m4_define([_AS_DETECT_EXPAND],
168 [$1="m4_bpatsubst(m4_dquote(AS_ESCAPE(m4_expand(m4_set_contents([$2], [
169 ])))), [\\\$LINENO\(.*\)$], [";$1=$$1$LINENO;$1=$$1"\1])"])
172 # _AS_DETECT_REQUIRED(TEST)
173 # -------------------------
174 # Refuse to execute under a shell that does not pass the given TEST.
175 # Does not do AS_REQUIRE for the better-shell detection code.
177 # M4sh should never require something not required by POSIX, although
178 # other clients are free to do so.
179 m4_defun([_AS_DETECT_REQUIRED],
180 [m4_set_add([_AS_DETECT_REQUIRED_BODY], [$1 || AS_EXIT])])
183 # _AS_DETECT_SUGGESTED(TEST)
184 # --------------------------
185 # Prefer to execute under a shell that passes the given TEST.
186 # Does not do AS_REQUIRE for the better-shell detection code.
188 # M4sh should never suggest something not required by POSIX, although
189 # other clients are free to do so.
190 m4_defun([_AS_DETECT_SUGGESTED],
191 [m4_set_add([_AS_DETECT_SUGGESTED_BODY], [$1 || AS_EXIT])])
194 # _AS_DETECT_SUGGESTED_PRUNE(TEST)
195 # --------------------------------
196 # If TEST is also a required test, remove it from the set of suggested tests.
197 m4_define([_AS_DETECT_SUGGESTED_PRUNE],
198 [m4_set_contains([_AS_DETECT_REQUIRED_BODY], [$1],
199                  [m4_set_remove([_AS_DETECT_SUGGESTED_BODY], [$1])])])
202 # _AS_DETECT_BETTER_SHELL
203 # -----------------------
204 # The real workhorse for detecting a shell with the correct
205 # features.
207 # In previous versions, we prepended /usr/posix/bin to the path, but that
208 # caused a regression on OpenServer 6.0.0
209 # <http://lists.gnu.org/archive/html/bug-autoconf/2006-06/msg00017.html>
210 # and on HP-UX 11.11, see the failure of test 120 in
211 # <http://lists.gnu.org/archive/html/bug-autoconf/2006-10/msg00003.html>
213 # FIXME: The code should test for the OSF bug described in
214 # <http://lists.gnu.org/archive/html/autoconf-patches/2006-03/msg00081.html>.
216 # This code is run outside any trap 0 context, hence we can simplify AS_EXIT.
217 m4_defun([_AS_DETECT_BETTER_SHELL],
218 dnl Remove any tests from suggested that are also required
219 [m4_set_map([_AS_DETECT_SUGGESTED_BODY], [_AS_DETECT_SUGGESTED_PRUNE])]dnl
220 [m4_pushdef([AS_EXIT], [exit m4_default([$1], 1)])]dnl
221 [if test "x$CONFIG_SHELL" = x; then
222   as_bourne_compatible="AS_ESCAPE(m4_expand([_AS_BOURNE_COMPATIBLE]))"
223   _AS_DETECT_EXPAND([as_required], [_AS_DETECT_REQUIRED_BODY])
224   _AS_DETECT_EXPAND([as_suggested], [_AS_DETECT_SUGGESTED_BODY])
225   AS_IF([_AS_RUN(["$as_required"])],
226         [as_have_required=yes],
227         [as_have_required=no])
228   AS_IF([test x$as_have_required = xyes && _AS_RUN(["$as_suggested"])],
229     [],
230     [_AS_PATH_WALK([/bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH],
231       [case $as_dir in @%:@(
232          /*)
233            for as_base in sh bash ksh sh5; do
234              # Try only shells that exist, to save several forks.
235              as_shell=$as_dir/$as_base
236              AS_IF([{ test -f "$as_shell" || test -f "$as_shell.exe"; } &&
237                     _AS_RUN(["$as_required"], ["$as_shell"])],
238                    [CONFIG_SHELL=$as_shell as_have_required=yes
239                    m4_set_empty([_AS_DETECT_SUGGESTED_BODY], [break 2],
240                      [AS_IF([_AS_RUN(["$as_suggested"], ["$as_shell"])],
241                             [break 2])])])
242            done;;
243        esac],
244       [AS_IF([{ test -f "$SHELL" || test -f "$SHELL.exe"; } &&
245               _AS_RUN(["$as_required"], ["$SHELL"])],
246              [CONFIG_SHELL=$SHELL as_have_required=yes])])
248       AS_IF([test "x$CONFIG_SHELL" != x],
249         [# We cannot yet assume a decent shell, so we have to provide a
250         # neutralization value for shells without unset; and this also
251         # works around shells that cannot unset nonexistent variables.
252         BASH_ENV=/dev/null
253         ENV=/dev/null
254         (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
255         export CONFIG_SHELL
256         exec "$CONFIG_SHELL" "$as_myself" ${1+"$[@]"}])
258 dnl Unfortunately, $as_me isn't available here.
259     AS_IF([test x$as_have_required = xno],
260       [AS_ECHO(["$[]0: This script requires a shell more modern than all"])
261   AS_ECHO(["$[]0: the shells that I found on your system."])
262   if test x${ZSH_VERSION+set} = xset ; then
263     AS_ECHO(["$[]0: In particular, zsh $ZSH_VERSION has bugs and should"])
264     AS_ECHO(["$[]0: be upgraded to zsh 4.3.4 or later."])
265   else
266     AS_ECHO("m4_text_wrap([Please tell ]_m4_defn([m4_PACKAGE_BUGREPORT])
267 m4_ifset([AC_PACKAGE_BUGREPORT], [m4_if(_m4_defn([m4_PACKAGE_BUGREPORT]),
268 _m4_defn([AC_PACKAGE_BUGREPORT]), [], [and _m4_defn([AC_PACKAGE_BUGREPORT])])])
269 [about your system, including any error possibly output before this message.
270 Then install a modern shell, or manually run the script under such a
271 shell if you do have one.], [$[]0: ], [], [62])")
272   fi
273       AS_EXIT(1)])])
274 else
275   SHELL=$CONFIG_SHELL
276   export SHELL
278 _m4_popdef([AS_EXIT])])# _AS_DETECT_BETTER_SHELL
281 # _AS_PREPARE
282 # -----------
283 # This macro has a very special status.  Normal use of M4sh relies
284 # heavily on AS_REQUIRE, so that needed initializations (such as
285 # _AS_TEST_PREPARE) are performed on need, not on demand.  But
286 # Autoconf is the first client of M4sh, and for two reasons: configure
287 # and config.status.  Relying on AS_REQUIRE is of course fine for
288 # configure, but fails for config.status (which is created by
289 # configure).  So we need a means to force the inclusion of the
290 # various _AS_*_PREPARE on top of config.status.  That's basically why
291 # there are so many _AS_*_PREPARE below, and that's also why it is
292 # important not to forget some: config.status needs them.
293 # List any preparations that create shell functions first, then
294 # topologically sort the others by their dependencies.
296 # Special case: we do not need _AS_LINENO_PREPARE, because the
297 # parent will have substituted $LINENO for us when processing its
298 # own invocation of _AS_LINENO_PREPARE.
299 m4_defun([_AS_PREPARE],
300 [m4_pushdef([AS_REQUIRE])]dnl
301 [m4_pushdef([AS_REQUIRE_SHELL_FN], _m4_defn([_AS_REQUIRE_SHELL_FN])
302 )]dnl
303 [_AS_UNSET_PREPARE
304 _AS_VAR_APPEND_PREPARE
305 _AS_VAR_ARITH_PREPARE
307 _AS_EXPR_PREPARE
308 _AS_BASENAME_PREPARE
309 _AS_DIRNAME_PREPARE
310 _AS_ME_PREPARE
311 _AS_CR_PREPARE
312 _AS_ECHO_N_PREPARE
313 _AS_LN_S_PREPARE
314 _AS_MKDIR_P_PREPARE
315 _AS_TEST_PREPARE
316 _AS_TR_CPP_PREPARE
317 _AS_TR_SH_PREPARE
318 _m4_popdef([AS_REQUIRE], [AS_REQUIRE_SHELL_FN])])
320 # AS_PREPARE
321 # ----------
322 # Output all the M4sh possible initialization into the initialization
323 # diversion.  We do not use _AS_PREPARE so that the m4_provide symbols for
324 # AS_REQUIRE and AS_REQUIRE_SHELL_FN are defined properly, and so that
325 # shell functions are placed in M4SH-INIT-FN.
326 m4_defun([AS_PREPARE],
327 [m4_divert_push([KILL])
328 AS_REQUIRE([_AS_EXPR_PREPARE])
329 AS_REQUIRE([_AS_BASENAME_PREPARE])
330 AS_REQUIRE([_AS_DIRNAME_PREPARE])
331 AS_REQUIRE([_AS_ME_PREPARE])
332 AS_REQUIRE([_AS_CR_PREPARE])
333 AS_REQUIRE([_AS_LINENO_PREPARE])
334 AS_REQUIRE([_AS_ECHO_N_PREPARE])
335 AS_REQUIRE([_AS_LN_S_PREPARE])
336 AS_REQUIRE([_AS_MKDIR_P_PREPARE])
337 AS_REQUIRE([_AS_TEST_PREPARE])
338 AS_REQUIRE([_AS_TR_CPP_PREPARE])
339 AS_REQUIRE([_AS_TR_SH_PREPARE])
340 AS_REQUIRE([_AS_UNSET_PREPARE])
341 AS_REQUIRE([_AS_VAR_APPEND_PREPARE], [], [M4SH-INIT-FN])
342 AS_REQUIRE([_AS_VAR_ARITH_PREPARE], [], [M4SH-INIT-FN])
343 m4_divert_pop[]])
346 # AS_REQUIRE(NAME-TO-CHECK, [BODY-TO-EXPAND = NAME-TO-CHECK],
347 #            [DIVERSION = M4SH-INIT])
348 # -----------------------------------------------------------
349 # BODY-TO-EXPAND is some initialization which must be expanded in the
350 # given diversion when expanded (required or not).  The expansion
351 # goes in the named diversion or an earlier one.
353 # Note: we expand _m4_divert_desired before passing it to m4_divert_require,
354 # otherwise we would need to use m4_pushdef and m4_popdef instead of
355 # simply m4_define.
357 # Since $2 can be quite large, this is factored for faster execution, giving
358 # either m4_require([$1], [$2]) or m4_divert_require(desired, [$1], [$2]).
359 m4_defun([AS_REQUIRE],
360 [m4_define([_m4_divert_desired], [m4_default_quoted([$3], [M4SH-INIT])])]dnl
361 [m4_if(m4_eval(_m4_divert(_m4_divert_dump) <= _m4_divert(_m4_divert_desired)),
362        1, [m4_require(],
363           [m4_divert_require(_m4_divert(_m4_divert_desired),]) [$1], [$2])])
365 # _AS_REQUIRE_SHELL_FN(NAME-TO-CHECK, COMMENT, BODY-TO-EXPAND)
366 # ------------------------------------------------------------
367 # Core of AS_REQUIRE_SHELL_FN, but without diversion support.
368 m4_define([_AS_REQUIRE_SHELL_FN], [
369 m4_n([$2])$1 ()
372 } @%:@ $1[]])
374 # AS_REQUIRE_SHELL_FN(NAME-TO-CHECK, COMMENT, BODY-TO-EXPAND,
375 #                     [DIVERSION = M4SH-INIT-FN])
376 # -----------------------------------------------------------
377 # BODY-TO-EXPAND is the body of a shell function to be emitted in the
378 # given diversion when expanded (required or not).  Unlike other
379 # xx_REQUIRE macros, BODY-TO-EXPAND is mandatory.  If COMMENT is
380 # provided (often via AS_FUNCTION_DESCRIBE), it is listed with a
381 # newline before the function name.
382 m4_define([AS_REQUIRE_SHELL_FN],
383 [m4_provide_if([AS_SHELL_FN_$1], [],
384 [AS_REQUIRE([AS_SHELL_FN_$1],
385 [m4_provide([AS_SHELL_FN_$1])_$0($@)],
386 m4_default_quoted([$4], [M4SH-INIT-FN]))])])
389 # _AS_RUN(TEST, [SHELL])
390 # ----------------------
391 # Run TEST under the current shell (if one parameter is used)
392 # or under the given SHELL, protecting it from syntax errors.
393 # Set as_run in order to assist _AS_LINENO_WORKS.
394 m4_define([_AS_RUN],
395 [m4_ifval([$2], [{ $as_echo "$as_bourne_compatible"$1 | as_run=a $2; }],
396                 [(eval $1)]) 2>/dev/null])
399 # _AS_SHELL_FN_WORK
400 # -----------------
401 # This is a spy to detect "in the wild" shells that do not support shell
402 # functions correctly.  It is based on the m4sh.at Autotest testcases.
403 m4_define([_AS_SHELL_FN_WORK],
404 [as_func_return () { (exit [$]1); }
405 as_func_success () { as_func_return 0; }
406 as_func_failure () { as_func_return 1; }
407 as_func_ret_success () { return 0; }
408 as_func_ret_failure () { return 1; }
410 exitcode=0
411 as_func_success || { exitcode=1; echo as_func_success failed.; }
412 as_func_failure && { exitcode=1; echo as_func_failure succeeded.; }
413 as_func_ret_success || { exitcode=1; echo as_func_ret_success failed.; }
414 as_func_ret_failure && { exitcode=1; echo as_func_ret_failure succeeded.; }
415 AS_IF([( set x; as_func_ret_success y && test x = "[$]1" )], [],
416       [exitcode=1; echo positional parameters were not saved.])
417 test x$exitcode = x0[]])# _AS_SHELL_FN_WORK
420 # _AS_SHELL_SANITIZE
421 # ------------------
422 # This is the prolog that is emitted by AS_INIT and AS_INIT_GENERATED.
423 m4_defun([_AS_SHELL_SANITIZE],
424 [m4_text_box([M4sh Initialization.])
426 AS_BOURNE_COMPATIBLE
427 _AS_ECHO_PREPARE
428 _AS_PATH_SEPARATOR_PREPARE
430 # IFS
431 # We need space, tab and new line, in precisely that order.  Quoting is
432 # there to prevent editors from complaining about space-tab.
433 # (If _AS_PATH_WALK were called with IFS unset, it would disable word
434 # splitting by setting IFS to empty value.)
435 IFS=" ""        $as_nl"
437 # Find who we are.  Look in the path if we contain no directory separator.
438 case $[0] in @%:@((
439   *[[\\/]]* ) as_myself=$[0] ;;
440   *) _AS_PATH_WALK([],
441                    [test -r "$as_dir/$[0]" && as_myself=$as_dir/$[0] && break])
442      ;;
443 esac
444 # We did not find ourselves, most probably we were run as `sh COMMAND'
445 # in which case we are not to be found in the path.
446 if test "x$as_myself" = x; then
447   as_myself=$[0]
449 if test ! -f "$as_myself"; then
450   AS_ECHO(["$as_myself: error: cannot find myself; rerun with an absolute file name"]) >&2
451   AS_EXIT
454 # Unset variables that we do not need and which cause bugs (e.g. in
455 # pre-3.0 UWIN ksh).  But do not cause bugs in bash 2.01; the "|| exit 1"
456 # suppresses any "Segmentation fault" message there.  '((' could
457 # trigger a bug in pdksh 5.2.14.
458 for as_var in BASH_ENV ENV MAIL MAILPATH
459 do eval test x\${$as_var+set} = xset \
460   && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
461 done
462 PS1='$ '
463 PS2='> '
464 PS4='+ '
466 # NLS nuisances.
467 LC_ALL=C
468 export LC_ALL
469 LANGUAGE=C
470 export LANGUAGE
472 # CDPATH.
473 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
474 ])# _AS_SHELL_SANITIZE
477 # AS_SHELL_SANITIZE
478 # -----------------
479 # This is only needed for the sake of Libtool, which screws up royally
480 # in its usage of M4sh internals.
481 m4_define([AS_SHELL_SANITIZE],
482 [_AS_SHELL_SANITIZE
483 m4_provide_if([AS_INIT], [],
484 [m4_provide([AS_INIT])
485 _AS_DETECT_REQUIRED([_AS_SHELL_FN_WORK])
486 _AS_DETECT_BETTER_SHELL
487 _AS_UNSET_PREPARE
488 ])])
491 ## ----------------------------- ##
492 ## 2. Wrappers around builtins.  ##
493 ## ----------------------------- ##
495 # This section is lexicographically sorted.
498 # AS_CASE(WORD, [PATTERN1], [IF-MATCHED1]...[DEFAULT])
499 # ----------------------------------------------------
500 # Expand into
501 # | case WORD in #(
502 # |   PATTERN1) IF-MATCHED1 ;; #(
503 # |   ...
504 # |   *) DEFAULT ;;
505 # | esac
506 # The shell comments are intentional, to work around people who don't
507 # realize the impacts of using insufficient m4 quoting.  This macro
508 # always provides a default case, to work around a Solaris /bin/sh
509 # bug regarding the exit status when no case matches.
510 m4_define([_AS_CASE],
511 [ [@%:@(]
512   $1[)] m4_default([$2], [:]) ;;])
513 m4_define([_AS_CASE_DEFAULT],
514 [ [@%:@(]
515   *[)] m4_default([$1], [:]) ;;])
517 m4_defun([AS_CASE],
518 [case $1 in[]m4_map_args_pair([_$0], [_$0_DEFAULT],
519    m4_shift($@m4_if(m4_eval([$# & 1]), [1], [,])))
520 esac])# AS_CASE
523 # AS_EXIT([EXIT-CODE = 1])
524 # ------------------------
525 # Exit and set exit code to EXIT-CODE in the way that it's seen
526 # within "trap 0".
528 # We cannot simply use "exit N" because some shells (zsh and Solaris sh)
529 # will not set $? to N while running the code set by "trap 0"
530 # So we set $? by executing "exit N" in the subshell and then exit.
531 # Other shells don't use `$?' as default for `exit', hence just repeating
532 # the exit value can only help improving portability.
533 m4_define([AS_EXIT],
534 [{ (exit m4_default([$1], 1)); exit m4_default([$1], 1); }])
537 # AS_IF(TEST1, [IF-TRUE1 = :]...[IF-FALSE = :])
538 # ---------------------------------------------
539 # Expand into
540 # | if TEST1; then
541 # |   IF-TRUE1
542 # | elif TEST2; then
543 # |   IF-TRUE2
544 # [...]
545 # | else
546 # |   IF-FALSE
547 # | fi
548 # with simplifications if IF-TRUE1 and/or IF-FALSE is empty.
550 m4_define([_AS_IF],
551 [elif $1; then
552   m4_default([$2], [:])
554 m4_define([_AS_IF_ELSE],
555 [m4_ifvaln([$1],
556 [else
557   $1])])
559 m4_defun([AS_IF],
560 [if $1; then
561   m4_default([$2], [:])
562 m4_map_args_pair([_$0], [_$0_ELSE], m4_shift2($@))]dnl
563 [fi[]])# AS_IF
566 # _AS_UNSET_PREPARE
567 # -----------------
568 # Define $as_unset to execute AS_UNSET, for backwards compatibility
569 # with older versions of M4sh.
570 m4_defun([_AS_UNSET_PREPARE],
571 [AS_FUNCTION_DESCRIBE([as_func_unset], [VAR], [Portably unset VAR.])
572 as_func_unset ()
574   AS_UNSET([$[1]])
576 as_unset=as_func_unset])
579 # AS_UNSET(VAR)
580 # -------------
581 # Unset the env VAR, working around shells that do not allow unsetting
582 # a variable that is not already set.  You should not unset MAIL and
583 # MAILCHECK, as that triggers a bug in Bash 2.01.
584 m4_defun([AS_UNSET],
585 [{ AS_LITERAL_IF([$1], [], [eval ])$1=; unset $1;}])
592 ## ------------------------------------------ ##
593 ## 3. Error and warnings at the shell level.  ##
594 ## ------------------------------------------ ##
596 # If AS_MESSAGE_LOG_FD is defined, shell messages are duplicated there
597 # too.
600 # AS_ESCAPE(STRING, [CHARS = $"`\])
601 # ---------------------------------
602 # Escape the CHARS in STRING.
604 # Avoid the m4_bpatsubst if there are no interesting characters to escape.
605 # _AS_ESCAPE bypasses argument defaulting.
606 m4_define([AS_ESCAPE],
607 [_$0([$1], m4_default([$2], [\"$`]))])
608 m4_define([_AS_ESCAPE],
609 [m4_if(m4_len([$1]),
610        m4_len(m4_translit([[$1]], [$2])),
611        [$1], [m4_bpatsubst([$1], [[$2]], [\\\&])])])
614 # _AS_QUOTE_IFELSE(STRING, IF-MODERN-QUOTATION, IF-OLD-QUOTATION)
615 # ---------------------------------------------------------------
616 # Compatibility glue between the old AS_MSG suite which did not
617 # quote anything, and the modern suite which quotes the quotes.
618 # If STRING contains `\\' or `\$', it's modern.
619 # If STRING contains `\"' or `\`', it's old.
620 # Otherwise it's modern.
622 # Profiling shows that m4_index is 5 to 8x faster than m4_bregexp.  The
623 # slower implementation used:
624 # m4_bmatch([$1],
625 #           [\\[\\$]], [$2],
626 #           [\\[`"]], [$3],
627 #           [$2])
628 # The current implementation caters to the common case of no backslashes,
629 # to minimize m4_index expansions (hence the nested if).
630 m4_define([_AS_QUOTE_IFELSE],
631 [m4_cond([m4_index([$1], [\])], [-1], [$2],
632          [m4_eval(m4_index([$1], [\\]) >= 0)], [1], [$2],
633          [m4_eval(m4_index([$1], [\$]) >= 0)], [1], [$2],
634          [m4_eval(m4_index([$1], [\`]) >= 0)], [1], [$3],
635          [m4_eval(m4_index([$1], [\"]) >= 0)], [1], [$3],
636          [$2])])
639 # _AS_QUOTE(STRING, [CHARS = `"])
640 # -------------------------------
641 # If there are quoted (via backslash) backquotes do nothing, else
642 # backslash all the quotes.
643 m4_define([_AS_QUOTE],
644 [_AS_QUOTE_IFELSE([$1],
645                   [_AS_ESCAPE([$1], m4_default([$2], [`""]))],
646                   [m4_warn([obsolete],
647            [back quotes and double quotes must not be escaped in: $1])dnl
648 $1])])
651 # _AS_ECHO_UNQUOTED(STRING, [FD = AS_MESSAGE_FD])
652 # -----------------------------------------------
653 # Perform shell expansions on STRING and echo the string to FD.
654 m4_define([_AS_ECHO_UNQUOTED],
655 [AS_ECHO(["$1"]) >&m4_default([$2], [AS_MESSAGE_FD])])
658 # _AS_ECHO(STRING, [FD = AS_MESSAGE_FD])
659 # --------------------------------------
660 # Protect STRING from backquote expansion, echo the result to FD.
661 m4_define([_AS_ECHO],
662 [_AS_ECHO_UNQUOTED([_AS_QUOTE([$1])], [$2])])
665 # _AS_ECHO_LOG(STRING)
666 # --------------------
667 # Log the string to AS_MESSAGE_LOG_FD.
668 m4_defun_init([_AS_ECHO_LOG],
669 [AS_REQUIRE([_AS_LINENO_PREPARE])],
670 [_AS_ECHO([$as_me:${as_lineno-$LINENO}: $1], [AS_MESSAGE_LOG_FD])])
673 # _AS_ECHO_N_PREPARE
674 # ------------------
675 # Check whether to use -n, \c, or newline-tab to separate
676 # checking messages from result messages.
677 # Don't try to cache, since the results of this macro are needed to
678 # display the checking message.  In addition, caching something used once
679 # has little interest.
680 # Idea borrowed from dist 3.0.  Use `*c*,', not `*c,' because if `\c'
681 # failed there is also a newline to match.
682 m4_defun([_AS_ECHO_N_PREPARE],
683 [ECHO_C= ECHO_N= ECHO_T=
684 case `echo -n x` in @%:@((((
685 -n*)
686   case `echo 'x\c'` in
687   *c*) ECHO_T=' ';;     # ECHO_T is single tab character.
688   *)   ECHO_C='\c';;
689   esac;;
691   ECHO_N='-n';;
692 esac
693 ])# _AS_ECHO_N_PREPARE
696 # _AS_ECHO_N(STRING, [FD = AS_MESSAGE_FD])
697 # ----------------------------------------
698 # Same as _AS_ECHO, but echo doesn't return to a new line.
699 m4_define([_AS_ECHO_N],
700 [AS_ECHO_N(["_AS_QUOTE([$1])"]) >&m4_default([$2], [AS_MESSAGE_FD])])
703 # AS_MESSAGE(STRING, [FD = AS_MESSAGE_FD])
704 # ----------------------------------------
705 # Output "`basename $0`: "STRING to the open file FD.
706 m4_defun_init([AS_MESSAGE],
707 [AS_REQUIRE([_AS_ME_PREPARE])],
708 [m4_ifset([AS_MESSAGE_LOG_FD],
709           [{ _AS_ECHO_LOG([$1])
710 _AS_ECHO([$as_me: $1], [$2]);}],
711           [_AS_ECHO([$as_me: $1], [$2])])[]])
714 # AS_WARN(PROBLEM)
715 # ----------------
716 m4_define([AS_WARN],
717 [AS_MESSAGE([WARNING: $1], [2])])# AS_WARN
720 # AS_ERROR(ERROR, [EXIT-STATUS = 1])
721 # ----------------------------------
722 m4_define([AS_ERROR],
723 [{ AS_MESSAGE([error: $1], [2])
724    AS_EXIT([$2]); }])# AS_ERROR
728 # AS_LINENO_PUSH([LINENO])
729 # ------------------------
730 # If this is the outermost call to AS_LINENO_PUSH, make sure that
731 # AS_MESSAGE will print LINENO as the line number.
732 m4_defun([AS_LINENO_PUSH],
733 [as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack])
736 # AS_LINENO_POP([LINENO])
737 # ------------------------
738 # If this is call balances the outermost call to AS_LINENO_PUSH,
739 # AS_MESSAGE will restart printing $LINENO as the line number.
740 m4_defun([AS_LINENO_POP],
741 [eval $as_lineno_stack; test "x$as_lineno_stack" = x && AS_UNSET([as_lineno])])
745 ## -------------------------------------- ##
746 ## 4. Portable versions of common tools.  ##
747 ## -------------------------------------- ##
749 # This section is lexicographically sorted.
752 # AS_BASENAME(FILE-NAME)
753 # ----------------------
754 # Simulate the command 'basename FILE-NAME'.  Not all systems have basename.
755 # Also see the comments for AS_DIRNAME.
757 m4_defun([_AS_BASENAME_EXPR],
758 [$as_expr X/[]$1 : '.*/\([[^/][^/]*]\)/*$' \| \
759          X[]$1 : 'X\(//\)$' \| \
760          X[]$1 : 'X\(/\)' \| .])
762 m4_defun([_AS_BASENAME_SED],
763 [AS_ECHO([X/[]$1]) |
764     sed ['/^.*\/\([^/][^/]*\)\/*$/{
765             s//\1/
766             q
767           }
768           /^X\/\(\/\/\)$/{
769             s//\1/
770             q
771           }
772           /^X\/\(\/\).*/{
773             s//\1/
774             q
775           }
776           s/.*/./; q']])
778 m4_defun_init([AS_BASENAME],
779 [AS_REQUIRE([_$0_PREPARE])],
780 [$as_basename -- $1 ||
781 _AS_BASENAME_EXPR([$1]) 2>/dev/null ||
782 _AS_BASENAME_SED([$1])])
785 # _AS_BASENAME_PREPARE
786 # --------------------
787 # Avoid Solaris 9 /usr/ucb/basename, as `basename /' outputs an empty line.
788 # Also, traditional basename mishandles --.  Require here _AS_EXPR_PREPARE,
789 # to avoid problems when _AS_BASENAME is called from the M4SH-INIT diversion.
790 m4_defun([_AS_BASENAME_PREPARE],
791 [AS_REQUIRE([_AS_EXPR_PREPARE])]dnl
792 [if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
793   as_basename=basename
794 else
795   as_basename=false
797 ])# _AS_BASENAME_PREPARE
800 # AS_DIRNAME(FILE-NAME)
801 # ---------------------
802 # Simulate the command 'dirname FILE-NAME'.  Not all systems have dirname.
803 # This macro must be usable from inside ` `.
805 # Prefer expr to echo|sed, since expr is usually faster and it handles
806 # backslashes and newlines correctly.  However, older expr
807 # implementations (e.g. SunOS 4 expr and Solaris 8 /usr/ucb/expr) have
808 # a silly length limit that causes expr to fail if the matched
809 # substring is longer than 120 bytes.  So fall back on echo|sed if
810 # expr fails.
811 m4_defun_init([_AS_DIRNAME_EXPR],
812 [AS_REQUIRE([_AS_EXPR_PREPARE])],
813 [$as_expr X[]$1 : 'X\(.*[[^/]]\)//*[[^/][^/]]*/*$' \| \
814          X[]$1 : 'X\(//\)[[^/]]' \| \
815          X[]$1 : 'X\(//\)$' \| \
816          X[]$1 : 'X\(/\)' \| .])
818 m4_defun([_AS_DIRNAME_SED],
819 [AS_ECHO([X[]$1]) |
820     sed ['/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
821             s//\1/
822             q
823           }
824           /^X\(\/\/\)[^/].*/{
825             s//\1/
826             q
827           }
828           /^X\(\/\/\)$/{
829             s//\1/
830             q
831           }
832           /^X\(\/\).*/{
833             s//\1/
834             q
835           }
836           s/.*/./; q']])
838 m4_defun_init([AS_DIRNAME],
839 [AS_REQUIRE([_$0_PREPARE])],
840 [$as_dirname -- $1 ||
841 _AS_DIRNAME_EXPR([$1]) 2>/dev/null ||
842 _AS_DIRNAME_SED([$1])])
845 # _AS_DIRNAME_PREPARE
846 # --------------------
847 m4_defun([_AS_DIRNAME_PREPARE],
848 [AS_REQUIRE([_AS_EXPR_PREPARE])]dnl
849 [if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
850   as_dirname=dirname
851 else
852   as_dirname=false
854 ])# _AS_DIRNAME_PREPARE
857 # AS_ECHO(WORD)
858 # -------------
859 # Output WORD followed by a newline.  WORD must be a single shell word
860 # (typically a quoted string).  The bytes of WORD are output as-is, even
861 # if it starts with "-" or contains "\".
862 m4_defun_init([AS_ECHO],
863 [AS_REQUIRE([_$0_PREPARE])],
864 [$as_echo $1])
867 # AS_ECHO_N(WORD)
868 # -------------
869 # Like AS_ECHO(WORD), except do not output the trailing newline.
870 m4_defun_init([AS_ECHO_N],
871 [AS_REQUIRE([_AS_ECHO_PREPARE])],
872 [$as_echo_n $1])
875 # _AS_ECHO_PREPARE
876 # -----------------
877 # Arrange for $as_echo 'FOO' to echo FOO without escape-interpretation;
878 # and similarly for $as_echo_foo, which omits the trailing newline.
879 # 'FOO' is an optional single argument; a missing FOO is treated as empty.
880 m4_defun([_AS_ECHO_PREPARE],
881 [[as_nl='
883 export as_nl
884 # Printing a long string crashes Solaris 7 /usr/bin/printf.
885 as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
886 as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
887 as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
888 if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
889   as_echo='printf %s\n'
890   as_echo_n='printf %s'
891 else
892   if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
893     as_echo_body='eval /usr/ucb/echo -n "$][1$as_nl"'
894     as_echo_n='/usr/ucb/echo -n'
895   else
896     as_echo_body='eval expr "X$][1" : "X\\(.*\\)"'
897     as_echo_n_body='eval
898       arg=$][1;
899       case $arg in @%:@(
900       *"$as_nl"*)
901         expr "X$arg" : "X\\(.*\\)$as_nl";
902         arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
903       esac;
904       expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
905     '
906     export as_echo_n_body
907     as_echo_n='sh -c $as_echo_n_body as_echo'
908   fi
909   export as_echo_body
910   as_echo='sh -c $as_echo_body as_echo'
912 ]])# _AS_ECHO_PREPARE
915 # AS_TEST_X
916 # ---------
917 # Check whether a file has executable or search permissions.
918 m4_defun_init([AS_TEST_X],
919 [AS_REQUIRE([_AS_TEST_PREPARE])],
920 [$as_test_x $1[]])# AS_TEST_X
923 # AS_EXECUTABLE_P
924 # ---------------
925 # Check whether a file is a regular file that has executable permissions.
926 m4_defun_init([AS_EXECUTABLE_P],
927 [AS_REQUIRE([_AS_TEST_PREPARE])],
928 [{ test -f $1 && AS_TEST_X([$1]); }])# AS_EXECUTABLE_P
931 # _AS_EXPR_PREPARE
932 # ----------------
933 # QNX 4.25 expr computes and issue the right result but exits with failure.
934 # Tru64 expr mishandles leading zeros in numeric strings.
935 # Detect these flaws.
936 m4_defun([_AS_EXPR_PREPARE],
937 [if expr a : '\(a\)' >/dev/null 2>&1 &&
938    test "X`expr 00001 : '.*\(...\)'`" = X001; then
939   as_expr=expr
940 else
941   as_expr=false
943 ])# _AS_EXPR_PREPARE
946 # _AS_ME_PREPARE
947 # --------------
948 # Define $as_me to the basename of the executable file's name.
949 m4_defun([AS_ME_PREPARE], [AS_REQUIRE([_$0])])
950 m4_defun([_AS_ME_PREPARE],
951 [AS_REQUIRE([_AS_BASENAME_PREPARE])]dnl
952 [as_me=`AS_BASENAME("$[0]")`
955 # _AS_LINENO_WORKS
956 # ---------------
957 # Succeed if the currently executing shell supports LINENO.
958 # This macro does not expand to a single shell command, so be careful
959 # when using it.  Surrounding the body of this macro with {} would
960 # cause "bash -c '_ASLINENO_WORKS'" to fail (with Bash 2.05, anyway),
961 # but that bug is irrelevant to our use of LINENO.  We can't use
962 # AS_VAR_ARITH, as this is expanded prior to shell functions.
964 # Testing for LINENO support is hard; we use _AS_LINENO_WORKS inside
965 # _AS_RUN, which sometimes eval's its argument (pdksh gives false
966 # negatives if $LINENO is expanded by eval), and sometimes passes the
967 # argument to another shell (if the current shell supports LINENO,
968 # then expanding $LINENO prior to the string leads to false
969 # positives).  Hence, we perform two tests, and coordinate with
970 # _AS_DETECT_EXPAND (which ensures that only the first of two LINENO
971 # is expanded in advance) and _AS_RUN (which sets $as_run to 'a' when
972 # handing the test to another shell), so that we know which test to
973 # trust.
974 m4_define([_AS_LINENO_WORKS],
975 [  as_lineno_1=$LINENO as_lineno_1a=$LINENO
976   as_lineno_2=$LINENO as_lineno_2a=$LINENO
977   eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&
978   test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"'])
981 # _AS_LINENO_PREPARE
982 # ------------------
983 # If LINENO is not supported by the shell, produce a version of this
984 # script where LINENO is hard coded.
985 # Comparing LINENO against _oline_ is not a good solution, since in
986 # the case of embedded executables (such as config.status within
987 # configure) you'd compare LINENO wrt config.status vs. _oline_ wrt
988 # configure.
989 m4_defun([AS_LINENO_PREPARE], [AS_REQUIRE([_$0])])
990 m4_defun([_AS_LINENO_PREPARE],
991 [AS_REQUIRE([_AS_CR_PREPARE])]dnl
992 [AS_REQUIRE([_AS_ME_PREPARE])]dnl
993 [_AS_DETECT_SUGGESTED([_AS_LINENO_WORKS])]dnl
994 dnl Even if the logging fd is open, we don't want to use $LINENO in the
995 dnl AS_ERROR complaining that LINENO is broken.
996 [m4_pushdef([AS_MESSAGE_LOG_FD])]dnl
997 dnl Create $as_me.lineno as a copy of $as_myself, but with $LINENO
998 dnl uniformly replaced by the line number.  The first 'sed' inserts a
999 dnl line-number line after each line using $LINENO; the second 'sed'
1000 dnl does the real work.  The second script uses 'N' to pair each
1001 dnl line-number line with the line containing $LINENO, and appends
1002 dnl trailing '-' during substitution so that $LINENO is not a special
1003 dnl case at line end.  (Raja R Harinath suggested sed '=', and Paul
1004 dnl Eggert wrote the scripts with optimization help from Paolo Bonzini).
1005 [_AS_LINENO_WORKS || {
1006   # Blame Lee E. McMahon (1931-1989) for sed's syntax.  :-)
1007   sed -n '
1008     p
1009     /[[$]]LINENO/=
1010   ' <$as_myself |
1011     sed '
1012       s/[[$]]LINENO.*/&-/
1013       t lineno
1014       b
1015       :lineno
1016       N
1017       :loop
1018       s/[[$]]LINENO\([[^'$as_cr_alnum'_]].*\n\)\(.*\)/\2\1\2/
1019       t loop
1020       s/-\n.*//
1021     ' >$as_me.lineno &&
1022   chmod +x "$as_me.lineno" ||
1023     AS_ERROR([cannot create $as_me.lineno; rerun with a POSIX shell])
1025   # Don't try to exec as it changes $[0], causing all sort of problems
1026   # (the dirname of $[0] is not the place where we might find the
1027   # original and so on.  Autoconf is especially sensitive to this).
1028   . "./$as_me.lineno"
1029   # Exit status is that of the last command.
1030   exit
1032 _m4_popdef([AS_MESSAGE_LOG_FD])])# _AS_LINENO_PREPARE
1035 # _AS_LN_S_PREPARE
1036 # ----------------
1037 # Don't use conftest.sym to avoid file name issues on DJGPP, where this
1038 # would yield conftest.sym.exe for DJGPP < 2.04.  And don't use `conftest'
1039 # as base name to avoid prohibiting concurrency (e.g., concurrent
1040 # config.statuses).  On read-only media, assume 'cp -p' and hope we
1041 # are just running --help anyway.
1042 m4_defun([_AS_LN_S_PREPARE],
1043 [rm -f conf$$ conf$$.exe conf$$.file
1044 if test -d conf$$.dir; then
1045   rm -f conf$$.dir/conf$$.file
1046 else
1047   rm -f conf$$.dir
1048   mkdir conf$$.dir 2>/dev/null
1050 if (echo >conf$$.file) 2>/dev/null; then
1051   if ln -s conf$$.file conf$$ 2>/dev/null; then
1052     as_ln_s='ln -s'
1053     # ... but there are two gotchas:
1054     # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
1055     # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
1056     # In both cases, we have to default to `cp -p'.
1057     ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
1058       as_ln_s='cp -p'
1059   elif ln conf$$.file conf$$ 2>/dev/null; then
1060     as_ln_s=ln
1061   else
1062     as_ln_s='cp -p'
1063   fi
1064 else
1065   as_ln_s='cp -p'
1067 rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
1068 rmdir conf$$.dir 2>/dev/null
1069 ])# _AS_LN_S_PREPARE
1072 # AS_LN_S(FILE, LINK)
1073 # -------------------
1074 # FIXME: Should we add the glue code to handle properly relative symlinks
1075 # simulated with `ln' or `cp'?
1076 m4_defun_init([AS_LN_S],
1077 [AS_REQUIRE([_AS_LN_S_PREPARE])],
1078 [$as_ln_s $1 $2])
1081 # _AS_MKDIR_P
1082 # -----------
1083 # Emit code that can be used to emulate `mkdir -p` with plain `mkdir';
1084 # the code assumes that "$as_dir" contains the directory to create.
1085 # $as_dir is normalized, so there is no need to worry about using --.
1086 m4_define([_AS_MKDIR_P],
1087 [case $as_dir in #(
1088   -*) as_dir=./$as_dir;;
1089   esac
1090   test -d "$as_dir" || eval $as_mkdir_p || {
1091     as_dirs=
1092     while :; do
1093       case $as_dir in #(
1094       *\'*) as_qdir=`AS_ECHO(["$as_dir"]) | sed "s/'/'\\\\\\\\''/g"`;; #'(
1095       *) as_qdir=$as_dir;;
1096       esac
1097       as_dirs="'$as_qdir' $as_dirs"
1098       as_dir=`AS_DIRNAME("$as_dir")`
1099       test -d "$as_dir" && break
1100     done
1101     test -z "$as_dirs" || eval "mkdir $as_dirs"
1102   } || test -d "$as_dir" || AS_ERROR([cannot create directory $as_dir])
1105 # AS_MKDIR_P(DIR)
1106 # ---------------
1107 # Emulate `mkdir -p' with plain `mkdir' if needed.
1108 m4_defun_init([AS_MKDIR_P],
1109 [AS_REQUIRE([_$0_PREPARE])],
1110 [as_dir=$1; as_func_mkdir_p])# AS_MKDIR_P
1113 # _AS_MKDIR_P_PREPARE
1114 # -------------------
1115 m4_defun([_AS_MKDIR_P_PREPARE],
1116 [AS_REQUIRE_SHELL_FN([as_func_mkdir_p],
1117   [AS_FUNCTION_DESCRIBE([as_func_mkdir_p], [],
1118     [Create "$as_dir" as a directory, including parents if necessary.])],
1120   _AS_MKDIR_P
1121 ])]dnl
1122 [if mkdir -p . 2>/dev/null; then
1123   as_mkdir_p='mkdir -p "$as_dir"'
1124 else
1125   test -d ./-p && rmdir ./-p
1126   as_mkdir_p=false
1128 ])# _AS_MKDIR_P_PREPARE
1131 # _AS_PATH_SEPARATOR_PREPARE
1132 # --------------------------
1133 # Compute the path separator.
1134 m4_defun([_AS_PATH_SEPARATOR_PREPARE],
1135 [# The user is always right.
1136 if test "${PATH_SEPARATOR+set}" != set; then
1137   PATH_SEPARATOR=:
1138   (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
1139     (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
1140       PATH_SEPARATOR=';'
1141   }
1143 ])# _AS_PATH_SEPARATOR_PREPARE
1146 # _AS_PATH_WALK([PATH = $PATH], BODY, [IF-NOT-FOUND])
1147 # ---------------------------------------------------
1148 # Walk through PATH running BODY for each `as_dir'.  If BODY never does a
1149 # `break', evaluate IF-NOT-FOUND.
1151 # Still very private as its interface looks quite bad.
1153 # `$as_dummy' forces splitting on constant user-supplied paths.
1154 # POSIX.2 field splitting is done only on the result of word
1155 # expansions, not on literal text.  This closes a longstanding sh security
1156 # hole.  Optimize it away when not needed, i.e., if there are no literal
1157 # path separators.
1158 m4_defun_init([_AS_PATH_WALK],
1159 [AS_REQUIRE([_AS_PATH_SEPARATOR_PREPARE])],
1160 [as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
1161 m4_ifvaln([$3], [as_found=false])dnl
1162 m4_bmatch([$1], [[:;]],
1163 [as_dummy="$1"
1164 for as_dir in $as_dummy],
1165 [for as_dir in m4_default([$1], [$PATH])])
1167   IFS=$as_save_IFS
1168   test -z "$as_dir" && as_dir=.
1169   m4_ifvaln([$3], [as_found=:])dnl
1170   $2
1171   m4_ifvaln([$3], [as_found=false])dnl
1172 done
1173 m4_ifvaln([$3], [$as_found || { $3; }])dnl
1174 IFS=$as_save_IFS
1178 # AS_SET_CATFILE(VAR, DIR-NAME, FILE-NAME)
1179 # ----------------------------------------
1180 # Set VAR to DIR-NAME/FILE-NAME.
1181 # Optimize the common case where $2 or $3 is '.'.
1182 m4_define([AS_SET_CATFILE],
1183 [case $2 in @%:@((
1184 .) $1=$3;;
1186   case $3 in @%:@(((
1187   .) $1=$2;;
1188   [[\\/]]* | ?:[[\\/]]* ) $1=$3;;
1189   *) $1=$2/$3;;
1190   esac;;
1191 esac[]])# AS_SET_CATFILE
1194 # _AS_TEST_PREPARE
1195 # ----------------
1196 # Find out whether `test -x' works.  If not, prepare a substitute
1197 # that should work well enough for most scripts.
1199 # Here are some of the problems with the substitute.
1200 # The 'ls' tests whether the owner, not the current user, can execute/search.
1201 # The eval means '*', '?', and '[' cause inadvertent file name globbing
1202 # after the 'eval', so jam together as many tokens as we can to minimize
1203 # the likelihood that the inadvertent globbing will actually do anything.
1204 # Luckily, this gorp is needed only on really ancient hosts.
1206 m4_defun([_AS_TEST_PREPARE],
1207 [if test -x / >/dev/null 2>&1; then
1208   as_test_x='test -x'
1209 else
1210   if ls -dL / >/dev/null 2>&1; then
1211     as_ls_L_option=L
1212   else
1213     as_ls_L_option=
1214   fi
1215   as_test_x='
1216     eval sh -c '\''
1217       if test -d "$[]1"; then
1218         test -d "$[]1/.";
1219       else
1220         case $[]1 in @%:@(
1221         -*)set "./$[]1";;
1222         esac;
1223         case `ls -ld'$as_ls_L_option' "$[]1" 2>/dev/null` in @%:@((
1224         ???[[sx]]*):;;*)false;;esac;fi
1225     '\'' sh
1226   '
1228 dnl as_executable_p is present for backward compatibility with Libtool
1229 dnl 1.5.22, but it should go away at some point.
1230 as_executable_p=$as_test_x
1231 ])# _AS_TEST_PREPARE
1236 ## ------------------ ##
1237 ## 5. Common idioms.  ##
1238 ## ------------------ ##
1240 # This section is lexicographically sorted.
1243 # AS_BOX(MESSAGE, [FRAME-CHARACTER = `-'])
1244 # ----------------------------------------
1245 # Output MESSAGE, a single line text, framed with FRAME-CHARACTER (which
1246 # must not be `/').
1247 m4_define([AS_BOX],
1248 [AS_LITERAL_IF([$1],
1249                [_AS_BOX_LITERAL($@)],
1250                [_AS_BOX_INDIR($@)])])
1253 # _AS_BOX_LITERAL(MESSAGE, [FRAME-CHARACTER = `-'])
1254 # -------------------------------------------------
1255 m4_define([_AS_BOX_LITERAL],
1256 [cat <<\_ASBOX
1257 m4_text_box($@)
1258 _ASBOX])
1261 # _AS_BOX_INDIR(MESSAGE, [FRAME-CHARACTER = `-'])
1262 # -----------------------------------------------
1263 m4_define([_AS_BOX_INDIR],
1264 [sed 'h;s/./m4_default([$2], [-])/g;s/^.../@%:@@%:@ /;s/...$/ @%:@@%:@/;p;x;p;x' <<_ASBOX
1265 @%:@@%:@ $1 @%:@@%:@
1266 _ASBOX])
1269 # AS_FUNCTION_DESCRIBE(NAME, [ARGS], DESCRIPTION, [WRAP-COLUMN = 79])
1270 # -------------------------------------------------------------------
1271 # Output a shell comment describing NAME and its arguments ARGS, then
1272 # a separator line, then the DESCRIPTION wrapped at a decimal
1273 # WRAP-COLUMN.  The output resembles:
1274 #  # NAME ARGS
1275 #  # ---------
1276 #  # Wrapped DESCRIPTION text
1277 # NAME and ARGS are expanded, while DESCRIPTION is treated as a
1278 # whitespace-separated list of strings that are not expanded.
1279 m4_define([AS_FUNCTION_DESCRIBE],
1280 [@%:@ $1[]m4_ifval([$2], [ $2])
1281 @%:@ m4_translit(m4_format([%*s],
1282                    m4_qlen(m4_expand([$1[]m4_ifval([$2], [ $2])])), []),
1283                  [ ], [-])
1284 m4_text_wrap([$3], [@%:@ ], [], [$4])])
1287 # AS_HELP_STRING(LHS, RHS, [INDENT-COLUMN = 26], [WRAP-COLUMN = 79])
1288 # ------------------------------------------------------------------
1290 # Format a help string so that it looks pretty when the user executes
1291 # "script --help".  This macro takes up to four arguments, a
1292 # "left hand side" (LHS), a "right hand side" (RHS), a decimal
1293 # INDENT-COLUMN which is the column where wrapped lines should begin
1294 # (the default of 26 is recommended), and a decimal WRAP-COLUMN which is
1295 # the column where lines should wrap (the default of 79 is recommended).
1296 # LHS is expanded, RHS is not.
1298 # For backwards compatibility not documented in the manual, INDENT-COLUMN
1299 # can also be specified as a string of white spaces, whose width
1300 # determines the indentation column.  Using TABs in INDENT-COLUMN is not
1301 # recommended, since screen width of TAB is not computed.
1303 # The resulting string is suitable for use in other macros that require
1304 # a help string (e.g. AC_ARG_WITH).
1306 # Here is the sample string from the Autoconf manual (Node: External
1307 # Software) which shows the proper spacing for help strings.
1309 #    --with-readline         support fancy command line editing
1310 #  ^ ^                       ^
1311 #  | |                       |
1312 #  | column 2                column 26
1313 #  |
1314 #  column 0
1316 # A help string is made up of a "left hand side" (LHS) and a "right
1317 # hand side" (RHS).  In the example above, the LHS is
1318 # "--with-readline", while the RHS is "support fancy command line
1319 # editing".
1321 # If the LHS contains more than (INDENT-COLUMN - 3) characters, then the
1322 # LHS is terminated with a newline so that the RHS starts on a line of its
1323 # own beginning at INDENT-COLUMN.  In the default case, this corresponds to an
1324 # LHS with more than 23 characters.
1326 # Therefore, in the example, if the LHS were instead
1327 # "--with-readline-blah-blah-blah", then the AS_HELP_STRING macro would
1328 # expand into:
1331 #    --with-readline-blah-blah-blah
1332 #  ^ ^                       support fancy command line editing
1333 #  | |                       ^
1334 #  | column 2                |
1335 #  column 0                  column 26
1338 # m4_text_wrap hacks^Wworks around the fact that m4_format does not
1339 # know quadrigraphs.
1341 m4_define([AS_HELP_STRING],
1342 [m4_text_wrap([$2], m4_cond([[$3]], [], [                          ],
1343                             [m4_eval([$3]+0)], [0], [[$3]],
1344                             [m4_format([[%*s]], [$3], [])]),
1345               m4_expand([  $1 ]), [$4])])# AS_HELP_STRING
1348 # AS_IDENTIFIER_IF(EXPRESSION, IF-IDENT, IF-NOT-IDENT)
1349 # ----------------------------------------------------
1350 # If EXPRESSION serves as an identifier (ie, after removal of @&t@, it
1351 # matches the regex `^[a-zA-Z_][a-zA-Z_0-9]*$'), execute IF-IDENT,
1352 # otherwise IF-NOT-IDENT.
1354 # This is generally faster than the alternative:
1355 #   m4_bmatch(m4_bpatsubst([[$1]], [@&t@]), ^m4_defn([m4_re_word])$,
1356 #             [$2], [$3])
1358 # Rather than expand m4_defn every time AS_IDENTIFIER_IF is expanded, we
1359 # inline its expansion up front.  Only use a regular expression if we
1360 # detect a potential quadrigraph.
1362 # First, check if the entire string matches m4_cr_symbol2.  Only then do
1363 # we worry if the first character also matches m4_cr_symbol1 (ie. does not
1364 # match m4_cr_digit).
1365 m4_define([AS_IDENTIFIER_IF],
1366 [m4_if(m4_index([$1], [@]), [-1],
1367        [_$0($@)],
1368        [_$0(m4_bpatsubst([[$1]], [@&t@]), [$2], [$3])])])
1369 m4_define([_AS_IDENTIFIER_IF],
1370 [m4_cond([[$1]], [], [$3],
1371          [m4_eval(m4_len(m4_translit([[$1]], ]]dnl
1372 m4_dquote(m4_dquote(m4_defn([m4_cr_symbols2])))[[)) > 0)], [1], [$3],
1373          [m4_len(m4_translit(m4_format([[%.1s]], [$1]), ]]dnl
1374 m4_dquote(m4_dquote(m4_defn([m4_cr_symbols1])))[[))], [0], [$2], [$3])])
1377 # AS_LITERAL_IF(EXPRESSION, IF-LITERAL, IF-NOT-LITERAL)
1378 # -----------------------------------------------------
1379 # If EXPRESSION has shell indirections ($var or `expr`), expand
1380 # IF-INDIR, else IF-NOT-INDIR.
1381 # This is an *approximation*: for instance EXPRESSION = `\$' is
1382 # definitely a literal, but will not be recognized as such.
1384 # Why do we reject EXPRESSION expanding with `[' or `]' as a literal?
1385 # Because AS_TR_SH is MUCH faster if it can use m4_translit on literals
1386 # instead of m4_bpatsubst; but m4_translit is much tougher to do safely
1387 # if `[' is translated.
1389 # Note that the quadrigraph @S|@ can result in non-literals, but outright
1390 # rejecting all @ would make AC_INIT complain on its bug report address.
1392 # We used to use m4_bmatch(m4_quote($1), [[`$]], [$3], [$2]), but
1393 # profiling shows that it is faster to use m4_translit.
1395 # Because the translit is stripping quotes, it must also neutralize anything
1396 # that might be in a macro name, as well as comments and commas.  All the
1397 # problem characters are unified so that a single m4_index can scan the
1398 # result.
1400 # Rather than expand m4_defn every time AS_LITERAL_IF is expanded, we
1401 # inline its expansion up front.
1402 m4_define([AS_LITERAL_IF],
1403 [m4_cond([m4_eval(m4_index(m4_quote($1), [@S|@]) == -1)], [0], [$3],
1404          [m4_index(m4_translit(m4_quote($1),
1405                                [[]`,#]]]dnl
1406 m4_dquote(m4_dquote(m4_defn([m4_cr_symbols2])))[[,
1407                                [$$$]),
1408                    [$])], [-1], [$2],
1409          [$3])])
1412 # AS_TMPDIR(PREFIX, [DIRECTORY = $TMPDIR [= /tmp]])
1413 # -------------------------------------------------
1414 # Create as safely as possible a temporary directory in DIRECTORY
1415 # which name is inspired by PREFIX (should be 2-4 chars max).
1416 m4_define([AS_TMPDIR],
1417 [# Create a (secure) tmp directory for tmp files.
1418 m4_if([$2], [], [: ${TMPDIR=/tmp}])
1420   tmp=`(umask 077 && mktemp -d "m4_default([$2], [$TMPDIR])/$1XXXXXX") 2>/dev/null` &&
1421   test -n "$tmp" && test -d "$tmp"
1422 }  ||
1424   tmp=m4_default([$2], [$TMPDIR])/$1$$-$RANDOM
1425   (umask 077 && mkdir "$tmp")
1426 } || AS_ERROR([cannot create a temporary directory in m4_default([$2],
1427               [$TMPDIR])])])# AS_TMPDIR
1430 # AS_UNAME
1431 # --------
1432 # Try to describe this machine.  Meant for logs.
1433 m4_define([AS_UNAME],
1435 cat <<_ASUNAME
1436 m4_text_box([Platform.])
1438 hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
1439 uname -m = `(uname -m) 2>/dev/null || echo unknown`
1440 uname -r = `(uname -r) 2>/dev/null || echo unknown`
1441 uname -s = `(uname -s) 2>/dev/null || echo unknown`
1442 uname -v = `(uname -v) 2>/dev/null || echo unknown`
1444 /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
1445 /bin/uname -X     = `(/bin/uname -X) 2>/dev/null     || echo unknown`
1447 /bin/arch              = `(/bin/arch) 2>/dev/null              || echo unknown`
1448 /usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null       || echo unknown`
1449 /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
1450 /usr/bin/hostinfo      = `(/usr/bin/hostinfo) 2>/dev/null      || echo unknown`
1451 /bin/machine           = `(/bin/machine) 2>/dev/null           || echo unknown`
1452 /usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null       || echo unknown`
1453 /bin/universe          = `(/bin/universe) 2>/dev/null          || echo unknown`
1455 _ASUNAME
1457 _AS_PATH_WALK([$PATH], [AS_ECHO(["PATH: $as_dir"])])
1461 # _AS_VERSION_COMPARE_PREPARE
1462 # ---------------------------
1463 # Output variables for comparing version numbers.
1464 m4_defun([_AS_VERSION_COMPARE_PREPARE],
1465 [[as_awk_strverscmp='
1466   # Use only awk features that work with 7th edition Unix awk (1978).
1467   # My, what an old awk you have, Mr. Solaris!
1468   END {
1469     while (length(v1) && length(v2)) {
1470       # Set d1 to be the next thing to compare from v1, and likewise for d2.
1471       # Normally this is a single character, but if v1 and v2 contain digits,
1472       # compare them as integers and fractions as strverscmp does.
1473       if (v1 ~ /^[0-9]/ && v2 ~ /^[0-9]/) {
1474         # Split v1 and v2 into their leading digit string components d1 and d2,
1475         # and advance v1 and v2 past the leading digit strings.
1476         for (len1 = 1; substr(v1, len1 + 1) ~ /^[0-9]/; len1++) continue
1477         for (len2 = 1; substr(v2, len2 + 1) ~ /^[0-9]/; len2++) continue
1478         d1 = substr(v1, 1, len1); v1 = substr(v1, len1 + 1)
1479         d2 = substr(v2, 1, len2); v2 = substr(v2, len2 + 1)
1480         if (d1 ~ /^0/) {
1481           if (d2 ~ /^0/) {
1482             # Compare two fractions.
1483             while (d1 ~ /^0/ && d2 ~ /^0/) {
1484               d1 = substr(d1, 2); len1--
1485               d2 = substr(d2, 2); len2--
1486             }
1487             if (len1 != len2 && ! (len1 && len2 && substr(d1, 1, 1) == substr(d2, 1, 1))) {
1488               # The two components differ in length, and the common prefix
1489               # contains only leading zeros.  Consider the longer to be less.
1490               d1 = -len1
1491               d2 = -len2
1492             } else {
1493               # Otherwise, compare as strings.
1494               d1 = "x" d1
1495               d2 = "x" d2
1496             }
1497           } else {
1498             # A fraction is less than an integer.
1499             exit 1
1500           }
1501         } else {
1502           if (d2 ~ /^0/) {
1503             # An integer is greater than a fraction.
1504             exit 2
1505           } else {
1506             # Compare two integers.
1507             d1 += 0
1508             d2 += 0
1509           }
1510         }
1511       } else {
1512         # The normal case, without worrying about digits.
1513         d1 = substr(v1, 1, 1); v1 = substr(v1, 2)
1514         d2 = substr(v2, 1, 1); v2 = substr(v2, 2)
1515       }
1516       if (d1 < d2) exit 1
1517       if (d1 > d2) exit 2
1518     }
1519     # Beware Solaris /usr/xgp4/bin/awk (at least through Solaris 10),
1520     # which mishandles some comparisons of empty strings to integers.
1521     if (length(v2)) exit 1
1522     if (length(v1)) exit 2
1523   }
1524 ']])# _AS_VERSION_COMPARE_PREPARE
1527 # AS_VERSION_COMPARE(VERSION-1, VERSION-2,
1528 #                    [ACTION-IF-LESS], [ACTION-IF-EQUAL], [ACTION-IF-GREATER])
1529 # -----------------------------------------------------------------------------
1530 # Compare two strings possibly containing shell variables as version strings.
1532 # This usage is portable even to ancient awk,
1533 # so don't worry about finding a "nice" awk version.
1534 m4_defun_init([AS_VERSION_COMPARE],
1535 [AS_REQUIRE([_$0_PREPARE])],
1536 [as_arg_v1=$1
1537 as_arg_v2=$2
1538 awk "$as_awk_strverscmp" v1="$as_arg_v1" v2="$as_arg_v2" /dev/null
1539 AS_CASE([$?],
1540         [1], [$3],
1541         [0], [$4],
1542         [2], [$5])])# AS_VERSION_COMPARE
1546 ## --------------------------------------- ##
1547 ## 6. Common m4/sh character translation.  ##
1548 ## --------------------------------------- ##
1550 # The point of this section is to provide high level macros comparable
1551 # to m4's `translit' primitive, but m4/sh polymorphic.
1552 # Transliteration of literal strings should be handled by m4, while
1553 # shell variables' content will be translated at runtime (tr or sed).
1556 # _AS_CR_PREPARE
1557 # --------------
1558 # Output variables defining common character ranges.
1559 # See m4_cr_letters etc.
1560 m4_defun([_AS_CR_PREPARE],
1561 [# Avoid depending upon Character Ranges.
1562 as_cr_letters='abcdefghijklmnopqrstuvwxyz'
1563 as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
1564 as_cr_Letters=$as_cr_letters$as_cr_LETTERS
1565 as_cr_digits='0123456789'
1566 as_cr_alnum=$as_cr_Letters$as_cr_digits
1570 # _AS_TR_SH_PREPARE
1571 # -----------------
1572 m4_defun([_AS_TR_SH_PREPARE],
1573 [AS_REQUIRE([_AS_CR_PREPARE])]dnl
1574 [# Sed expression to map a string onto a valid variable name.
1575 as_tr_sh="eval sed 'y%*+%pp%;s%[[^_$as_cr_alnum]]%_%g'"
1579 # AS_TR_SH(EXPRESSION)
1580 # --------------------
1581 # Transform EXPRESSION into a valid shell variable name.
1582 # sh/m4 polymorphic.
1583 # Be sure to update the definition of `$as_tr_sh' if you change this.
1585 # AS_LITERAL_IF guarantees that a literal does not have any nested quotes,
1586 # once $1 is expanded.  m4_translit silently uses only the first occurrence
1587 # of a character that appears multiple times in argument 2, since we know
1588 # that m4_cr_not_symbols2 also contains [ and ].  m4_translit also silently
1589 # ignores characters in argument 3 that do not match argument 2; we use this
1590 # fact to skip worrying about the length of m4_cr_not_symbols2.
1592 # For speed, we inline the literal definitions that can be computed up front.
1593 m4_defun_init([AS_TR_SH],
1594 [AS_REQUIRE([_$0_PREPARE])],
1595 [AS_LITERAL_IF([$1],
1596               [m4_translit([$1], [*+[]]]]dnl
1597 m4_dquote(m4_dquote(m4_defn([m4_cr_not_symbols2])))[[,
1598                                  [pp[]]]]dnl
1599 m4_dquote(m4_dquote(m4_for(,1,255,,[[_]])))[[)],
1600               [`AS_ECHO(["m4_bpatsubst(m4_dquote(m4_expand([$1])),
1601                                        [[\\`]], [\\\&])"]) | $as_tr_sh`])])
1604 # _AS_TR_CPP_PREPARE
1605 # ------------------
1606 m4_defun([_AS_TR_CPP_PREPARE],
1607 [AS_REQUIRE([_AS_CR_PREPARE])]dnl
1608 [# Sed expression to map a string onto a valid CPP name.
1609 as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[[^_$as_cr_alnum]]%_%g'"
1613 # AS_TR_CPP(EXPRESSION)
1614 # ---------------------
1615 # Map EXPRESSION to an upper case string which is valid as rhs for a
1616 # `#define'.  sh/m4 polymorphic.  Be sure to update the definition
1617 # of `$as_tr_cpp' if you change this.
1619 # See implementation comments in AS_TR_SH.
1620 m4_defun_init([AS_TR_CPP],
1621 [AS_REQUIRE([_$0_PREPARE])],
1622 [AS_LITERAL_IF([$1],
1623               [m4_translit([$1], [*[]]]]dnl
1624 m4_dquote(m4_dquote(m4_defn([m4_cr_letters])m4_defn([m4_cr_not_symbols2])))[[,
1625                                  [P[]]]]dnl
1626 m4_dquote(m4_dquote(m4_defn([m4_cr_LETTERS])m4_for(,1,255,,[[_]])))[[)],
1627               [`AS_ECHO(["$1"]) | $as_tr_cpp`])])
1630 # _AS_TR_PREPARE
1631 # --------------
1632 m4_defun([_AS_TR_PREPARE],
1633 [AS_REQUIRE([_AS_TR_SH_PREPARE])AS_REQUIRE([_AS_TR_CPP_PREPARE])])
1638 ## ------------------------------------------------------ ##
1639 ## 7. Common m4/sh handling of variables (indirections).  ##
1640 ## ------------------------------------------------------ ##
1643 # The purpose of this section is to provide a uniform API for
1644 # reading/setting sh variables with or without indirection.
1645 # Typically, one can write
1646 #   AS_VAR_SET(var, val)
1647 # or
1648 #   AS_VAR_SET(as_$var, val)
1649 # and expect the right thing to happen.  In the descriptions below,
1650 # a literal name matches the regex [a-zA-Z_][a-zA-Z0-9_]*, an
1651 # indirect name is a shell expression that produces a literal name
1652 # when passed through eval, and a polymorphic name is either type.
1655 # _AS_VAR_APPEND_PREPARE
1656 # ----------------------
1657 # Define as_func_append to the optimum definition for the current
1658 # shell (bash and zsh provide the += assignment operator to avoid
1659 # quadratic append growth over repeated appends).
1660 m4_defun([_AS_VAR_APPEND_PREPARE],
1661 [AS_FUNCTION_DESCRIBE([as_func_append], [VAR VALUE],
1662 [Append the text in VALUE to the end of the definition contained in
1663 VAR.  Take advantage of any shell optimizations that allow amortized
1664 linear growth over repeated appends, instead of the typical quadratic
1665 growth present in naive implementations.])
1666 AS_IF([_AS_RUN(["AS_ESCAPE([_AS_VAR_APPEND_WORKS])"])],
1667 [eval 'as_func_append ()
1668   {
1669     eval $[]1+=\$[]2
1670   }'],
1671 [as_func_append ()
1672   {
1673     eval $[]1=\$$[]1\$[]2
1674   }]) # as_func_append
1677 # _AS_VAR_APPEND_WORKS
1678 # --------------------
1679 # Output a shell test to discover whether += works.
1680 m4_define([_AS_VAR_APPEND_WORKS],
1681 [as_var=1; as_var+=2; test x$as_var = x12])
1683 # AS_VAR_APPEND(VAR, VALUE)
1684 # -------------------------
1685 # Append the shell expansion of VALUE to the end of the existing
1686 # contents of the polymorphic shell variable VAR, taking advantage of
1687 # any shell optimizations that allow repeated appends to result in
1688 # amortized linear scaling rather than quadratic behavior.  This macro
1689 # is not worth the overhead unless the expected final size of the
1690 # contents of VAR outweigh the typical VALUE size of repeated appends.
1691 # Note that unlike AS_VAR_SET, VALUE must be properly quoted to avoid
1692 # field splitting and file name expansion.
1693 m4_defun_init([AS_VAR_APPEND],
1694 [AS_REQUIRE([_AS_VAR_APPEND_PREPARE], [], [M4SH-INIT-FN])],
1695 [as_func_append $1 $2])
1698 # _AS_VAR_ARITH_PREPARE
1699 # ---------------------
1700 # Define as_func_arith to the optimum definition for the current
1701 # shell (using POSIX $(()) where supported).
1702 m4_defun([_AS_VAR_ARITH_PREPARE],
1703 [AS_FUNCTION_DESCRIBE([as_func_arith], [ARG...],
1704 [Perform arithmetic evaluation on the ARGs, and store the result in
1705 the global $as_val.  Take advantage of shells that can avoid forks.
1706 The arguments must be portable across $(()) and expr.])
1707 AS_IF([_AS_RUN(["AS_ESCAPE([_AS_VAR_ARITH_WORKS])"])],
1708 [eval 'as_func_arith ()
1709   {
1710     as_val=$(( $[]* ))
1711   }'],
1712 [as_func_arith ()
1713   {
1714     as_val=`expr "$[]@"`
1715   }]) # as_func_arith
1718 # _AS_VAR_ARITH_WORKS
1719 # -------------------
1720 # Output a shell test to discover whether $(()) works.
1721 m4_define([_AS_VAR_ARITH_WORKS],
1722 [test $(( 1 + 1 )) = 2])
1724 # AS_VAR_ARITH(VAR, EXPR)
1725 # -----------------------
1726 # Perform the arithmetic evaluation of the arguments in EXPR, and set
1727 # contents of the polymorphic shell variable VAR to the result, taking
1728 # advantage of any shell optimizations that perform arithmetic without
1729 # forks.  Note that numbers occuring within EXPR must be written in
1730 # decimal, and without leading zeroes; variables containing numbers
1731 # must be expanded prior to arithmetic evaluation; the first argument
1732 # must not be a negative number; there is no portable equality
1733 # operator; and operators must be given as separate arguments and
1734 # properly quoted.
1735 m4_defun_init([AS_VAR_ARITH],
1736 [_AS_DETECT_SUGGESTED([_AS_VAR_ARITH_WORKS])]dnl
1737 [AS_REQUIRE([_AS_VAR_ARITH_PREPARE], [], [M4SH-INIT-FN])],
1738 [as_func_arith $2 && AS_VAR_SET([$1], [$as_val])])
1741 # AS_VAR_COPY(DEST, SOURCE)
1742 # -------------------------
1743 # Set the polymorphic shell variable DEST to the contents of the polymorphic
1744 # shell variable SOURCE.
1745 m4_define([AS_VAR_COPY],
1746 [AS_LITERAL_IF([$1[]$2], [$1=$$2], [eval $1=\$$2])])
1749 # AS_VAR_GET(VARIABLE)
1750 # --------------------
1751 # Get the value of the shell VARIABLE.
1752 # Evaluates to $VARIABLE if there are no indirection in VARIABLE,
1753 # else into the appropriate `eval' sequence.
1754 # This macro is deprecated because it sometimes mishandles trailing newlines;
1755 # use AS_VAR_COPY instead.
1756 m4_define([AS_VAR_GET],
1757 [AS_LITERAL_IF([$1],
1758                [$$1],
1759                [`eval 'as_val=${'m4_bpatsubst([$1], [[\\`]], [\\\&])'};dnl
1760 AS_ECHO(["$as_val"])'`])])
1763 # AS_VAR_IF(VARIABLE, VALUE, IF-TRUE, IF-FALSE)
1764 # ---------------------------------------------
1765 # Implement a shell `if test $VARIABLE = VALUE; then-else'.
1766 # Polymorphic, and avoids sh expansion error upon interrupt or term signal.
1767 m4_define([AS_VAR_IF],
1768 [AS_LITERAL_IF([$1],
1769   [AS_IF([test "x$$1" = x""$2], [$3], [$4])],
1770   [AS_VAR_COPY([as_val], [$1])
1771    AS_IF([test "x$as_val" = x""$2], [$3], [$4])])])
1774 # AS_VAR_PUSHDEF and AS_VAR_POPDEF
1775 # --------------------------------
1778 # Sometimes we may have to handle literals (e.g. `stdlib.h'), while at
1779 # other moments, the same code may have to get the value from a
1780 # variable (e.g., `ac_header').  To have a uniform handling of both
1781 # cases, when a new value is about to be processed, declare a local
1782 # variable, e.g.:
1784 #   AS_VAR_PUSHDEF([header], [ac_cv_header_$1])
1786 # and then in the body of the macro, use `header' as is.  It is of
1787 # first importance to use `AS_VAR_*' to access this variable.
1789 # If the value `$1' was a literal (e.g. `stdlib.h'), then `header' is
1790 # in fact the value `ac_cv_header_stdlib_h'.  If `$1' was indirect,
1791 # then `header's value in m4 is in fact `$as_header', the shell
1792 # variable that holds all of the magic to get the expansion right.
1794 # At the end of the block, free the variable with
1796 #   AS_VAR_POPDEF([header])
1799 # AS_VAR_POPDEF(VARNAME)
1800 # ----------------------
1801 # Free the shell variable accessor VARNAME.  To be dnl'ed.
1802 m4_define([AS_VAR_POPDEF],
1803 [m4_popdef([$1])])
1806 # AS_VAR_PUSHDEF(VARNAME, VALUE)
1807 # ------------------------------
1808 # Define the m4 macro VARNAME to an accessor to the shell variable
1809 # named VALUE.  VALUE does not need to be a valid shell variable name:
1810 # the transliteration is handled here.  To be dnl'ed.
1812 # AS_TR_SH attempts to play with diversions if _AS_TR_SH_PREPARE has
1813 # not been expanded.  However, users are expected to do subsequent
1814 # calls that trigger AS_LITERAL_IF([VARNAME]), and that macro performs
1815 # expansion inside an argument collection context, where diversions
1816 # don't work.  Therefore, we must require the preparation ourselves.
1817 m4_defun_init([AS_VAR_PUSHDEF],
1818 [AS_REQUIRE([_AS_TR_SH_PREPARE])],
1819 [AS_LITERAL_IF([$2],
1820                [m4_pushdef([$1], [AS_TR_SH($2)])],
1821                [as_$1=AS_TR_SH($2)
1822 m4_pushdef([$1], [$as_[$1]])])])
1825 # AS_VAR_SET(VARIABLE, VALUE)
1826 # ---------------------------
1827 # Set the contents of the polymorphic shell VARIABLE to the shell
1828 # expansion of VALUE.  VALUE is immune to field splitting and file
1829 # name expansion.
1830 m4_define([AS_VAR_SET],
1831 [AS_LITERAL_IF([$1],
1832                [$1=$2],
1833                [eval "$1=AS_ESCAPE([$2])"])])
1836 # AS_VAR_SET_IF(VARIABLE, IF-TRUE, IF-FALSE)
1837 # ------------------------------------------
1838 # Implement a shell `if-then-else' depending whether VARIABLE is set
1839 # or not.  Polymorphic.
1840 m4_define([AS_VAR_SET_IF],
1841 [AS_IF([AS_VAR_TEST_SET([$1])], [$2], [$3])])
1844 # AS_VAR_TEST_SET(VARIABLE)
1845 # -------------------------
1846 # Expands into the `test' expression which is true if VARIABLE
1847 # is set.  Polymorphic.
1848 m4_define([AS_VAR_TEST_SET],
1849 [AS_LITERAL_IF([$1],
1850                [test "${$1+set}" = set],
1851                [{ as_var=$1; eval "test \"\${$as_var+set}\" = set"; }])])
1854 ## -------------------- ##
1855 ## 8. Setting M4sh up.  ##
1856 ## -------------------- ##
1859 # AS_INIT_GENERATED(FILE, [COMMENT])
1860 # ----------------------------------
1861 # Generate a child script FILE with all initialization necessary to
1862 # reuse the environment learned by the parent script, and make the
1863 # file executable.  If COMMENT is supplied, it is inserted after the
1864 # `#!' sequence but before initialization text begins.  After this
1865 # macro, additional text can be appended to FILE to form the body of
1866 # the child script.  The macro ends with non-zero status if the
1867 # file could not be fully written (such as if the disk is full).
1868 m4_defun([AS_INIT_GENERATED],
1869 [m4_require([AS_PREPARE])]dnl
1870 [m4_pushdef([AS_MESSAGE_LOG_FD])]dnl
1871 [as_write_fail=0
1872 cat >$1 <<_ASEOF || as_write_fail=1
1873 #! $SHELL
1874 # Generated by $as_me.
1876 SHELL=\${CONFIG_SHELL-$SHELL}
1877 export SHELL
1878 _ASEOF
1879 cat >>$1 <<\_ASEOF || as_write_fail=1
1880 _AS_SHELL_SANITIZE
1881 _AS_PREPARE
1882 exec AS_MESSAGE_FD>&1
1883 m4_text_box([Main body of $1 script.])
1884 _ASEOF
1885 test $as_write_fail = 0 && chmod +x $1[]dnl
1886 _m4_popdef([AS_MESSAGE_LOG_FD])])# AS_INIT_GENERATED
1889 # AS_INIT
1890 # -------
1891 # Initialize m4sh.
1892 m4_define([AS_INIT],
1893 [# Wrap our cleanup prior to m4sugar's cleanup.
1894 m4_wrap([_AS_CLEANUP])
1895 m4_init
1896 m4_provide([AS_INIT])
1898 # Forbidden tokens and exceptions.
1899 m4_pattern_forbid([^_?AS_])
1901 # Bangshe and minimal initialization.
1902 m4_divert_text([BINSH], [@%:@! /bin/sh])
1903 m4_divert_text([HEADER-COMMENT],
1904                [@%:@ Generated from __file__ by m4_PACKAGE_STRING.])
1905 m4_divert_text([M4SH-SANITIZE], [_AS_SHELL_SANITIZE])
1906 m4_divert_text([M4SH-INIT-FN], [m4_text_box([M4sh Shell Functions.])])
1908 # Let's go!
1909 m4_divert_pop([KILL])[]dnl
1910 m4_divert_push([BODY])
1911 m4_text_box([Main body of script.])
1912 _AS_DETECT_REQUIRED([_AS_SHELL_FN_WORK])dnl
1913 AS_REQUIRE([_AS_UNSET_PREPARE], [], [M4SH-INIT-FN])dnl