Prefer HTTPS to FTP and HTTP
[autoconf.git] / lib / m4sugar / m4sh.m4
blobd7e41673fabf8e4289aaa245e5ff9a490a45d948
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-2017 Free Software Foundation, Inc.
7 # This file is part of Autoconf.  This program is free
8 # software; you can redistribute it and/or modify it under the
9 # terms of the GNU General Public License as published by the
10 # Free Software Foundation, either version 3 of the License, or
11 # (at your option) 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 # Under Section 7 of GPL version 3, you are granted additional
19 # permissions described in the Autoconf Configure Script Exception,
20 # version 3.0, as published by the Free Software Foundation.
22 # You should have received a copy of the GNU General Public License
23 # and a copy of the Autoconf Configure Script Exception along with
24 # this program; see the files COPYINGv3 and COPYING.EXCEPTION
25 # respectively.  If not, see <https://www.gnu.org/licenses/>.
27 # Written by Akim Demaille, Pavel Roskin, Alexandre Oliva, Lars J. Aas
28 # and many other people.
31 # We heavily use m4's diversions both for the initializations and for
32 # required macros, because in both cases we have to issue soon in
33 # output something which is discovered late.
36 # KILL is only used to suppress output.
38 # - BINSH
39 #   AC_REQUIRE'd #! /bin/sh line
40 # - HEADER-REVISION
41 #   RCS keywords etc.
42 # - HEADER-COMMENT
43 #   Purpose of the script etc.
44 # - HEADER-COPYRIGHT
45 #   Copyright notice(s)
46 # - M4SH-SANITIZE
47 #   M4sh's shell setup
48 # - M4SH-INIT-FN
49 #   M4sh initialization (shell functions)
50 # - M4SH-INIT
51 #   M4sh initialization (detection code)
52 # - BODY
53 #   The body of the script.
56 # _m4_divert(DIVERSION-NAME)
57 # --------------------------
58 # Convert a diversion name into its number.  Otherwise, return
59 # DIVERSION-NAME which is supposed to be an actual diversion number.
60 # Of course it would be nicer to use m4_case here, instead of zillions
61 # of little macros, but it then takes twice longer to run `autoconf'!
62 m4_define([_m4_divert(BINSH)],             0)
63 m4_define([_m4_divert(HEADER-REVISION)],   1)
64 m4_define([_m4_divert(HEADER-COMMENT)],    2)
65 m4_define([_m4_divert(HEADER-COPYRIGHT)],  3)
66 m4_define([_m4_divert(M4SH-SANITIZE)],     4)
67 m4_define([_m4_divert(M4SH-INIT-FN)],      5)
68 m4_define([_m4_divert(M4SH-INIT)],         6)
69 m4_define([_m4_divert(BODY)],           1000)
71 # Aaarg.  Yet it starts with compatibility issues...  Libtool wants to
72 # use NOTICE to insert its own LIBTOOL-INIT stuff.  People should ask
73 # before diving into our internals :(
74 m4_copy([_m4_divert(M4SH-INIT)], [_m4_divert(NOTICE)])
78 ## ------------------------- ##
79 ## 1. Sanitizing the shell.  ##
80 ## ------------------------- ##
81 # Please maintain lexicographic sorting of this section, ignoring leading _.
83 # AS_BOURNE_COMPATIBLE
84 # --------------------
85 # Try to be as Bourne and/or POSIX as possible.
87 # This does not set BIN_SH, due to the problems described in
88 # <https://lists.gnu.org/archive/html/autoconf-patches/2006-03/msg00081.html>.
89 # People who need BIN_SH should set it in their environment before invoking
90 # configure; apparently this would include UnixWare, as described in
91 # <https://lists.gnu.org/archive/html/bug-autoconf/2006-06/msg00025.html>.
92 m4_define([AS_BOURNE_COMPATIBLE],
93 [# Be more Bourne compatible
94 DUALCASE=1; export DUALCASE # for MKS sh
95 _$0
98 # _AS_BOURNE_COMPATIBLE
99 # ---------------------
100 # This is the part of AS_BOURNE_COMPATIBLE which has to be repeated inside
101 # each instance.
102 m4_define([_AS_BOURNE_COMPATIBLE],
103 [AS_IF([test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1],
104  [emulate sh
105   NULLCMD=:
106   [#] Pre-4.2 versions of Zsh do word splitting on ${1+"$[@]"}, which
107   # is contrary to our usage.  Disable this feature.
108   alias -g '${1+"$[@]"}'='"$[@]"'
109   setopt NO_GLOB_SUBST],
110  [AS_CASE([`(set -o) 2>/dev/null`], [*posix*], [set -o posix])])
114 # _AS_CLEANUP
115 # -----------
116 # Expanded as the last thing before m4sugar cleanup begins.  Macros
117 # may append m4sh cleanup hooks to this as appropriate.
118 m4_define([_AS_CLEANUP],
119 [m4_divert_text([M4SH-SANITIZE], [_AS_DETECT_BETTER_SHELL])])
122 # AS_COPYRIGHT(TEXT)
123 # ------------------
124 # Emit TEXT, a copyright notice, as a shell comment near the top of the
125 # script.  TEXT is evaluated once; to accomplish that, we do not prepend
126 # `# ' but `@%:@ '.
127 m4_define([AS_COPYRIGHT],
128 [m4_divert_text([HEADER-COPYRIGHT],
129 [m4_bpatsubst([
130 $1], [^], [@%:@ ])])])
133 # _AS_DETECT_EXPAND(VAR, SET)
134 # ---------------------------
135 # Assign the contents of VAR from the contents of SET, expanded in such
136 # a manner that VAR can be passed to _AS_RUN.  In order to make
137 # _AS_LINENO_WORKS operate correctly, we must specially handle the
138 # first instance of $LINENO within any line being expanded (the first
139 # instance is important to tests using the current shell, leaving
140 # remaining instances for tests using a candidate shell).  Bash loses
141 # track of line numbers if a double quote contains a newline, hence,
142 # we must piece-meal the assignment of VAR such that $LINENO expansion
143 # occurs in a single line.
144 m4_define([_AS_DETECT_EXPAND],
145 [$1="m4_bpatsubst(m4_dquote(AS_ESCAPE(_m4_expand(m4_set_contents([$2], [
146 ])))), [\\\$LINENO\(.*\)$], [";$1=$$1$LINENO;$1=$$1"\1])"])
149 # _AS_DETECT_REQUIRED(TEST)
150 # -------------------------
151 # Refuse to execute under a shell that does not pass the given TEST.
152 # Does not do AS_REQUIRE for the better-shell detection code.
154 # M4sh should never require something not required by POSIX, although
155 # other clients are free to do so.
156 m4_defun([_AS_DETECT_REQUIRED],
157 [m4_set_add([_AS_DETECT_REQUIRED_BODY], [$1 || AS_EXIT])])
160 # _AS_DETECT_SUGGESTED(TEST)
161 # --------------------------
162 # Prefer to execute under a shell that passes the given TEST.
163 # Does not do AS_REQUIRE for the better-shell detection code.
165 # M4sh should never suggest something not required by POSIX, although
166 # other clients are free to do so.
167 m4_defun([_AS_DETECT_SUGGESTED],
168 [m4_set_add([_AS_DETECT_SUGGESTED_BODY], [$1 || AS_EXIT])])
171 # _AS_DETECT_SUGGESTED_PRUNE(TEST)
172 # --------------------------------
173 # If TEST is also a required test, remove it from the set of suggested tests.
174 m4_define([_AS_DETECT_SUGGESTED_PRUNE],
175 [m4_set_contains([_AS_DETECT_REQUIRED_BODY], [$1],
176                  [m4_set_remove([_AS_DETECT_SUGGESTED_BODY], [$1])])])
179 # _AS_DETECT_BETTER_SHELL
180 # -----------------------
181 # The real workhorse for detecting a shell with the correct
182 # features.
184 # In previous versions, we prepended /usr/posix/bin to the path, but that
185 # caused a regression on OpenServer 6.0.0
186 # <https://lists.gnu.org/archive/html/bug-autoconf/2006-06/msg00017.html>
187 # and on HP-UX 11.11, see the failure of test 120 in
188 # <https://lists.gnu.org/archive/html/bug-autoconf/2006-10/msg00003.html>
190 # FIXME: The code should test for the OSF bug described in
191 # <https://lists.gnu.org/archive/html/autoconf-patches/2006-03/msg00081.html>.
193 # This code is run outside any trap 0 context, hence we can simplify AS_EXIT.
194 m4_defun([_AS_DETECT_BETTER_SHELL],
196 dnl By default, do not force re-execution of the script just because
197 dnl the user has pre-set $CONFIG_SHELL; do so only if the m4sh client has
198 dnl defined the internal variable `_AS_FORCE_REEXEC_WITH_CONFIG_SHELL' to
199 dnl "yes".
200 dnl FIXME: This interface is acceptable for the moment, as a private,
201 dnl FIXME: internal one; but if we want to make the "always re-execute"
202 dnl FIXME: feature public, we should find a better interface!
203 [m4_if(_AS_FORCE_REEXEC_WITH_CONFIG_SHELL, [yes],
204   [# Use a proper internal environment variable to ensure we don't fall
205   # into an infinite loop, continuously re-executing ourselves.
206   if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then
207     _as_can_reexec=no; export _as_can_reexec;
208     _AS_REEXEC_WITH_SHELL([$CONFIG_SHELL])
209   fi
210   # We don't want this to propagate to other subprocesses.
211   dnl This might be especially important in case an m4sh-generated script
212   dnl is used to later execute other m4sh-generated scripts.  This happens
213   dnl for example in autoconf's own testsuite (and happens *a lot* there,
214   dnl in fact).
215   AS_UNSET([_as_can_reexec])
216 ])]dnl
217 dnl Remove any tests from suggested that are also required
218 [m4_set_map([_AS_DETECT_SUGGESTED_BODY], [_AS_DETECT_SUGGESTED_PRUNE])]dnl
219 [m4_pushdef([AS_EXIT], [exit m4_default(]m4_dquote([$][1])[, 1)])]dnl
220 [if test "x$CONFIG_SHELL" = x; then
221   as_bourne_compatible="AS_ESCAPE(_m4_expand([_AS_BOURNE_COMPATIBLE]))"
222   _AS_DETECT_EXPAND([as_required], [_AS_DETECT_REQUIRED_BODY])
223   _AS_DETECT_EXPAND([as_suggested], [_AS_DETECT_SUGGESTED_BODY])
224   AS_IF([_AS_RUN(["$as_required"])],
225         [as_have_required=yes],
226         [as_have_required=no])
227   AS_IF([test x$as_have_required = xyes && _AS_RUN(["$as_suggested"])],
228     [],
229     [_AS_PATH_WALK([/bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH],
230       [case $as_dir in @%:@(
231          /*)
232            for as_base in sh bash ksh sh5; do
233              # Try only shells that exist, to save several forks.
234              as_shell=$as_dir$as_base
235              AS_IF([{ test -f "$as_shell" || test -f "$as_shell.exe"; } &&
236                     _AS_RUN(["$as_required"], ["$as_shell"])],
237                    [CONFIG_SHELL=$as_shell as_have_required=yes
238                    m4_set_empty([_AS_DETECT_SUGGESTED_BODY], [break 2],
239                      [AS_IF([_AS_RUN(["$as_suggested"], ["$as_shell"])],
240                             [break 2])])])
241            done;;
242        esac],
243       [AS_IF([{ test -f "$SHELL" || test -f "$SHELL.exe"; } &&
244               _AS_RUN(["$as_required"], ["$SHELL"])],
245              [CONFIG_SHELL=$SHELL as_have_required=yes])])
247       AS_IF([test "x$CONFIG_SHELL" != x],
248             [export CONFIG_SHELL
249              _AS_REEXEC_WITH_SHELL([$CONFIG_SHELL])])
251 dnl Unfortunately, $as_me isn't available here.
252     AS_IF([test x$as_have_required = xno],
253       [AS_ECHO(["$[]0: This script requires a shell more modern than all"])
254   AS_ECHO(["$[]0: the shells that I found on your system."])
255   if test ${ZSH_VERSION+y} ; then
256     AS_ECHO(["$[]0: In particular, zsh $ZSH_VERSION has bugs and should"])
257     AS_ECHO(["$[]0: be upgraded to zsh 4.3.4 or later."])
258   else
259     AS_ECHO("m4_text_wrap([Please tell ]_m4_defn([m4_PACKAGE_BUGREPORT])
260 m4_ifset([AC_PACKAGE_BUGREPORT], [m4_if(_m4_defn([m4_PACKAGE_BUGREPORT]),
261 _m4_defn([AC_PACKAGE_BUGREPORT]), [], [and _m4_defn([AC_PACKAGE_BUGREPORT])])])
262 [about your system, including any error possibly output before this message.
263 Then install a modern shell, or manually run the script under such a
264 shell if you do have one.], [$[]0: ], [], [62])")
265   fi
266   AS_EXIT])])
268 SHELL=${CONFIG_SHELL-/bin/sh}
269 export SHELL
270 # Unset more variables known to interfere with behavior of common tools.
271 CLICOLOR_FORCE= GREP_OPTIONS=
272 unset CLICOLOR_FORCE GREP_OPTIONS
273 _m4_popdef([AS_EXIT])])# _AS_DETECT_BETTER_SHELL
275 # _AS_REEXEC_WITH_SHELL(SHELL)
276 # ----------------------------
277 # Re-execute the current script with the given shell, trying to preserve
278 # portable settings (e.g., the `xtrace' and `verbose' shell flag).
279 m4_defun([_AS_REEXEC_WITH_SHELL], [dnl
280 # We cannot yet assume a decent shell, so we have to provide a
281 # neutralization value for shells without unset; and this also
282 # works around shells that cannot unset nonexistent variables.
283 # Preserve -v and -x to the replacement shell.
284 BASH_ENV=/dev/null
285 ENV=/dev/null
286 (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
287 case $- in @%:@ ((((
288   *v*x* | *x*v* ) as_opts=-vx ;;
289   *v* ) as_opts=-v ;;
290   *x* ) as_opts=-x ;;
291   * ) as_opts= ;;
292 esac
293 exec $1 $as_opts "$as_myself" ${1+"$[@]"}
294 # Admittedly, this is quite paranoid, since all the known shells bail
295 # out after a failed `exec'.
296 AS_ECHO(["$[]0: could not re-execute with $1"]) >&2
297 AS_EXIT([255])])# _AS_REEXEC_WITH_SHELL
300 # _AS_PREPARE
301 # -----------
302 # This macro has a very special status.  Normal use of M4sh relies
303 # heavily on AS_REQUIRE, so that needed initializations (such as
304 # _AS_TEST_PREPARE) are performed on need, not on demand.  But
305 # Autoconf is the first client of M4sh, and for two reasons: configure
306 # and config.status.  Relying on AS_REQUIRE is of course fine for
307 # configure, but fails for config.status (which is created by
308 # configure).  So we need a means to force the inclusion of the
309 # various _AS_*_PREPARE on top of config.status.  That's basically why
310 # there are so many _AS_*_PREPARE below, and that's also why it is
311 # important not to forget some: config.status needs them.
312 # List any preparations that create shell functions first, then
313 # topologically sort the others by their dependencies.
315 # Special case: we do not need _AS_LINENO_PREPARE, because the
316 # parent will have substituted $LINENO for us when processing its
317 # own invocation of _AS_LINENO_PREPARE.
319 # Special case: the full definition of _AS_ERROR_PREPARE is not output
320 # unless AS_MESSAGE_LOG_FD is non-empty, although the value of
321 # AS_MESSAGE_LOG_FD is not relevant.
322 m4_defun([_AS_PREPARE],
323 [m4_pushdef([AS_REQUIRE])]dnl
324 [m4_pushdef([AS_REQUIRE_SHELL_FN], _m4_defn([_AS_REQUIRE_SHELL_FN])
325 )]dnl
326 [m4_pushdef([AS_MESSAGE_LOG_FD], [-1])]dnl
327 [_AS_ERROR_PREPARE
328 _m4_popdef([AS_MESSAGE_LOG_FD])]dnl
329 [_AS_EXIT_PREPARE
330 _AS_UNSET_PREPARE
331 _AS_VAR_APPEND_PREPARE
332 _AS_VAR_ARITH_PREPARE
334 _AS_EXPR_PREPARE
335 _AS_BASENAME_PREPARE
336 _AS_DIRNAME_PREPARE
337 _AS_ME_PREPARE
338 _AS_CR_PREPARE
339 _AS_ECHO_N_PREPARE
340 _AS_LN_S_PREPARE
341 _AS_MKDIR_P_PREPARE
342 _AS_TEST_PREPARE
343 _AS_TR_CPP_PREPARE
344 _AS_TR_SH_PREPARE
345 _m4_popdef([AS_REQUIRE], [AS_REQUIRE_SHELL_FN])])
347 # AS_PREPARE
348 # ----------
349 # Output all the M4sh possible initialization into the initialization
350 # diversion.  We do not use _AS_PREPARE so that the m4_provide symbols for
351 # AS_REQUIRE and AS_REQUIRE_SHELL_FN are defined properly, and so that
352 # shell functions are placed in M4SH-INIT-FN.
353 m4_defun([AS_PREPARE],
354 [m4_divert_push([KILL])
355 m4_append_uniq([_AS_CLEANUP],
356   [m4_divert_text([M4SH-INIT-FN], [_AS_ERROR_PREPARE[]])])
357 AS_REQUIRE([_AS_EXPR_PREPARE])
358 AS_REQUIRE([_AS_BASENAME_PREPARE])
359 AS_REQUIRE([_AS_DIRNAME_PREPARE])
360 AS_REQUIRE([_AS_ME_PREPARE])
361 AS_REQUIRE([_AS_CR_PREPARE])
362 AS_REQUIRE([_AS_LINENO_PREPARE])
363 AS_REQUIRE([_AS_ECHO_N_PREPARE])
364 AS_REQUIRE([_AS_EXIT_PREPARE])
365 AS_REQUIRE([_AS_LN_S_PREPARE])
366 AS_REQUIRE([_AS_MKDIR_P_PREPARE])
367 AS_REQUIRE([_AS_TEST_PREPARE])
368 AS_REQUIRE([_AS_TR_CPP_PREPARE])
369 AS_REQUIRE([_AS_TR_SH_PREPARE])
370 AS_REQUIRE([_AS_UNSET_PREPARE])
371 AS_REQUIRE([_AS_VAR_APPEND_PREPARE], [], [M4SH-INIT-FN])
372 AS_REQUIRE([_AS_VAR_ARITH_PREPARE], [], [M4SH-INIT-FN])
373 m4_divert_pop[]])
376 # AS_REQUIRE(NAME-TO-CHECK, [BODY-TO-EXPAND = NAME-TO-CHECK],
377 #            [DIVERSION = M4SH-INIT])
378 # -----------------------------------------------------------
379 # BODY-TO-EXPAND is some initialization which must be expanded in the
380 # given diversion when expanded (required or not).  The expansion
381 # goes in the named diversion or an earlier one.
383 # Since $2 can be quite large, this is factored for faster execution, giving
384 # either m4_require([$1], [$2]) or m4_divert_require(desired, [$1], [$2]).
385 m4_defun([AS_REQUIRE],
386 [m4_define([_m4_divert_desired], [m4_default_quoted([$3], [M4SH-INIT])])]dnl
387 [m4_if(m4_eval(_m4_divert_dump - 0 <= _m4_divert(_m4_divert_desired, [-])),
388        1, [m4_require(],
389           [m4_divert_require(_m4_divert_desired,]) [$1], [$2])])
391 # _AS_REQUIRE_SHELL_FN(NAME-TO-CHECK, COMMENT, BODY-TO-EXPAND)
392 # ------------------------------------------------------------
393 # Core of AS_REQUIRE_SHELL_FN, but without diversion support.
394 m4_define([_AS_REQUIRE_SHELL_FN], [
395 m4_n([$2])$1 ()
398 } @%:@ $1[]])
400 # AS_REQUIRE_SHELL_FN(NAME-TO-CHECK, COMMENT, BODY-TO-EXPAND,
401 #                     [DIVERSION = M4SH-INIT-FN])
402 # -----------------------------------------------------------
403 # BODY-TO-EXPAND is the body of a shell function to be emitted in the
404 # given diversion when expanded (required or not).  Unlike other
405 # xx_REQUIRE macros, BODY-TO-EXPAND is mandatory.  If COMMENT is
406 # provided (often via AS_FUNCTION_DESCRIBE), it is listed with a
407 # newline before the function name.
408 m4_define([AS_REQUIRE_SHELL_FN],
409 [m4_provide_if([AS_SHELL_FN_$1], [],
410 [AS_REQUIRE([AS_SHELL_FN_$1],
411 [m4_provide([AS_SHELL_FN_$1])_$0($@)],
412 m4_default_quoted([$4], [M4SH-INIT-FN]))])])
415 # _AS_RUN(TEST, [SHELL])
416 # ----------------------
417 # Run TEST under the current shell (if one parameter is used)
418 # or under the given SHELL, protecting it from syntax errors.
419 # Set as_run in order to assist _AS_LINENO_WORKS.
420 m4_define([_AS_RUN],
421 [m4_ifval([$2], [{ $as_echo "$as_bourne_compatible"$1 | as_run=a $2; }],
422                 [(eval $1)]) 2>/dev/null])
425 # _AS_SHELL_FN_WORK
426 # -----------------
427 # This is a spy to detect "in the wild" shells that do not support shell
428 # functions correctly.  It is based on the m4sh.at Autotest testcases.
429 m4_define([_AS_SHELL_FN_WORK],
430 [as_fn_return () { (exit [$]1); }
431 as_fn_success () { as_fn_return 0; }
432 as_fn_failure () { as_fn_return 1; }
433 as_fn_ret_success () { return 0; }
434 as_fn_ret_failure () { return 1; }
436 exitcode=0
437 as_fn_success || { exitcode=1; echo as_fn_success failed.; }
438 as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }
439 as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }
440 as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }
441 AS_IF([( set x; as_fn_ret_success y && test x = "[$]1" )], [],
442       [exitcode=1; echo positional parameters were not saved.])
443 test x$exitcode = x0[]])# _AS_SHELL_FN_WORK
446 # _AS_SHELL_SANITIZE
447 # ------------------
448 # This is the prolog that is emitted by AS_INIT and AS_INIT_GENERATED;
449 # it is executed prior to shell function definitions, hence the
450 # temporary redefinition of AS_EXIT.
451 m4_defun([_AS_SHELL_SANITIZE],
452 [m4_pushdef([AS_EXIT], [exit m4_default(]m4_dquote([$][1])[, 1)])]dnl
453 [m4_text_box([M4sh Initialization.])
455 AS_BOURNE_COMPATIBLE
456 _AS_PATH_SEPARATOR_PREPARE
458 # IFS
459 # We need space, tab and new line, in precisely that order.  Quoting is
460 # there to prevent editors from complaining about space-tab.
461 # (If _AS_PATH_WALK were called with IFS unset, it would disable word
462 # splitting by setting IFS to empty value.)
463 as_nl='
465 export as_nl
466 IFS=" ""        $as_nl"
468 # Find who we are.  Look in the path if we contain no directory separator.
469 as_myself=
470 case $[0] in @%:@((
471   *[[\\/]]* ) as_myself=$[0] ;;
472   *) _AS_PATH_WALK([],
473                    [test -r "$as_dir$[0]" && as_myself=$as_dir$[0] && break])
474      ;;
475 esac
476 # We did not find ourselves, most probably we were run as `sh COMMAND'
477 # in which case we are not to be found in the path.
478 if test "x$as_myself" = x; then
479   as_myself=$[0]
481 if test ! -f "$as_myself"; then
482   AS_ECHO(["$as_myself: error: cannot find myself; rerun with an absolute file name"]) >&2
483   AS_EXIT
486 # Unset variables that we do not need and which cause bugs (e.g. in
487 # pre-3.0 UWIN ksh).  But do not cause bugs in bash 2.01; the "|| exit 1"
488 # suppresses any "Segmentation fault" message there.  '((' could
489 # trigger a bug in pdksh 5.2.14.
490 for as_var in BASH_ENV ENV MAIL MAILPATH
491 do eval test \${$as_var+y} \
492   && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
493 done
494 PS1='$ '
495 PS2='> '
496 PS4='+ '
498 # NLS nuisances.
499 LC_ALL=C
500 export LC_ALL
501 LANGUAGE=C
502 export LANGUAGE
504 # CDPATH.
505 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
506 _m4_popdef([AS_EXIT])])# _AS_SHELL_SANITIZE
509 # AS_SHELL_SANITIZE
510 # -----------------
511 # This is only needed for the sake of Libtool, which screws up royally
512 # in its usage of M4sh internals.
513 m4_define([AS_SHELL_SANITIZE],
514 [_AS_SHELL_SANITIZE
515 m4_provide_if([AS_INIT], [],
516 [m4_provide([AS_INIT])
517 _AS_DETECT_REQUIRED([_AS_SHELL_FN_WORK])
518 _AS_DETECT_REQUIRED([_AS_TEST_X_WORKS])
519 _AS_DETECT_BETTER_SHELL
520 _AS_UNSET_PREPARE
521 ])])
524 ## ----------------------------- ##
525 ## 2. Wrappers around builtins.  ##
526 ## ----------------------------- ##
528 # This section is lexicographically sorted.
531 # AS_CASE(WORD, [PATTERN1], [IF-MATCHED1]...[DEFAULT])
532 # ----------------------------------------------------
533 # Expand into
534 # | case WORD in #(
535 # |   PATTERN1) IF-MATCHED1 ;; #(
536 # |   ...
537 # |   *) DEFAULT ;;
538 # | esac
539 # The shell comments are intentional, to work around people who don't
540 # realize the impacts of using insufficient m4 quoting.  This macro
541 # always uses : and provides a default case, to work around Solaris
542 # /bin/sh bugs regarding the exit status.
543 m4_define([_AS_CASE],
544 [ [@%:@(]
545   $1[)] :
546     $2 ;;])
547 m4_define([_AS_CASE_DEFAULT],
548 [ [@%:@(]
549   *[)] :
550     $1 ;;])
552 m4_defun([AS_CASE],
553 [case $1 in[]m4_map_args_pair([_$0], [_$0_DEFAULT],
554    m4_shift($@m4_if(m4_eval([$# & 1]), [1], [,])))
555 esac])# AS_CASE
558 # _AS_EXIT_PREPARE
559 # ----------------
560 # Ensure AS_EXIT and AS_SET_STATUS will work.
562 # We cannot simply use "exit N" because some shells (zsh and Solaris sh)
563 # will not set $? to N while running the code set by "trap 0"
564 # Some shells fork even for (exit N), so we use a helper function
565 # to set $? prior to the exit.
566 # Then there are shells that don't inherit $? correctly into the start of
567 # a shell function, so we must always be given an argument.
568 # Other shells don't use `$?' as default for `exit', hence just repeating
569 # the exit value can only help improving portability.
570 m4_defun([_AS_EXIT_PREPARE],
571 [AS_REQUIRE_SHELL_FN([as_fn_set_status],
572   [AS_FUNCTION_DESCRIBE([as_fn_set_status], [STATUS],
573     [Set $? to STATUS, without forking.])], [  return $[]1])]dnl
574 [AS_REQUIRE_SHELL_FN([as_fn_exit],
575   [AS_FUNCTION_DESCRIBE([as_fn_exit], [STATUS],
576     [Exit the shell with STATUS, even in a "trap 0" or "set -e" context.])],
577 [  set +e
578   as_fn_set_status $[1]
579   exit $[1]])])#_AS_EXIT_PREPARE
582 # AS_EXIT([EXIT-CODE = $?])
583 # -------------------------
584 # Exit, with status set to EXIT-CODE in the way that it's seen
585 # within "trap 0", and without interference from "set -e".  If
586 # EXIT-CODE is omitted, then use $?.
587 m4_defun([AS_EXIT],
588 [AS_REQUIRE([_AS_EXIT_PREPARE])[]as_fn_exit m4_ifval([$1], [$1], [$][?])])
591 # AS_FOR(MACRO, SHELL-VAR, [LIST = "$@"], [BODY = :])
592 # ---------------------------------------------------
593 # Expand to a shell loop that assigns SHELL-VAR to each of the
594 # whitespace-separated entries in LIST (or "$@" if LIST is empty),
595 # then executes BODY.  BODY may call break to abort the loop, or
596 # continue to proceed with the next element of LIST.  Requires that
597 # IFS be set to the normal space-tab-newline.  As an optimization,
598 # BODY should access MACRO rather than $SHELL-VAR.  Normally, MACRO
599 # expands to $SHELL-VAR, but if LIST contains only a single element
600 # that needs no additional shell quoting, then MACRO will expand to
601 # that element, thus providing a direct value rather than a shell
602 # variable indirection.
604 # Only use the optimization if LIST can be used without additional
605 # shell quoting in either a literal or double-quoted context (that is,
606 # we give up on default IFS chars, parameter expansion, command
607 # substitution, shell quoting, globs, or quadrigraphs).  Inline the
608 # m4_defn for speed.
609 m4_defun([AS_FOR],
610 [m4_pushdef([$1], m4_if([$3], [], [[$$2]], m4_translit([$3], ]dnl
611 m4_dquote(_m4_defn([m4_cr_symbols2]))[[%+=:,./-]), [], [[$3]], [[$$2]]))]dnl
612 [for $2[]m4_ifval([$3], [ in $3])
613 do :
614   $4
615 done[]_m4_popdef([$1])])
618 # AS_IF(TEST1, [IF-TRUE1 = :]...[IF-FALSE = :])
619 # ---------------------------------------------
620 # Expand into
621 # | if TEST1
622 # | then
623 # |   IF-TRUE1
624 # | elif TEST2
625 # | then
626 # |   IF-TRUE2
627 # [...]
628 # | else
629 # |   IF-FALSE
630 # | fi
631 # with simplifications when IF-TRUE1 and/or IF-FALSE are empty.
633 m4_define([_AS_IF],
634 [elif $1
635 then :
636   $2
638 m4_define([_AS_IF_ELSE],
639 [m4_ifnblank([$1],
640 [else
641   $1
642 ])])
644 m4_defun([AS_IF],
645 [if $1
646 then :
647   $2
648 m4_map_args_pair([_$0], [_$0_ELSE], m4_shift2($@))]dnl
649 [fi[]])# AS_IF
652 # AS_SET_STATUS(STATUS)
653 # ---------------------
654 # Set the shell status ($?) to STATUS, without forking.
655 m4_defun([AS_SET_STATUS],
656 [AS_REQUIRE([_AS_EXIT_PREPARE])[]as_fn_set_status $1])
659 # _AS_UNSET_PREPARE
660 # -----------------
661 # Define $as_unset to execute AS_UNSET, for backwards compatibility
662 # with older versions of M4sh.
663 m4_defun([_AS_UNSET_PREPARE],
664 [AS_FUNCTION_DESCRIBE([as_fn_unset], [VAR], [Portably unset VAR.])
665 as_fn_unset ()
667   AS_UNSET([$[1]])
669 as_unset=as_fn_unset])
672 # AS_UNSET(VAR)
673 # -------------
674 # Unset the env VAR, working around shells that do not allow unsetting
675 # a variable that is not already set.  You should not unset MAIL and
676 # MAILCHECK, as that triggers a bug in Bash 2.01.
677 m4_defun([AS_UNSET],
678 [{ AS_LITERAL_WORD_IF([$1], [], [eval ])$1=; unset $1;}])
685 ## ------------------------------------------ ##
686 ## 3. Error and warnings at the shell level.  ##
687 ## ------------------------------------------ ##
690 # AS_MESSAGE_FD
691 # -------------
692 # Must expand to the fd where messages will be sent.  Defaults to 1,
693 # although a script may reassign this value and use exec to either
694 # copy stdout to the new fd, or open the new fd on /dev/null.
695 m4_define([AS_MESSAGE_FD], [1])
697 # AS_MESSAGE_LOG_FD
698 # -----------------
699 # Must expand to either the empty string (when no logging is
700 # performed), or to the fd of a log file.  Defaults to empty, although
701 # a script may reassign this value and use exec to open a log.  When
702 # not empty, messages to AS_MESSAGE_FD are duplicated to the log,
703 # along with a LINENO reference.
704 m4_define([AS_MESSAGE_LOG_FD])
707 # AS_ORIGINAL_STDIN_FD
708 # --------------------
709 # Must expand to the fd of the script's original stdin.  Defaults to
710 # 0, although the script may reassign this value and use exec to
711 # shuffle fd's.
712 m4_define([AS_ORIGINAL_STDIN_FD], [0])
715 # AS_ESCAPE(STRING, [CHARS = `\"$])
716 # ---------------------------------
717 # Add backslash escaping to the CHARS in STRING.  In an effort to
718 # optimize use of this macro inside double-quoted shell constructs,
719 # the behavior is intentionally undefined if CHARS is longer than 4
720 # bytes, or contains bytes outside of the set [`\"$].  However,
721 # repeated bytes within the set are permissible (AS_ESCAPE([$1], [""])
722 # being a common way to be nice to syntax highlighting).
724 # Avoid the m4_bpatsubst if there are no interesting characters to escape.
725 # _AS_ESCAPE bypasses argument defaulting.
726 m4_define([AS_ESCAPE],
727 [_$0([$1], m4_if([$2], [], [[`], [\"$]], [m4_substr([$2], [0], [1]), [$2]]))])
729 # _AS_ESCAPE(STRING, KEY, SET)
730 # ----------------------------
731 # Backslash-escape all instances of the single byte KEY or up to four
732 # bytes in SET occurring in STRING.  Although a character can occur
733 # multiple times, optimum efficiency occurs when KEY and SET are
734 # distinct, and when SET does not exceed two bytes.  These particular
735 # semantics allow for the fewest number of parses of STRING, as well
736 # as taking advantage of the optimizations in m4 1.4.13+ when
737 # m4_translit is passed SET of size 2 or smaller.
738 m4_define([_AS_ESCAPE],
739 [m4_if(m4_index(m4_translit([[$1]], [$3], [$2$2$2$2]), [$2]), [-1],
740        [$0_], [m4_bpatsubst])([$1], [[$2$3]], [\\\&])])
741 m4_define([_AS_ESCAPE_], [$1])
744 # _AS_QUOTE(STRING)
745 # -----------------
746 # If there are quoted (via backslash) backquotes, output STRING
747 # literally and warn; otherwise, output STRING with ` and " quoted.
749 # Compatibility glue between the old AS_MSG suite which did not
750 # quote anything, and the modern suite which quotes the quotes.
751 # If STRING contains `\\' or `\$', it's modern.
752 # If STRING contains `\"' or `\`', it's old.
753 # Otherwise it's modern.
755 # Profiling shows that m4_index is 5 to 8x faster than m4_bregexp.  The
756 # slower implementation used:
757 # m4_bmatch([$1],
758 #           [\\[\\$]], [$2],
759 #           [\\[`"]], [$3],
760 #           [$2])
761 # The current implementation caters to the common case of no backslashes,
762 # to minimize m4_index expansions (hence the nested if).
763 m4_define([_AS_QUOTE],
764 [m4_cond([m4_index([$1], [\])], [-1], [_AS_QUOTE_MODERN],
765          [m4_eval(m4_index(m4_translit([[$1]], [$], [\]), [\\]) >= 0)],
766 [1], [_AS_QUOTE_MODERN],
767          [m4_eval(m4_index(m4_translit([[$1]], ["], [`]), [\`]) >= 0)],dnl"
768 [1], [_AS_QUOTE_OLD],
769          [_AS_QUOTE_MODERN])([$1])])
771 m4_define([_AS_QUOTE_MODERN],
772 [_AS_ESCAPE([$1], [`], [""])])
774 m4_define([_AS_QUOTE_OLD],
775 [m4_warn([obsolete],
776    [back quotes and double quotes must not be escaped in: $1])$1])
779 # _AS_ECHO_UNQUOTED(STRING, [FD = AS_MESSAGE_FD])
780 # -----------------------------------------------
781 # Perform shell expansions on STRING and echo the string to FD.
782 m4_define([_AS_ECHO_UNQUOTED],
783 [AS_ECHO(["$1"]) >&m4_default([$2], [AS_MESSAGE_FD])])
786 # _AS_ECHO(STRING, [FD = AS_MESSAGE_FD])
787 # --------------------------------------
788 # Protect STRING from backquote expansion, echo the result to FD.
789 m4_define([_AS_ECHO],
790 [_AS_ECHO_UNQUOTED([_AS_QUOTE([$1])], [$2])])
793 # _AS_ECHO_LOG(STRING)
794 # --------------------
795 # Log the string to AS_MESSAGE_LOG_FD.
796 m4_defun_init([_AS_ECHO_LOG],
797 [AS_REQUIRE([_AS_LINENO_PREPARE])],
798 [_AS_ECHO([$as_me:${as_lineno-$LINENO}: $1], AS_MESSAGE_LOG_FD)])
801 # _AS_ECHO_N_PREPARE
802 # ------------------
803 # Check whether to use -n, \c, or newline-tab to separate
804 # checking messages from result messages.
805 # Don't try to cache, since the results of this macro are needed to
806 # display the checking message.  In addition, caching something used once
807 # has little interest.
808 # Idea borrowed from dist 3.0.  Use `*c*,', not `*c,' because if `\c'
809 # failed there is also a newline to match.  Use `xy' because `\c' echoed
810 # in a command substitution prints only the first character of the output
811 # with ksh version M-11/16/88f on AIX 6.1; it needs to be reset by another
812 # backquoted echo.
813 m4_defun([_AS_ECHO_N_PREPARE],
814 [ECHO_C= ECHO_N= ECHO_T=
815 case `echo -n x` in @%:@(((((
816 -n*)
817   case `echo 'xy\c'` in
818   *c*) ECHO_T=' ';;     # ECHO_T is single tab character.
819   xy)  ECHO_C='\c';;
820   *)   echo `echo ksh88 bug on AIX 6.1` > /dev/null
821        ECHO_T=' ';;
822   esac;;
824   ECHO_N='-n';;
825 esac
826 ])# _AS_ECHO_N_PREPARE
829 # _AS_ECHO_N(STRING, [FD = AS_MESSAGE_FD])
830 # ----------------------------------------
831 # Same as _AS_ECHO, but echo doesn't return to a new line.
832 m4_define([_AS_ECHO_N],
833 [AS_ECHO_N(["_AS_QUOTE([$1])"]) >&m4_default([$2], [AS_MESSAGE_FD])])
836 # AS_MESSAGE(STRING, [FD = AS_MESSAGE_FD])
837 # ----------------------------------------
838 # Output "`basename $0`: STRING" to the open file FD, and if logging
839 # is enabled, copy it to the log with a reference to LINENO.
840 m4_defun_init([AS_MESSAGE],
841 [AS_REQUIRE([_AS_ME_PREPARE])],
842 [m4_ifval(AS_MESSAGE_LOG_FD,
843           [{ _AS_ECHO_LOG([$1])
844 _AS_ECHO([$as_me: $1], [$2]);}],
845           [_AS_ECHO([$as_me: $1], [$2])])[]])
848 # AS_WARN(PROBLEM)
849 # ----------------
850 # Output "`basename $0`: WARNING: PROBLEM" to stderr.
851 m4_define([AS_WARN],
852 [AS_MESSAGE([WARNING: $1], [2])])# AS_WARN
855 # _AS_ERROR_PREPARE
856 # -----------------
857 # Output the shell function used by AS_ERROR.  This is designed to be
858 # expanded during the m4_wrap cleanup.
860 # If AS_MESSAGE_LOG_FD is non-empty at the end of the script, then
861 # make this function take optional parameters that use LINENO at the
862 # points where AS_ERROR was expanded with non-empty AS_MESSAGE_LOG_FD;
863 # otherwise, assume the entire script does not do logging.
864 m4_define([_AS_ERROR_PREPARE],
865 [AS_REQUIRE_SHELL_FN([as_fn_error],
866   [AS_FUNCTION_DESCRIBE([as_fn_error], [STATUS ERROR]m4_ifval(AS_MESSAGE_LOG_FD,
867       [[ [[LINENO LOG_FD]]]]),
868     [Output "`basename @S|@0`: error: ERROR" to stderr.]
869 m4_ifval(AS_MESSAGE_LOG_FD,
870     [[If LINENO and LOG_FD are provided, also output the error to LOG_FD,
871       referencing LINENO.]])
872     [Then exit the script with STATUS, using 1 if that was 0.])],
873 [  as_status=$[1]; test $as_status -eq 0 && as_status=1
874 m4_ifval(AS_MESSAGE_LOG_FD,
875 [m4_pushdef([AS_MESSAGE_LOG_FD], [$[4]])dnl
876   if test "$[4]"; then
877     AS_LINENO_PUSH([$[3]])
878     _AS_ECHO_LOG([error: $[2]])
879   fi
880 m4_define([AS_MESSAGE_LOG_FD])], [m4_pushdef([AS_MESSAGE_LOG_FD])])dnl
881   AS_MESSAGE([error: $[2]], [2])
882 _m4_popdef([AS_MESSAGE_LOG_FD])dnl
883   AS_EXIT([$as_status])])])
885 # AS_ERROR(ERROR, [EXIT-STATUS = max($?/1)])
886 # ------------------------------------------
887 # Output "`basename $0`: error: ERROR" to stderr, then exit the
888 # script with EXIT-STATUS.
889 m4_defun_init([AS_ERROR],
890 [m4_append_uniq([_AS_CLEANUP],
891   [m4_divert_text([M4SH-INIT-FN], [_AS_ERROR_PREPARE[]])])],
892 [as_fn_error m4_default([$2], [$?]) "_AS_QUOTE([$1])"m4_ifval(AS_MESSAGE_LOG_FD,
893   [ "$LINENO" AS_MESSAGE_LOG_FD])])
896 # AS_LINENO_PUSH([LINENO])
897 # ------------------------
898 # If this is the outermost call to AS_LINENO_PUSH, make sure that
899 # AS_MESSAGE will print LINENO as the line number.
900 m4_defun([AS_LINENO_PUSH],
901 [as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack])
904 # AS_LINENO_POP([LINENO])
905 # -----------------------
906 # If this is call balances the outermost call to AS_LINENO_PUSH,
907 # AS_MESSAGE will restart printing $LINENO as the line number.
909 # No need to use AS_UNSET, since as_lineno is necessarily set.
910 m4_defun([AS_LINENO_POP],
911 [eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno])
915 ## -------------------------------------- ##
916 ## 4. Portable versions of common tools.  ##
917 ## -------------------------------------- ##
919 # This section is lexicographically sorted.
922 # AS_BASENAME(FILE-NAME)
923 # ----------------------
924 # Simulate the command 'basename FILE-NAME'.  Not all systems have basename.
925 # Also see the comments for AS_DIRNAME.
927 m4_defun([_AS_BASENAME_EXPR],
928 [$as_expr X/[]$1 : '.*/\([[^/][^/]*]\)/*$' \| \
929          X[]$1 : 'X\(//\)$' \| \
930          X[]$1 : 'X\(/\)' \| .])
932 m4_defun([_AS_BASENAME_SED],
933 [AS_ECHO([X/[]$1]) |
934     sed ['/^.*\/\([^/][^/]*\)\/*$/{
935             s//\1/
936             q
937           }
938           /^X\/\(\/\/\)$/{
939             s//\1/
940             q
941           }
942           /^X\/\(\/\).*/{
943             s//\1/
944             q
945           }
946           s/.*/./; q']])
948 m4_defun_init([AS_BASENAME],
949 [AS_REQUIRE([_$0_PREPARE])],
950 [$as_basename -- $1 ||
951 _AS_BASENAME_EXPR([$1]) 2>/dev/null ||
952 _AS_BASENAME_SED([$1])])
955 # _AS_BASENAME_PREPARE
956 # --------------------
957 # Avoid Solaris 9 /usr/ucb/basename, as `basename /' outputs an empty line.
958 # Also, traditional basename mishandles --.  Require here _AS_EXPR_PREPARE,
959 # to avoid problems when _AS_BASENAME is called from the M4SH-INIT diversion.
960 m4_defun([_AS_BASENAME_PREPARE],
961 [AS_REQUIRE([_AS_EXPR_PREPARE])]dnl
962 [if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
963   as_basename=basename
964 else
965   as_basename=false
967 ])# _AS_BASENAME_PREPARE
970 # AS_DIRNAME(FILE-NAME)
971 # ---------------------
972 # Simulate the command 'dirname FILE-NAME'.  Not all systems have dirname.
973 # This macro must be usable from inside ` `.
975 # Prefer expr to echo|sed, since expr is usually faster and it handles
976 # backslashes and newlines correctly.  However, older expr
977 # implementations (e.g. SunOS 4 expr and Solaris 8 /usr/ucb/expr) have
978 # a silly length limit that causes expr to fail if the matched
979 # substring is longer than 120 bytes.  So fall back on echo|sed if
980 # expr fails.
981 m4_defun_init([_AS_DIRNAME_EXPR],
982 [AS_REQUIRE([_AS_EXPR_PREPARE])],
983 [$as_expr X[]$1 : 'X\(.*[[^/]]\)//*[[^/][^/]]*/*$' \| \
984          X[]$1 : 'X\(//\)[[^/]]' \| \
985          X[]$1 : 'X\(//\)$' \| \
986          X[]$1 : 'X\(/\)' \| .])
988 m4_defun([_AS_DIRNAME_SED],
989 [AS_ECHO([X[]$1]) |
990     sed ['/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
991             s//\1/
992             q
993           }
994           /^X\(\/\/\)[^/].*/{
995             s//\1/
996             q
997           }
998           /^X\(\/\/\)$/{
999             s//\1/
1000             q
1001           }
1002           /^X\(\/\).*/{
1003             s//\1/
1004             q
1005           }
1006           s/.*/./; q']])
1008 m4_defun_init([AS_DIRNAME],
1009 [AS_REQUIRE([_$0_PREPARE])],
1010 [$as_dirname -- $1 ||
1011 _AS_DIRNAME_EXPR([$1]) 2>/dev/null ||
1012 _AS_DIRNAME_SED([$1])])
1015 # _AS_DIRNAME_PREPARE
1016 # -------------------
1017 m4_defun([_AS_DIRNAME_PREPARE],
1018 [AS_REQUIRE([_AS_EXPR_PREPARE])]dnl
1019 [if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
1020   as_dirname=dirname
1021 else
1022   as_dirname=false
1024 ])# _AS_DIRNAME_PREPARE
1027 # AS_ECHO(WORD)
1028 # -------------
1029 # Output WORD followed by a newline.  WORD must be a single shell word
1030 # (typically a quoted string).  The bytes of WORD are output as-is, even
1031 # if it starts with "-" or contains "\".
1032 m4_defun([AS_ECHO],
1033 [printf "%s\n" $1])
1036 # AS_ECHO_N(WORD)
1037 # ---------------
1038 # Like AS_ECHO(WORD), except do not output the trailing newline.
1039 m4_defun([AS_ECHO_N],
1040 [printf %s $1])
1043 # AS_TEST_X
1044 # ---------
1045 # Check whether a file has executable or search permissions.
1046 # FIXME: This macro is no longer useful; consider deleting it in 2014
1047 # after we ensure m4sh scripts can always find a shell with test -x.
1048 m4_defun_init([AS_TEST_X],
1049 [AS_REQUIRE([_AS_TEST_PREPARE])],
1050 [test -x $1[]])# AS_TEST_X
1053 # AS_EXECUTABLE_P
1054 # ---------------
1055 # Check whether a file is a regular file that has executable permissions.
1056 m4_defun_init([AS_EXECUTABLE_P],
1057 [AS_REQUIRE([_AS_TEST_PREPARE])],
1058 [as_fn_executable_p $1])# AS_EXECUTABLE_P
1061 # _AS_EXPR_PREPARE
1062 # ----------------
1063 # QNX 4.25 expr computes and issue the right result but exits with failure.
1064 # Tru64 expr mishandles leading zeros in numeric strings.
1065 # Detect these flaws.
1066 m4_defun([_AS_EXPR_PREPARE],
1067 [if expr a : '\(a\)' >/dev/null 2>&1 &&
1068    test "X`expr 00001 : '.*\(...\)'`" = X001; then
1069   as_expr=expr
1070 else
1071   as_expr=false
1073 ])# _AS_EXPR_PREPARE
1076 # _AS_ME_PREPARE
1077 # --------------
1078 # Define $as_me to the basename of the executable file's name.
1079 m4_defun([AS_ME_PREPARE], [AS_REQUIRE([_$0])])
1080 m4_defun([_AS_ME_PREPARE],
1081 [AS_REQUIRE([_AS_BASENAME_PREPARE])]dnl
1082 [as_me=`AS_BASENAME("$[0]")`
1085 # _AS_LINENO_WORKS
1086 # ----------------
1087 # Succeed if the currently executing shell supports LINENO.
1088 # This macro does not expand to a single shell command, so be careful
1089 # when using it.  Surrounding the body of this macro with {} would
1090 # cause "bash -c '_ASLINENO_WORKS'" to fail (with Bash 2.05, anyway),
1091 # but that bug is irrelevant to our use of LINENO.  We can't use
1092 # AS_VAR_ARITH, as this is expanded prior to shell functions.
1094 # Testing for LINENO support is hard; we use _AS_LINENO_WORKS inside
1095 # _AS_RUN, which sometimes eval's its argument (pdksh gives false
1096 # negatives if $LINENO is expanded by eval), and sometimes passes the
1097 # argument to another shell (if the current shell supports LINENO,
1098 # then expanding $LINENO prior to the string leads to false
1099 # positives).  Hence, we perform two tests, and coordinate with
1100 # _AS_DETECT_EXPAND (which ensures that only the first of two LINENO
1101 # is expanded in advance) and _AS_RUN (which sets $as_run to 'a' when
1102 # handing the test to another shell), so that we know which test to
1103 # trust.
1104 m4_define([_AS_LINENO_WORKS],
1105 [  as_lineno_1=$LINENO as_lineno_1a=$LINENO
1106   as_lineno_2=$LINENO as_lineno_2a=$LINENO
1107   eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&
1108   test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"'])
1111 # _AS_LINENO_PREPARE
1112 # ------------------
1113 # If LINENO is not supported by the shell, produce a version of this
1114 # script where LINENO is hard coded.
1115 # Comparing LINENO against _oline_ is not a good solution, since in
1116 # the case of embedded executables (such as config.status within
1117 # configure) you'd compare LINENO wrt config.status vs. _oline_ wrt
1118 # configure.
1120 # AS_ERROR normally uses LINENO if logging, but AS_LINENO_PREPARE uses
1121 # AS_ERROR.  Besides, if the logging fd is open, we don't want to use
1122 # $LINENO in the log complaining about broken LINENO.  We break the
1123 # circular require by changing AS_ERROR and AS_MESSAGE_LOG_FD.
1124 m4_defun([AS_LINENO_PREPARE], [AS_REQUIRE([_$0])])
1125 m4_defun([_AS_LINENO_PREPARE],
1126 [AS_REQUIRE([_AS_CR_PREPARE])]dnl
1127 [AS_REQUIRE([_AS_ME_PREPARE])]dnl
1128 [_AS_DETECT_SUGGESTED([_AS_LINENO_WORKS])]dnl
1129 [m4_pushdef([AS_MESSAGE_LOG_FD])]dnl
1130 [m4_pushdef([AS_ERROR],
1131   [{ AS_MESSAGE(]m4_dquote([error: $][1])[, [2]); AS_EXIT([1]); }])]dnl
1132 dnl Create $as_me.lineno as a copy of $as_myself, but with $LINENO
1133 dnl uniformly replaced by the line number.  The first 'sed' inserts a
1134 dnl line-number line after each line using $LINENO; the second 'sed'
1135 dnl does the real work.  The second script uses 'N' to pair each
1136 dnl line-number line with the line containing $LINENO, and appends
1137 dnl trailing '-' during substitution so that $LINENO is not a special
1138 dnl case at line end.  (Raja R Harinath suggested sed '=', and Paul
1139 dnl Eggert wrote the scripts with optimization help from Paolo Bonzini).
1140 [_AS_LINENO_WORKS || {
1141 [  # Blame Lee E. McMahon (1931-1989) for sed's syntax.  :-)
1142   sed -n '
1143     p
1144     /[$]LINENO/=
1145   ' <$as_myself |
1146     sed '
1147       s/[$]LINENO.*/&-/
1148       t lineno
1149       b
1150       :lineno
1151       N
1152       :loop
1153       s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
1154       t loop
1155       s/-\n.*//
1156     ' >$as_me.lineno &&
1157   chmod +x "$as_me.lineno"] ||
1158     AS_ERROR([cannot create $as_me.lineno; rerun with a POSIX shell])
1160   # If we had to re-execute with $CONFIG_SHELL, we're ensured to have
1161   # already done that, so ensure we don't try to do so again and fall
1162   # in an infinite loop.  This has already happened in practice.
1163   _as_can_reexec=no; export _as_can_reexec
1164   # Don't try to exec as it changes $[0], causing all sort of problems
1165   # (the dirname of $[0] is not the place where we might find the
1166   # original and so on.  Autoconf is especially sensitive to this).
1167   . "./$as_me.lineno"
1168   # Exit status is that of the last command.
1169   exit
1171 _m4_popdef([AS_MESSAGE_LOG_FD], [AS_ERROR])])# _AS_LINENO_PREPARE
1174 # _AS_LN_S_PREPARE
1175 # ----------------
1176 # Don't use conftest.sym to avoid file name issues on DJGPP, where this
1177 # would yield conftest.sym.exe for DJGPP < 2.04.  And don't use `conftest'
1178 # as base name to avoid prohibiting concurrency (e.g., concurrent
1179 # config.statuses).  On read-only media, assume 'cp -pR' and hope we
1180 # are just running --help anyway.
1181 m4_defun([_AS_LN_S_PREPARE],
1182 [rm -f conf$$ conf$$.exe conf$$.file
1183 if test -d conf$$.dir; then
1184   rm -f conf$$.dir/conf$$.file
1185 else
1186   rm -f conf$$.dir
1187   mkdir conf$$.dir 2>/dev/null
1189 if (echo >conf$$.file) 2>/dev/null; then
1190   if ln -s conf$$.file conf$$ 2>/dev/null; then
1191     as_ln_s='ln -s'
1192     # ... but there are two gotchas:
1193     # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
1194     # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
1195     # In both cases, we have to default to `cp -pR'.
1196     ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
1197       as_ln_s='cp -pR'
1198   elif ln conf$$.file conf$$ 2>/dev/null; then
1199     as_ln_s=ln
1200   else
1201     as_ln_s='cp -pR'
1202   fi
1203 else
1204   as_ln_s='cp -pR'
1206 rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
1207 rmdir conf$$.dir 2>/dev/null
1208 ])# _AS_LN_S_PREPARE
1211 # AS_LN_S(FILE, LINK)
1212 # -------------------
1213 # FIXME: Should we add the glue code to handle properly relative symlinks
1214 # simulated with `ln' or `cp'?
1215 m4_defun_init([AS_LN_S],
1216 [AS_REQUIRE([_AS_LN_S_PREPARE])],
1217 [$as_ln_s $1 $2])
1220 # _AS_MKDIR_P
1221 # -----------
1222 # Emit code that can be used to emulate `mkdir -p` with plain `mkdir';
1223 # the code assumes that "$as_dir" contains the directory to create.
1224 # $as_dir is normalized, so there is no need to worry about using --.
1225 m4_define([_AS_MKDIR_P],
1226 [case $as_dir in #(
1227   -*) as_dir=./$as_dir;;
1228   esac
1229   test -d "$as_dir" || eval $as_mkdir_p || {
1230     as_dirs=
1231     while :; do
1232       case $as_dir in #(
1233       *\'*) as_qdir=`AS_ECHO(["$as_dir"]) | sed "s/'/'\\\\\\\\''/g"`;; #'(
1234       *) as_qdir=$as_dir;;
1235       esac
1236       as_dirs="'$as_qdir' $as_dirs"
1237       as_dir=`AS_DIRNAME("$as_dir")`
1238       test -d "$as_dir" && break
1239     done
1240     test -z "$as_dirs" || eval "mkdir $as_dirs"
1241   } || test -d "$as_dir" || AS_ERROR([cannot create directory $as_dir])
1244 # AS_MKDIR_P(DIR)
1245 # ---------------
1246 # Emulate `mkdir -p' with plain `mkdir' if needed.
1247 m4_defun_init([AS_MKDIR_P],
1248 [AS_REQUIRE([_$0_PREPARE])],
1249 [as_dir=$1; as_fn_mkdir_p])# AS_MKDIR_P
1252 # _AS_MKDIR_P_PREPARE
1253 # -------------------
1254 m4_defun([_AS_MKDIR_P_PREPARE],
1255 [AS_REQUIRE_SHELL_FN([as_fn_mkdir_p],
1256   [AS_FUNCTION_DESCRIBE([as_fn_mkdir_p], [],
1257     [Create "$as_dir" as a directory, including parents if necessary.])],
1259   _AS_MKDIR_P
1260 ])]dnl
1261 [if mkdir -p . 2>/dev/null; then
1262   as_mkdir_p='mkdir -p "$as_dir"'
1263 else
1264   test -d ./-p && rmdir ./-p
1265   as_mkdir_p=false
1267 ])# _AS_MKDIR_P_PREPARE
1270 # _AS_PATH_SEPARATOR_PREPARE
1271 # --------------------------
1272 # Compute the path separator.
1273 m4_defun([_AS_PATH_SEPARATOR_PREPARE],
1274 [# The user is always right.
1275 if ${PATH_SEPARATOR+false} :; then
1276   PATH_SEPARATOR=:
1277   (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
1278     (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
1279       PATH_SEPARATOR=';'
1280   }
1282 ])# _AS_PATH_SEPARATOR_PREPARE
1285 # _AS_PATH_WALK([PATH = $PATH], BODY, [IF-NOT-FOUND])
1286 # ---------------------------------------------------
1287 # Walk through PATH running BODY for each `as_dir', with a trailing slash
1288 # already present.  If BODY never does a `break', evaluate IF-NOT-FOUND.
1290 # Still very private as its interface looks quite bad.
1292 # `$as_dummy' forces splitting on constant user-supplied paths.
1293 # POSIX.2 field splitting is done only on the result of word
1294 # expansions, not on literal text.  This closes a longstanding sh security
1295 # hole.  Optimize it away when not needed, i.e., if there are no literal
1296 # path separators.
1297 m4_defun_init([_AS_PATH_WALK],
1298 [AS_REQUIRE([_AS_PATH_SEPARATOR_PREPARE])],
1299 [as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
1300 m4_ifvaln([$3], [as_found=false])dnl
1301 m4_if([$1], m4_translit([[$1]], [:;]),
1302 [for as_dir in m4_default([$1], [$PATH])],
1303 [as_dummy="$1"
1304 for as_dir in $as_dummy])
1306   IFS=$as_save_IFS
1307   case $as_dir in #(((
1308     '') as_dir=./ ;;
1309     */) ;;
1310     *) as_dir=$as_dir/ ;;
1311   esac
1312   m4_ifvaln([$3], [as_found=:])dnl
1313   $2
1314   m4_ifvaln([$3], [as_found=false])dnl
1315 done
1316 IFS=$as_save_IFS
1317 m4_ifvaln([$3], [$as_found || { $3; }])dnl
1321 # AS_SET_CATFILE(VAR, DIR-NAME, FILE-NAME)
1322 # ----------------------------------------
1323 # Set VAR to DIR-NAME/FILE-NAME.
1324 # Optimize the common case where $2 or $3 is '.'.
1325 m4_define([AS_SET_CATFILE],
1326 [case $2 in @%:@((
1327 .) AS_VAR_SET([$1], [$3]);;
1329   case $3 in @%:@(((
1330   .) AS_VAR_SET([$1], [$2]);;
1331   [[\\/]]* | ?:[[\\/]]* ) AS_VAR_SET([$1], [$3]);;
1332   *) AS_VAR_SET([$1], [$2/$3]);;
1333   esac;;
1334 esac[]])# AS_SET_CATFILE
1337 # _AS_TEST_X_WORKS
1338 # ----------------
1339 # These days, we require that `test -x' works.
1340 m4_define([_AS_TEST_X_WORKS], [test -x /])
1342 # _AS_TEST_PREPARE
1343 # ----------------
1344 # Provide back-compat to people that hooked into our undocumented
1345 # internals (here's looking at you, libtool).
1346 m4_defun([_AS_TEST_PREPARE],
1347 [AS_REQUIRE_SHELL_FN([as_fn_executable_p],
1348   [AS_FUNCTION_DESCRIBE([as_fn_executable_p], [FILE],
1349     [Test if FILE is an executable regular file.])],
1350   [  test -f "$[]1" && test -x "$[]1"])]dnl
1351 [as_test_x='test -x'
1352 as_executable_p=as_fn_executable_p
1353 ])# _AS_TEST_PREPARE
1358 ## ------------------ ##
1359 ## 5. Common idioms.  ##
1360 ## ------------------ ##
1362 # This section is lexicographically sorted.
1365 # AS_BOX(MESSAGE, [FRAME-CHARACTER = `-'])
1366 # ----------------------------------------
1367 # Output MESSAGE, a single line text, framed with FRAME-CHARACTER (which
1368 # must not be `/').
1369 m4_define([AS_BOX],
1370 [_$0(m4_expand([$1]), [$2])])
1372 m4_define([_AS_BOX],
1373 [m4_if(m4_index(m4_translit([[$1]], [`\"], [$$$]), [$]),
1374   [-1], [$0_LITERAL], [$0_INDIR])($@)])
1377 # _AS_BOX_LITERAL(MESSAGE, [FRAME-CHARACTER = `-'])
1378 # -------------------------------------------------
1379 m4_define([_AS_BOX_LITERAL],
1380 [AS_ECHO(["_AS_ESCAPE(m4_dquote(m4_expand([m4_text_box($@)])), [`], [\"$])"])])
1383 # _AS_BOX_INDIR(MESSAGE, [FRAME-CHARACTER = `-'])
1384 # -----------------------------------------------
1385 m4_define([_AS_BOX_INDIR],
1386 [sed 'h;s/./m4_default([$2], [-])/g;s/^.../@%:@@%:@ /;s/...$/ @%:@@%:@/;p;x;p;x' <<_ASBOX
1387 @%:@@%:@ $1 @%:@@%:@
1388 _ASBOX])
1391 # _AS_CLEAN_DIR(DIR)
1392 # ------------------
1393 # Remove all contents from within DIR, including any unwritable
1394 # subdirectories, but leave DIR itself untouched.
1395 m4_define([_AS_CLEAN_DIR],
1396 [if test -d $1
1397 then
1398   find $1 -type d ! -perm -700 -exec chmod u+rwx {} \;
1399   rm -fr $1/* $1/.[[!.]] $1/.??*
1400 fi])
1403 # AS_FUNCTION_DESCRIBE(NAME, [ARGS], DESCRIPTION, [WRAP-COLUMN = 79])
1404 # -------------------------------------------------------------------
1405 # Output a shell comment describing NAME and its arguments ARGS, then
1406 # a separator line, then the DESCRIPTION wrapped at a decimal
1407 # WRAP-COLUMN.  The output resembles:
1408 #  # NAME ARGS
1409 #  # ---------
1410 #  # Wrapped DESCRIPTION text
1411 # NAME and ARGS are expanded, while DESCRIPTION is treated as a
1412 # whitespace-separated list of strings that are not expanded.
1413 m4_define([AS_FUNCTION_DESCRIBE],
1414 [@%:@ $1[]m4_ifval([$2], [ $2])
1415 @%:@ m4_translit(m4_format([%*s],
1416            m4_decr(m4_qlen(_m4_expand([$1[]m4_ifval([$2], [ $2])
1417 ]))), []), [ ], [-])
1418 m4_text_wrap([$3], [@%:@ ], [], [$4])])
1421 # AS_HELP_STRING(LHS, RHS, [INDENT-COLUMN = 26], [WRAP-COLUMN = 79])
1422 # ------------------------------------------------------------------
1424 # Format a help string so that it looks pretty when the user executes
1425 # "script --help".  This macro takes up to four arguments, a
1426 # "left hand side" (LHS), a "right hand side" (RHS), a decimal
1427 # INDENT-COLUMN which is the column where wrapped lines should begin
1428 # (the default of 26 is recommended), and a decimal WRAP-COLUMN which is
1429 # the column where lines should wrap (the default of 79 is recommended).
1430 # LHS is expanded, RHS is not.
1432 # For backwards compatibility not documented in the manual, INDENT-COLUMN
1433 # can also be specified as a string of white spaces, whose width
1434 # determines the indentation column.  Using TABs in INDENT-COLUMN is not
1435 # recommended, since screen width of TAB is not computed.
1437 # The resulting string is suitable for use in other macros that require
1438 # a help string (e.g. AC_ARG_WITH).
1440 # Here is the sample string from the Autoconf manual (Node: External
1441 # Software) which shows the proper spacing for help strings.
1443 #    --with-readline         support fancy command line editing
1444 #  ^ ^                       ^
1445 #  | |                       |
1446 #  | column 2                column 26
1447 #  |
1448 #  column 0
1450 # A help string is made up of a "left hand side" (LHS) and a "right
1451 # hand side" (RHS).  In the example above, the LHS is
1452 # "--with-readline", while the RHS is "support fancy command line
1453 # editing".
1455 # If the LHS contains more than (INDENT-COLUMN - 3) characters, then the
1456 # LHS is terminated with a newline so that the RHS starts on a line of its
1457 # own beginning at INDENT-COLUMN.  In the default case, this corresponds to an
1458 # LHS with more than 23 characters.
1460 # Therefore, in the example, if the LHS were instead
1461 # "--with-readline-blah-blah-blah", then the AS_HELP_STRING macro would
1462 # expand into:
1465 #    --with-readline-blah-blah-blah
1466 #  ^ ^                       support fancy command line editing
1467 #  | |                       ^
1468 #  | column 2                |
1469 #  column 0                  column 26
1472 # m4_text_wrap hacks^Wworks around the fact that m4_format does not
1473 # know quadrigraphs.
1475 m4_define([AS_HELP_STRING],
1476 [m4_text_wrap([$2], m4_cond([[$3]], [], [                          ],
1477                             [m4_eval([$3]+0)], [0], [[$3]],
1478                             [m4_format([[%*s]], [$3], [])]),
1479               m4_expand([  $1 ]), [$4])])# AS_HELP_STRING
1482 # AS_IDENTIFIER_IF(EXPRESSION, IF-IDENT, IF-NOT-IDENT)
1483 # ----------------------------------------------------
1484 # If EXPRESSION serves as an identifier (ie, after removal of @&t@, it
1485 # matches the regex `^[a-zA-Z_][a-zA-Z_0-9]*$'), execute IF-IDENT,
1486 # otherwise IF-NOT-IDENT.
1488 # This is generally faster than the alternative:
1489 #   m4_bmatch(m4_bpatsubst([[$1]], [@&t@]), ^m4_defn([m4_re_word])$,
1490 #             [$2], [$3])
1492 # Rather than expand m4_defn every time AS_IDENTIFIER_IF is expanded, we
1493 # inline its expansion up front.  Only use a regular expression if we
1494 # detect a potential quadrigraph.
1496 # First, check if the entire string matches m4_cr_symbol2.  Only then do
1497 # we worry if the first character also matches m4_cr_symbol1 (ie. does not
1498 # match m4_cr_digit).
1499 m4_define([AS_IDENTIFIER_IF],
1500 [m4_if(_$0(m4_if(m4_index([$1], [@]), [-1],
1501   [[$1]], [m4_bpatsubst([[$1]], [@&t@])])), [-], [$2], [$3])])
1503 m4_define([_AS_IDENTIFIER_IF],
1504 [m4_cond([[$1]], [], [],
1505          [m4_eval(m4_len(m4_translit([[$1]], ]]dnl
1506 m4_dquote(m4_dquote(m4_defn([m4_cr_symbols2])))[[)) > 0)], [1], [],
1507          [m4_len(m4_translit(m4_format([[%.1s]], [$1]), ]]dnl
1508 m4_dquote(m4_dquote(m4_defn([m4_cr_symbols1])))[[))], [0], [-])])
1511 # AS_LITERAL_IF(EXPRESSION, IF-LITERAL, IF-NOT-LITERAL,
1512 #               [IF-SIMPLE-REF = IF-NOT-LITERAL])
1513 # -----------------------------------------------------
1514 # If EXPRESSION has no shell indirections ($var or `expr`), expand
1515 # IF-LITERAL, else IF-NOT-LITERAL.  In some cases, IF-NOT-LITERAL
1516 # must be complex to safely deal with ``, while a simpler
1517 # expression IF-SIMPLE-REF can be used if the indirection
1518 # involves only shell variable expansion (as in ${varname}).
1520 # EXPRESSION is treated as a literal if it results in the same
1521 # interpretation whether it is unquoted or contained within double
1522 # quotes, with the exception that whitespace is ignored (on the
1523 # assumption that it will be flattened to _).  Therefore, neither `\$'
1524 # nor `a''b' is a literal, since both backslash and single quotes have
1525 # different quoting behavior in the two contexts; and `a*' is not a
1526 # literal, because it has different globbing.  Note, however, that
1527 # while `${a+b}' is neither a literal nor a simple ref, `a+b' is a
1528 # literal.  This macro is an *approximation*: it is possible that
1529 # there are some EXPRESSIONs which the shell would treat as literals,
1530 # but which this macro does not recognize.
1532 # Why do we reject EXPRESSION expanding with `[' or `]' as a literal?
1533 # Because AS_TR_SH is MUCH faster if it can use m4_translit on literals
1534 # instead of m4_bpatsubst; but m4_translit is much tougher to do safely
1535 # if `[' is translated.  That, and file globbing matters.
1537 # Note that the quadrigraph @S|@ can result in non-literals, but outright
1538 # rejecting all @ would make AC_INIT complain on its bug report address.
1540 # We used to use m4_bmatch(m4_quote($1), [[`$]], [$3], [$2]), but
1541 # profiling shows that it is faster to use m4_translit.
1543 # Because the translit is stripping quotes, it must also neutralize
1544 # anything that might be in a macro name, as well as comments, commas,
1545 # or unbalanced parentheses.  Valid shell variable characters and
1546 # unambiguous literal characters are deleted (`a.b'), and remaining
1547 # characters are normalized into `$' if they can form simple refs
1548 # (${a}), `+' if they can potentially form literals (a+b), ``' if they
1549 # can interfere with m4 parsing, or left alone otherwise.  If both `$'
1550 # and `+' are left, it is treated as a complex reference (${a+b}),
1551 # even though it could technically be a simple reference (${a}+b).
1552 # _AS_LITERAL_IF_ only has to check for an empty string after removing
1553 # one of the two normalized characters.
1555 # Rather than expand m4_defn every time AS_LITERAL_IF is expanded, we
1556 # inline its expansion up front.  _AS_LITERAL_IF expands to the name
1557 # of a macro that takes three arguments: IF-SIMPLE-REF,
1558 # IF-NOT-LITERAL, IF-LITERAL.  It also takes an optional argument of
1559 # any additional characters to allow as literals (useful for AS_TR_SH
1560 # and AS_TR_CPP to perform inline conversion of whitespace to _).  The
1561 # order of the arguments allows reuse of m4_default.
1562 m4_define([AS_LITERAL_IF],
1563 [_$0(m4_expand([$1]), [  ][
1564 ])([$4], [$3], [$2])])
1566 m4_define([_AS_LITERAL_IF],
1567 [m4_if(m4_index([$1], [@S|@]), [-1], [$0_(m4_translit([$1],
1568   [-:=%/@{}[]#(),.$2]]]m4_dquote(m4_dquote(m4_defn([m4_cr_symbols2])))[[,
1569   [++++++$$`````]))], [$0_NO])])
1571 m4_define([_AS_LITERAL_IF_],
1572 [m4_if(m4_translit([$1], [+]), [], [$0YES],
1573        m4_translit([$1], [$]), [], [m4_default], [$0NO])])
1575 m4_define([_AS_LITERAL_IF_YES], [$3])
1576 m4_define([_AS_LITERAL_IF_NO], [$2])
1578 # AS_LITERAL_WORD_IF(EXPRESSION, IF-LITERAL, IF-NOT-LITERAL,
1579 #                    [IF-SIMPLE-REF = IF-NOT-LITERAL])
1580 # ----------------------------------------------------------
1581 # Like AS_LITERAL_IF, except that spaces and tabs in EXPRESSION
1582 # are treated as non-literal.
1583 m4_define([AS_LITERAL_WORD_IF],
1584 [_AS_LITERAL_IF(m4_expand([$1]))([$4], [$3], [$2])])
1586 # AS_LITERAL_HEREDOC_IF(EXPRESSION, IF-LITERAL, IF-NOT-LITERAL)
1587 # -------------------------------------------------------------
1588 # Like AS_LITERAL_IF, except that a string is considered literal
1589 # if it results in the same output in both quoted and unquoted
1590 # here-documents.
1591 m4_define([AS_LITERAL_HEREDOC_IF],
1592 [_$0(m4_expand([$1]))([$2], [$3])])
1594 m4_define([_AS_LITERAL_HEREDOC_IF],
1595 [m4_if(m4_index([$1], [@S|@]), [-1],
1596   [m4_if(m4_index(m4_translit([[$1]], [\`], [$]), [$]), [-1],
1597     [$0_YES], [$0_NO])],
1598   [$0_NO])])
1600 m4_define([_AS_LITERAL_HEREDOC_IF_YES], [$1])
1601 m4_define([_AS_LITERAL_HEREDOC_IF_NO], [$2])
1604 # AS_TMPDIR(PREFIX, [DIRECTORY = $TMPDIR [= /tmp]])
1605 # -------------------------------------------------
1606 # Create as safely as possible a temporary directory in DIRECTORY
1607 # which name is inspired by PREFIX (should be 2-4 chars max).
1609 # Even though $tmp does not fit our normal naming scheme of $as_*,
1610 # it is a documented part of the public API and must not be changed.
1611 m4_define([AS_TMPDIR],
1612 [# Create a (secure) tmp directory for tmp files.
1613 m4_if([$2], [], [: "${TMPDIR:=/tmp}"])
1615   tmp=`(umask 077 && mktemp -d "m4_default([$2],
1616     [$TMPDIR])/$1XXXXXX") 2>/dev/null` &&
1617   test -d "$tmp"
1618 }  ||
1620   tmp=m4_default([$2], [$TMPDIR])/$1$$-$RANDOM
1621   (umask 077 && mkdir "$tmp")
1622 } || AS_ERROR([cannot create a temporary directory in m4_default([$2],
1623               [$TMPDIR])])])# AS_TMPDIR
1626 # AS_UNAME
1627 # --------
1628 # Try to describe this machine.  Meant for logs.
1629 m4_define([AS_UNAME],
1631 cat <<_ASUNAME
1632 m4_text_box([Platform.])
1634 hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
1635 uname -m = `(uname -m) 2>/dev/null || echo unknown`
1636 uname -r = `(uname -r) 2>/dev/null || echo unknown`
1637 uname -s = `(uname -s) 2>/dev/null || echo unknown`
1638 uname -v = `(uname -v) 2>/dev/null || echo unknown`
1640 /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
1641 /bin/uname -X     = `(/bin/uname -X) 2>/dev/null     || echo unknown`
1643 /bin/arch              = `(/bin/arch) 2>/dev/null              || echo unknown`
1644 /usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null       || echo unknown`
1645 /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
1646 /usr/bin/hostinfo      = `(/usr/bin/hostinfo) 2>/dev/null      || echo unknown`
1647 /bin/machine           = `(/bin/machine) 2>/dev/null           || echo unknown`
1648 /usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null       || echo unknown`
1649 /bin/universe          = `(/bin/universe) 2>/dev/null          || echo unknown`
1651 _ASUNAME
1653 _AS_PATH_WALK([$PATH], [AS_ECHO(["PATH: $as_dir"])])
1657 # _AS_VERSION_COMPARE_PREPARE
1658 # ---------------------------
1659 # Output variables for comparing version numbers.
1660 m4_defun([_AS_VERSION_COMPARE_PREPARE],
1661 [[as_awk_strverscmp='
1662   # Use only awk features that work with 7th edition Unix awk (1978).
1663   # My, what an old awk you have, Mr. Solaris!
1664   END {
1665     while (length(v1) && length(v2)) {
1666       # Set d1 to be the next thing to compare from v1, and likewise for d2.
1667       # Normally this is a single character, but if v1 and v2 contain digits,
1668       # compare them as integers and fractions as strverscmp does.
1669       if (v1 ~ /^[0-9]/ && v2 ~ /^[0-9]/) {
1670         # Split v1 and v2 into their leading digit string components d1 and d2,
1671         # and advance v1 and v2 past the leading digit strings.
1672         for (len1 = 1; substr(v1, len1 + 1) ~ /^[0-9]/; len1++) continue
1673         for (len2 = 1; substr(v2, len2 + 1) ~ /^[0-9]/; len2++) continue
1674         d1 = substr(v1, 1, len1); v1 = substr(v1, len1 + 1)
1675         d2 = substr(v2, 1, len2); v2 = substr(v2, len2 + 1)
1676         if (d1 ~ /^0/) {
1677           if (d2 ~ /^0/) {
1678             # Compare two fractions.
1679             while (d1 ~ /^0/ && d2 ~ /^0/) {
1680               d1 = substr(d1, 2); len1--
1681               d2 = substr(d2, 2); len2--
1682             }
1683             if (len1 != len2 && ! (len1 && len2 && substr(d1, 1, 1) == substr(d2, 1, 1))) {
1684               # The two components differ in length, and the common prefix
1685               # contains only leading zeros.  Consider the longer to be less.
1686               d1 = -len1
1687               d2 = -len2
1688             } else {
1689               # Otherwise, compare as strings.
1690               d1 = "x" d1
1691               d2 = "x" d2
1692             }
1693           } else {
1694             # A fraction is less than an integer.
1695             exit 1
1696           }
1697         } else {
1698           if (d2 ~ /^0/) {
1699             # An integer is greater than a fraction.
1700             exit 2
1701           } else {
1702             # Compare two integers.
1703             d1 += 0
1704             d2 += 0
1705           }
1706         }
1707       } else {
1708         # The normal case, without worrying about digits.
1709         d1 = substr(v1, 1, 1); v1 = substr(v1, 2)
1710         d2 = substr(v2, 1, 1); v2 = substr(v2, 2)
1711       }
1712       if (d1 < d2) exit 1
1713       if (d1 > d2) exit 2
1714     }
1715     # Beware Solaris /usr/xgp4/bin/awk (at least through Solaris 10),
1716     # which mishandles some comparisons of empty strings to integers.
1717     if (length(v2)) exit 1
1718     if (length(v1)) exit 2
1719   }
1720 ']])# _AS_VERSION_COMPARE_PREPARE
1723 # AS_VERSION_COMPARE(VERSION-1, VERSION-2,
1724 #                    [ACTION-IF-LESS], [ACTION-IF-EQUAL], [ACTION-IF-GREATER])
1725 # ----------------------------------------------------------------------------
1726 # Compare two strings possibly containing shell variables as version strings.
1728 # This usage is portable even to ancient awk,
1729 # so don't worry about finding a "nice" awk version.
1730 m4_defun_init([AS_VERSION_COMPARE],
1731 [AS_REQUIRE([_$0_PREPARE])],
1732 [as_arg_v1=$1
1733 as_arg_v2=$2
1734 awk "$as_awk_strverscmp" v1="$as_arg_v1" v2="$as_arg_v2" /dev/null
1735 AS_CASE([$?],
1736         [1], [$3],
1737         [0], [$4],
1738         [2], [$5])])# AS_VERSION_COMPARE
1742 ## --------------------------------------- ##
1743 ## 6. Common m4/sh character translation.  ##
1744 ## --------------------------------------- ##
1746 # The point of this section is to provide high level macros comparable
1747 # to m4's `translit' primitive, but m4/sh polymorphic.
1748 # Transliteration of literal strings should be handled by m4, while
1749 # shell variables' content will be translated at runtime (tr or sed).
1752 # _AS_CR_PREPARE
1753 # --------------
1754 # Output variables defining common character ranges.
1755 # See m4_cr_letters etc.
1756 m4_defun([_AS_CR_PREPARE],
1757 [# Avoid depending upon Character Ranges.
1758 as_cr_letters='abcdefghijklmnopqrstuvwxyz'
1759 as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
1760 as_cr_Letters=$as_cr_letters$as_cr_LETTERS
1761 as_cr_digits='0123456789'
1762 as_cr_alnum=$as_cr_Letters$as_cr_digits
1766 # _AS_TR_SH_PREPARE
1767 # -----------------
1768 m4_defun([_AS_TR_SH_PREPARE],
1769 [AS_REQUIRE([_AS_CR_PREPARE])]dnl
1770 [# Sed expression to map a string onto a valid variable name.
1771 as_tr_sh="eval sed 'y%*+%pp%;s%[[^_$as_cr_alnum]]%_%g'"
1775 # AS_TR_SH(EXPRESSION)
1776 # --------------------
1777 # Transform EXPRESSION into a valid shell variable name.
1778 # sh/m4 polymorphic.
1779 # Be sure to update the definition of `$as_tr_sh' if you change this.
1781 # AS_LITERAL_IF guarantees that a literal does not have any nested quotes,
1782 # once $1 is expanded.  m4_translit silently uses only the first occurrence
1783 # of a character that appears multiple times in argument 2, since we know
1784 # that m4_cr_not_symbols2 also contains [ and ].  m4_translit also silently
1785 # ignores characters in argument 3 that do not match argument 2; we use this
1786 # fact to skip worrying about the length of m4_cr_not_symbols2.
1788 # For speed, we inline the literal definitions that can be computed up front.
1789 m4_defun_init([AS_TR_SH],
1790 [AS_REQUIRE([_$0_PREPARE])],
1791 [_$0(m4_expand([$1]))])
1793 m4_define([_AS_TR_SH],
1794 [_AS_LITERAL_IF([$1], [*][       ][
1795 ])([], [$0_INDIR], [$0_LITERAL])([$1])])
1797 m4_define([_AS_TR_SH_LITERAL],
1798 [m4_translit([[$1]],
1799   [*+[]]]m4_dquote(m4_defn([m4_cr_not_symbols2]))[,
1800   [pp[]]]m4_dquote(m4_for(,1,255,,[[_]]))[)])
1802 m4_define([_AS_TR_SH_INDIR],
1803 [`AS_ECHO(["_AS_ESCAPE([[$1]], [`], [\])"]) | $as_tr_sh`])
1806 # _AS_TR_CPP_PREPARE
1807 # ------------------
1808 m4_defun([_AS_TR_CPP_PREPARE],
1809 [AS_REQUIRE([_AS_CR_PREPARE])]dnl
1810 [# Sed expression to map a string onto a valid CPP name.
1811 as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[[^_$as_cr_alnum]]%_%g'"
1815 # AS_TR_CPP(EXPRESSION)
1816 # ---------------------
1817 # Map EXPRESSION to an upper case string which is valid as rhs for a
1818 # `#define'.  sh/m4 polymorphic.  Be sure to update the definition
1819 # of `$as_tr_cpp' if you change this.
1821 # See implementation comments in AS_TR_SH.
1822 m4_defun_init([AS_TR_CPP],
1823 [AS_REQUIRE([_$0_PREPARE])],
1824 [_$0(m4_expand([$1]))])
1826 m4_define([_AS_TR_CPP],
1827 [_AS_LITERAL_IF([$1], [*][       ][
1828 ])([], [$0_INDIR], [$0_LITERAL])([$1])])
1830 m4_define([_AS_TR_CPP_LITERAL],
1831 [m4_translit([[$1]],
1832   [*[]]]m4_dquote(m4_defn([m4_cr_letters])m4_defn([m4_cr_not_symbols2]))[,
1833   [P[]]]m4_dquote(m4_defn([m4_cr_LETTERS])m4_for(,1,255,,[[_]]))[)])
1835 m4_define([_AS_TR_CPP_INDIR],
1836 [`AS_ECHO(["_AS_ESCAPE([[$1]], [`], [\])"]) | $as_tr_cpp`])
1839 # _AS_TR_PREPARE
1840 # --------------
1841 m4_defun([_AS_TR_PREPARE],
1842 [AS_REQUIRE([_AS_TR_SH_PREPARE])AS_REQUIRE([_AS_TR_CPP_PREPARE])])
1847 ## ------------------------------------------------------ ##
1848 ## 7. Common m4/sh handling of variables (indirections).  ##
1849 ## ------------------------------------------------------ ##
1852 # The purpose of this section is to provide a uniform API for
1853 # reading/setting sh variables with or without indirection.
1854 # Typically, one can write
1855 #   AS_VAR_SET(var, val)
1856 # or
1857 #   AS_VAR_SET(as_$var, val)
1858 # and expect the right thing to happen.  In the descriptions below,
1859 # a literal name matches the regex [a-zA-Z_][a-zA-Z0-9_]*, an
1860 # indirect name is a shell expression that produces a literal name
1861 # when passed through eval, and a polymorphic name is either type.
1864 # _AS_VAR_APPEND_PREPARE
1865 # ----------------------
1866 # Define as_fn_append to the optimum definition for the current
1867 # shell (bash and zsh provide the += assignment operator to avoid
1868 # quadratic append growth over repeated appends).
1869 m4_defun([_AS_VAR_APPEND_PREPARE],
1870 [AS_FUNCTION_DESCRIBE([as_fn_append], [VAR VALUE],
1871 [Append the text in VALUE to the end of the definition contained in
1872 VAR.  Take advantage of any shell optimizations that allow amortized
1873 linear growth over repeated appends, instead of the typical quadratic
1874 growth present in naive implementations.])
1875 AS_IF([_AS_RUN(["AS_ESCAPE(m4_quote(_AS_VAR_APPEND_WORKS))"])],
1876 [eval 'as_fn_append ()
1877   {
1878     eval $[]1+=\$[]2
1879   }'],
1880 [as_fn_append ()
1881   {
1882     eval $[]1=\$$[]1\$[]2
1883   }]) # as_fn_append
1886 # _AS_VAR_APPEND_WORKS
1887 # --------------------
1888 # Output a shell test to discover whether += works.
1889 m4_define([_AS_VAR_APPEND_WORKS],
1890 [as_var=1; as_var+=2; test x$as_var = x12])
1892 # AS_VAR_APPEND(VAR, VALUE)
1893 # -------------------------
1894 # Append the shell expansion of VALUE to the end of the existing
1895 # contents of the polymorphic shell variable VAR, taking advantage of
1896 # any shell optimizations that allow repeated appends to result in
1897 # amortized linear scaling rather than quadratic behavior.  This macro
1898 # is not worth the overhead unless the expected final size of the
1899 # contents of VAR outweigh the typical VALUE size of repeated appends.
1900 # Note that unlike AS_VAR_SET, VALUE must be properly quoted to avoid
1901 # field splitting and file name expansion.
1902 m4_defun_init([AS_VAR_APPEND],
1903 [AS_REQUIRE([_AS_VAR_APPEND_PREPARE], [], [M4SH-INIT-FN])],
1904 [as_fn_append $1 $2])
1907 # _AS_VAR_ARITH_PREPARE
1908 # ---------------------
1909 # Define as_fn_arith to the optimum definition for the current
1910 # shell (using POSIX $(()) where supported).
1911 m4_defun([_AS_VAR_ARITH_PREPARE],
1912 [AS_FUNCTION_DESCRIBE([as_fn_arith], [ARG...],
1913 [Perform arithmetic evaluation on the ARGs, and store the result in
1914 the global $as_val.  Take advantage of shells that can avoid forks.
1915 The arguments must be portable across $(()) and expr.])
1916 AS_IF([_AS_RUN(["AS_ESCAPE(m4_quote(_AS_VAR_ARITH_WORKS))"])],
1917 [eval 'as_fn_arith ()
1918   {
1919     as_val=$(( $[]* ))
1920   }'],
1921 [as_fn_arith ()
1922   {
1923     as_val=`expr "$[]@" || test $? -eq 1`
1924   }]) # as_fn_arith
1927 # _AS_VAR_ARITH_WORKS
1928 # -------------------
1929 # Output a shell test to discover whether $(()) works.
1930 m4_define([_AS_VAR_ARITH_WORKS],
1931 [test $(( 1 + 1 )) = 2])
1933 # AS_VAR_ARITH(VAR, EXPR)
1934 # -----------------------
1935 # Perform the arithmetic evaluation of the arguments in EXPR, and set
1936 # contents of the polymorphic shell variable VAR to the result, taking
1937 # advantage of any shell optimizations that perform arithmetic without
1938 # forks.  Note that numbers occurring within EXPR must be written in
1939 # decimal, and without leading zeroes; variables containing numbers
1940 # must be expanded prior to arithmetic evaluation; the first argument
1941 # must not be a negative number; there is no portable equality
1942 # operator; and operators must be given as separate arguments and
1943 # properly quoted.
1944 m4_defun_init([AS_VAR_ARITH],
1945 [_AS_DETECT_SUGGESTED([_AS_VAR_ARITH_WORKS])]dnl
1946 [AS_REQUIRE([_AS_VAR_ARITH_PREPARE], [], [M4SH-INIT-FN])],
1947 [as_fn_arith $2 && AS_VAR_SET([$1], [$as_val])])
1950 # AS_VAR_COPY(DEST, SOURCE)
1951 # -------------------------
1952 # Set the polymorphic shell variable DEST to the contents of the polymorphic
1953 # shell variable SOURCE.
1954 m4_define([AS_VAR_COPY],
1955 [AS_LITERAL_WORD_IF([$1[]$2], [$1=$$2], [eval $1=\$$2])])
1958 # AS_VAR_GET(VARIABLE)
1959 # --------------------
1960 # Get the value of the shell VARIABLE.
1961 # Evaluates to $VARIABLE if there is no indirection in VARIABLE,
1962 # else to the appropriate `eval' sequence.
1963 # This macro is deprecated because it sometimes mishandles trailing newlines;
1964 # use AS_VAR_COPY instead.
1965 m4_define([AS_VAR_GET],
1966 [AS_LITERAL_WORD_IF([$1],
1967                [$$1],
1968   [`eval 'as_val=${'_AS_ESCAPE([[$1]], [`], [\])'};AS_ECHO(["$as_val"])'`])])
1971 # AS_VAR_IF(VARIABLE, VALUE, IF-TRUE, IF-FALSE)
1972 # ---------------------------------------------
1973 # Implement a shell `if test $VARIABLE = VALUE; then-else'.
1974 # Polymorphic, and avoids sh expansion error upon interrupt or term signal.
1975 m4_define([AS_VAR_IF],
1976 [AS_LITERAL_WORD_IF([$1],
1977   [AS_IF(m4_ifval([$2], [[test "x$$1" = x[]$2]], [[${$1:+false} :]])],
1978   [AS_VAR_COPY([as_val], [$1])
1979    AS_IF(m4_ifval([$2], [[test "x$as_val" = x[]$2]], [[${as_val:+false} :]])],
1980   [AS_IF(m4_ifval([$2],
1981     [[eval test \"x\$"$1"\" = x"_AS_ESCAPE([$2], [`], [\"$])"]],
1982     [[eval \${$1:+false} :]])]),
1983 [$3], [$4])])
1986 # AS_VAR_PUSHDEF and AS_VAR_POPDEF
1987 # --------------------------------
1990 # Sometimes we may have to handle literals (e.g. `stdlib.h'), while at
1991 # other moments, the same code may have to get the value from a
1992 # variable (e.g., `ac_header').  To have a uniform handling of both
1993 # cases, when a new value is about to be processed, declare a local
1994 # variable, e.g.:
1996 #   AS_VAR_PUSHDEF([header], [ac_cv_header_$1])
1998 # and then in the body of the macro, use `header' as is.  It is of
1999 # first importance to use `AS_VAR_*' to access this variable.
2001 # If the value `$1' was a literal (e.g. `stdlib.h'), then `header' is
2002 # in fact the value `ac_cv_header_stdlib_h'.  If `$1' was indirect,
2003 # then `header's value in m4 is in fact `$as_header', the shell
2004 # variable that holds all of the magic to get the expansion right.
2006 # At the end of the block, free the variable with
2008 #   AS_VAR_POPDEF([header])
2011 # AS_VAR_POPDEF(VARNAME)
2012 # ----------------------
2013 # Free the shell variable accessor VARNAME.  To be dnl'ed.
2014 m4_define([AS_VAR_POPDEF],
2015 [m4_popdef([$1])])
2018 # AS_VAR_PUSHDEF(VARNAME, VALUE)
2019 # ------------------------------
2020 # Define the m4 macro VARNAME to an accessor to the shell variable
2021 # named VALUE.  VALUE does not need to be a valid shell variable name:
2022 # the transliteration is handled here.  To be dnl'ed.
2024 # AS_TR_SH attempts to play with diversions if _AS_TR_SH_PREPARE has
2025 # not been expanded.  However, users are expected to do subsequent
2026 # calls that trigger AS_LITERAL_IF([VARNAME]), and that macro performs
2027 # expansion inside an argument collection context, where diversions
2028 # don't work.  Therefore, we must require the preparation ourselves.
2029 m4_defun_init([AS_VAR_PUSHDEF],
2030 [AS_REQUIRE([_AS_TR_SH_PREPARE])],
2031 [_$0([$1], m4_expand([$2]))])
2033 m4_define([_AS_VAR_PUSHDEF],
2034 [_AS_LITERAL_IF([$2], [  ][
2035 ])([], [as_$1=_AS_TR_SH_INDIR([$2])
2036 m4_pushdef([$1], [$as_[$1]])],
2037 [m4_pushdef([$1], [_AS_TR_SH_LITERAL([$2])])])])
2040 # AS_VAR_SET(VARIABLE, VALUE)
2041 # ---------------------------
2042 # Set the contents of the polymorphic shell VARIABLE to the shell
2043 # expansion of VALUE.  VALUE is immune to field splitting and file
2044 # name expansion.
2045 m4_define([AS_VAR_SET],
2046 [AS_LITERAL_WORD_IF([$1],
2047                [$1=$2],
2048                [eval "$1=_AS_ESCAPE([$2], [`], [\"$])"])])
2051 # AS_VAR_SET_IF(VARIABLE, IF-TRUE, IF-FALSE)
2052 # ------------------------------------------
2053 # Implement a shell `if-then-else' depending whether VARIABLE is set
2054 # or not.  Polymorphic.
2055 m4_define([AS_VAR_SET_IF],
2056 [AS_IF([AS_VAR_TEST_SET([$1])], [$2], [$3])])
2059 # AS_VAR_TEST_SET(VARIABLE)
2060 # -------------------------
2061 # Expands into an expression which is true if VARIABLE
2062 # is set.  Polymorphic.
2063 m4_define([AS_VAR_TEST_SET],
2064 [AS_LITERAL_WORD_IF([$1],
2065   [test ${$1+y}],
2066   [{ as_var=$1; eval test \${$as_var+y}; }],
2067   [eval test \${$1+y}])])
2070 ## -------------------- ##
2071 ## 8. Setting M4sh up.  ##
2072 ## -------------------- ##
2075 # AS_INIT_GENERATED(FILE, [COMMENT])
2076 # ----------------------------------
2077 # Generate a child script FILE with all initialization necessary to
2078 # reuse the environment learned by the parent script, and make the
2079 # file executable.  If COMMENT is supplied, it is inserted after the
2080 # `#!' sequence but before initialization text begins.  After this
2081 # macro, additional text can be appended to FILE to form the body of
2082 # the child script.  The macro ends with non-zero status if the
2083 # file could not be fully written (such as if the disk is full).
2084 m4_defun([AS_INIT_GENERATED],
2085 [m4_require([AS_PREPARE])]dnl
2086 [m4_pushdef([AS_MESSAGE_LOG_FD])]dnl
2087 [as_write_fail=0
2088 cat >$1 <<_ASEOF || as_write_fail=1
2089 #! $SHELL
2090 # Generated by $as_me.
2092 SHELL=\${CONFIG_SHELL-$SHELL}
2093 export SHELL
2094 _ASEOF
2095 cat >>$1 <<\_ASEOF || as_write_fail=1
2096 _AS_SHELL_SANITIZE
2097 _AS_PREPARE
2098 m4_if(AS_MESSAGE_FD, [1], [], [exec AS_MESSAGE_FD>&1
2099 ])]dnl
2100 [m4_text_box([Main body of $1 script.])
2101 _ASEOF
2102 test $as_write_fail = 0 && chmod +x $1[]dnl
2103 _m4_popdef([AS_MESSAGE_LOG_FD])])# AS_INIT_GENERATED
2106 # AS_INIT
2107 # -------
2108 # Initialize m4sh.
2109 m4_define([AS_INIT],
2110 [# Wrap our cleanup prior to m4sugar's cleanup.
2111 m4_wrap([_AS_CLEANUP])
2112 m4_init
2113 m4_provide([AS_INIT])
2115 # Forbidden tokens and exceptions.
2116 m4_pattern_forbid([^_?AS_])
2118 # Bangshe and minimal initialization.
2119 m4_divert_text([BINSH], [@%:@! /bin/sh])
2120 m4_divert_text([HEADER-COMMENT],
2121                [@%:@ Generated from __file__ by m4_PACKAGE_STRING.])
2122 m4_divert_text([M4SH-SANITIZE], [_AS_SHELL_SANITIZE])
2123 m4_divert_text([M4SH-INIT-FN], [m4_text_box([M4sh Shell Functions.])])
2125 # Let's go!
2126 m4_divert([BODY])dnl
2127 m4_text_box([Main body of script.])
2128 _AS_DETECT_REQUIRED([_AS_SHELL_FN_WORK])dnl
2129 _AS_DETECT_REQUIRED([_AS_TEST_X_WORKS])dnl
2130 AS_REQUIRE([_AS_UNSET_PREPARE], [], [M4SH-INIT-FN])dnl