maint: update copyright year
[autoconf.git] / lib / m4sugar / m4sh.m4
blob1ff17052104f8027908e00d6386a25850fbd72a5
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-2011 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 <http://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 # <http://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 # <http://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 -n "${ZSH_VERSION+set}" && (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 # <http://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 # <http://lists.gnu.org/archive/html/bug-autoconf/2006-10/msg00003.html>
190 # FIXME: The code should test for the OSF bug described in
191 # <http://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],
195 dnl Remove any tests from suggested that are also required
196 [m4_set_map([_AS_DETECT_SUGGESTED_BODY], [_AS_DETECT_SUGGESTED_PRUNE])]dnl
197 [m4_pushdef([AS_EXIT], [exit m4_default(]m4_dquote([$][1])[, 1)])]dnl
198 [if test "x$CONFIG_SHELL" = x; then
199   as_bourne_compatible="AS_ESCAPE(_m4_expand([_AS_BOURNE_COMPATIBLE]))"
200   _AS_DETECT_EXPAND([as_required], [_AS_DETECT_REQUIRED_BODY])
201   _AS_DETECT_EXPAND([as_suggested], [_AS_DETECT_SUGGESTED_BODY])
202   AS_IF([_AS_RUN(["$as_required"])],
203         [as_have_required=yes],
204         [as_have_required=no])
205   AS_IF([test x$as_have_required = xyes && _AS_RUN(["$as_suggested"])],
206     [],
207     [_AS_PATH_WALK([/bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH],
208       [case $as_dir in @%:@(
209          /*)
210            for as_base in sh bash ksh sh5; do
211              # Try only shells that exist, to save several forks.
212              as_shell=$as_dir/$as_base
213              AS_IF([{ test -f "$as_shell" || test -f "$as_shell.exe"; } &&
214                     _AS_RUN(["$as_required"], ["$as_shell"])],
215                    [CONFIG_SHELL=$as_shell as_have_required=yes
216                    m4_set_empty([_AS_DETECT_SUGGESTED_BODY], [break 2],
217                      [AS_IF([_AS_RUN(["$as_suggested"], ["$as_shell"])],
218                             [break 2])])])
219            done;;
220        esac],
221       [AS_IF([{ test -f "$SHELL" || test -f "$SHELL.exe"; } &&
222               _AS_RUN(["$as_required"], ["$SHELL"])],
223              [CONFIG_SHELL=$SHELL as_have_required=yes])])
225       AS_IF([test "x$CONFIG_SHELL" != x],
226         [# We cannot yet assume a decent shell, so we have to provide a
227         # neutralization value for shells without unset; and this also
228         # works around shells that cannot unset nonexistent variables.
229         # Preserve -v and -x to the replacement shell.
230         BASH_ENV=/dev/null
231         ENV=/dev/null
232         (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
233         export CONFIG_SHELL
234         case $- in @%:@ ((((
235           *v*x* | *x*v* ) as_opts=-vx ;;
236           *v* ) as_opts=-v ;;
237           *x* ) as_opts=-x ;;
238           * ) as_opts= ;;
239         esac
240         exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$[@]"}])
242 dnl Unfortunately, $as_me isn't available here.
243     AS_IF([test x$as_have_required = xno],
244       [AS_ECHO(["$[]0: This script requires a shell more modern than all"])
245   AS_ECHO(["$[]0: the shells that I found on your system."])
246   if test x${ZSH_VERSION+set} = xset ; then
247     AS_ECHO(["$[]0: In particular, zsh $ZSH_VERSION has bugs and should"])
248     AS_ECHO(["$[]0: be upgraded to zsh 4.3.4 or later."])
249   else
250     AS_ECHO("m4_text_wrap([Please tell ]_m4_defn([m4_PACKAGE_BUGREPORT])
251 m4_ifset([AC_PACKAGE_BUGREPORT], [m4_if(_m4_defn([m4_PACKAGE_BUGREPORT]),
252 _m4_defn([AC_PACKAGE_BUGREPORT]), [], [and _m4_defn([AC_PACKAGE_BUGREPORT])])])
253 [about your system, including any error possibly output before this message.
254 Then install a modern shell, or manually run the script under such a
255 shell if you do have one.], [$[]0: ], [], [62])")
256   fi
257   AS_EXIT])])
259 SHELL=${CONFIG_SHELL-/bin/sh}
260 export SHELL
261 # Unset more variables known to interfere with behavior of common tools.
262 CLICOLOR_FORCE= GREP_OPTIONS=
263 unset CLICOLOR_FORCE GREP_OPTIONS
264 _m4_popdef([AS_EXIT])])# _AS_DETECT_BETTER_SHELL
267 # _AS_PREPARE
268 # -----------
269 # This macro has a very special status.  Normal use of M4sh relies
270 # heavily on AS_REQUIRE, so that needed initializations (such as
271 # _AS_TEST_PREPARE) are performed on need, not on demand.  But
272 # Autoconf is the first client of M4sh, and for two reasons: configure
273 # and config.status.  Relying on AS_REQUIRE is of course fine for
274 # configure, but fails for config.status (which is created by
275 # configure).  So we need a means to force the inclusion of the
276 # various _AS_*_PREPARE on top of config.status.  That's basically why
277 # there are so many _AS_*_PREPARE below, and that's also why it is
278 # important not to forget some: config.status needs them.
279 # List any preparations that create shell functions first, then
280 # topologically sort the others by their dependencies.
282 # Special case: we do not need _AS_LINENO_PREPARE, because the
283 # parent will have substituted $LINENO for us when processing its
284 # own invocation of _AS_LINENO_PREPARE.
286 # Special case: the full definition of _AS_ERROR_PREPARE is not output
287 # unless AS_MESSAGE_LOG_FD is non-empty, although the value of
288 # AS_MESSAGE_LOG_FD is not relevant.
289 m4_defun([_AS_PREPARE],
290 [m4_pushdef([AS_REQUIRE])]dnl
291 [m4_pushdef([AS_REQUIRE_SHELL_FN], _m4_defn([_AS_REQUIRE_SHELL_FN])
292 )]dnl
293 [m4_pushdef([AS_MESSAGE_LOG_FD], [-1])]dnl
294 [_AS_ERROR_PREPARE
295 _m4_popdef([AS_MESSAGE_LOG_FD])]dnl
296 [_AS_EXIT_PREPARE
297 _AS_UNSET_PREPARE
298 _AS_VAR_APPEND_PREPARE
299 _AS_VAR_ARITH_PREPARE
301 _AS_EXPR_PREPARE
302 _AS_BASENAME_PREPARE
303 _AS_DIRNAME_PREPARE
304 _AS_ME_PREPARE
305 _AS_CR_PREPARE
306 _AS_ECHO_N_PREPARE
307 _AS_LN_S_PREPARE
308 _AS_MKDIR_P_PREPARE
309 _AS_TEST_PREPARE
310 _AS_TR_CPP_PREPARE
311 _AS_TR_SH_PREPARE
312 _m4_popdef([AS_REQUIRE], [AS_REQUIRE_SHELL_FN])])
314 # AS_PREPARE
315 # ----------
316 # Output all the M4sh possible initialization into the initialization
317 # diversion.  We do not use _AS_PREPARE so that the m4_provide symbols for
318 # AS_REQUIRE and AS_REQUIRE_SHELL_FN are defined properly, and so that
319 # shell functions are placed in M4SH-INIT-FN.
320 m4_defun([AS_PREPARE],
321 [m4_divert_push([KILL])
322 m4_append_uniq([_AS_CLEANUP],
323   [m4_divert_text([M4SH-INIT-FN], [_AS_ERROR_PREPARE[]])])
324 AS_REQUIRE([_AS_EXPR_PREPARE])
325 AS_REQUIRE([_AS_BASENAME_PREPARE])
326 AS_REQUIRE([_AS_DIRNAME_PREPARE])
327 AS_REQUIRE([_AS_ME_PREPARE])
328 AS_REQUIRE([_AS_CR_PREPARE])
329 AS_REQUIRE([_AS_LINENO_PREPARE])
330 AS_REQUIRE([_AS_ECHO_N_PREPARE])
331 AS_REQUIRE([_AS_EXIT_PREPARE])
332 AS_REQUIRE([_AS_LN_S_PREPARE])
333 AS_REQUIRE([_AS_MKDIR_P_PREPARE])
334 AS_REQUIRE([_AS_TEST_PREPARE])
335 AS_REQUIRE([_AS_TR_CPP_PREPARE])
336 AS_REQUIRE([_AS_TR_SH_PREPARE])
337 AS_REQUIRE([_AS_UNSET_PREPARE])
338 AS_REQUIRE([_AS_VAR_APPEND_PREPARE], [], [M4SH-INIT-FN])
339 AS_REQUIRE([_AS_VAR_ARITH_PREPARE], [], [M4SH-INIT-FN])
340 m4_divert_pop[]])
343 # AS_REQUIRE(NAME-TO-CHECK, [BODY-TO-EXPAND = NAME-TO-CHECK],
344 #            [DIVERSION = M4SH-INIT])
345 # -----------------------------------------------------------
346 # BODY-TO-EXPAND is some initialization which must be expanded in the
347 # given diversion when expanded (required or not).  The expansion
348 # goes in the named diversion or an earlier one.
350 # Since $2 can be quite large, this is factored for faster execution, giving
351 # either m4_require([$1], [$2]) or m4_divert_require(desired, [$1], [$2]).
352 m4_defun([AS_REQUIRE],
353 [m4_define([_m4_divert_desired], [m4_default_quoted([$3], [M4SH-INIT])])]dnl
354 [m4_if(m4_eval(_m4_divert_dump - 0 <= _m4_divert(_m4_divert_desired, [-])),
355        1, [m4_require(],
356           [m4_divert_require(_m4_divert_desired,]) [$1], [$2])])
358 # _AS_REQUIRE_SHELL_FN(NAME-TO-CHECK, COMMENT, BODY-TO-EXPAND)
359 # ------------------------------------------------------------
360 # Core of AS_REQUIRE_SHELL_FN, but without diversion support.
361 m4_define([_AS_REQUIRE_SHELL_FN], [
362 m4_n([$2])$1 ()
365 } @%:@ $1[]])
367 # AS_REQUIRE_SHELL_FN(NAME-TO-CHECK, COMMENT, BODY-TO-EXPAND,
368 #                     [DIVERSION = M4SH-INIT-FN])
369 # -----------------------------------------------------------
370 # BODY-TO-EXPAND is the body of a shell function to be emitted in the
371 # given diversion when expanded (required or not).  Unlike other
372 # xx_REQUIRE macros, BODY-TO-EXPAND is mandatory.  If COMMENT is
373 # provided (often via AS_FUNCTION_DESCRIBE), it is listed with a
374 # newline before the function name.
375 m4_define([AS_REQUIRE_SHELL_FN],
376 [m4_provide_if([AS_SHELL_FN_$1], [],
377 [AS_REQUIRE([AS_SHELL_FN_$1],
378 [m4_provide([AS_SHELL_FN_$1])_$0($@)],
379 m4_default_quoted([$4], [M4SH-INIT-FN]))])])
382 # _AS_RUN(TEST, [SHELL])
383 # ----------------------
384 # Run TEST under the current shell (if one parameter is used)
385 # or under the given SHELL, protecting it from syntax errors.
386 # Set as_run in order to assist _AS_LINENO_WORKS.
387 m4_define([_AS_RUN],
388 [m4_ifval([$2], [{ $as_echo "$as_bourne_compatible"$1 | as_run=a $2; }],
389                 [(eval $1)]) 2>/dev/null])
392 # _AS_SHELL_FN_WORK
393 # -----------------
394 # This is a spy to detect "in the wild" shells that do not support shell
395 # functions correctly.  It is based on the m4sh.at Autotest testcases.
396 m4_define([_AS_SHELL_FN_WORK],
397 [as_fn_return () { (exit [$]1); }
398 as_fn_success () { as_fn_return 0; }
399 as_fn_failure () { as_fn_return 1; }
400 as_fn_ret_success () { return 0; }
401 as_fn_ret_failure () { return 1; }
403 exitcode=0
404 as_fn_success || { exitcode=1; echo as_fn_success failed.; }
405 as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }
406 as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }
407 as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }
408 AS_IF([( set x; as_fn_ret_success y && test x = "[$]1" )], [],
409       [exitcode=1; echo positional parameters were not saved.])
410 test x$exitcode = x0[]])# _AS_SHELL_FN_WORK
413 # _AS_SHELL_SANITIZE
414 # ------------------
415 # This is the prolog that is emitted by AS_INIT and AS_INIT_GENERATED;
416 # it is executed prior to shell function definitions, hence the
417 # temporary redefinition of AS_EXIT.
418 m4_defun([_AS_SHELL_SANITIZE],
419 [m4_pushdef([AS_EXIT], [exit m4_default(]m4_dquote([$][1])[, 1)])]dnl
420 [m4_text_box([M4sh Initialization.])
422 AS_BOURNE_COMPATIBLE
423 _AS_ECHO_PREPARE
424 _AS_PATH_SEPARATOR_PREPARE
426 # IFS
427 # We need space, tab and new line, in precisely that order.  Quoting is
428 # there to prevent editors from complaining about space-tab.
429 # (If _AS_PATH_WALK were called with IFS unset, it would disable word
430 # splitting by setting IFS to empty value.)
431 IFS=" ""        $as_nl"
433 # Find who we are.  Look in the path if we contain no directory separator.
434 as_myself=
435 case $[0] in @%:@((
436   *[[\\/]]* ) as_myself=$[0] ;;
437   *) _AS_PATH_WALK([],
438                    [test -r "$as_dir/$[0]" && as_myself=$as_dir/$[0] && break])
439      ;;
440 esac
441 # We did not find ourselves, most probably we were run as `sh COMMAND'
442 # in which case we are not to be found in the path.
443 if test "x$as_myself" = x; then
444   as_myself=$[0]
446 if test ! -f "$as_myself"; then
447   AS_ECHO(["$as_myself: error: cannot find myself; rerun with an absolute file name"]) >&2
448   AS_EXIT
451 # Unset variables that we do not need and which cause bugs (e.g. in
452 # pre-3.0 UWIN ksh).  But do not cause bugs in bash 2.01; the "|| exit 1"
453 # suppresses any "Segmentation fault" message there.  '((' could
454 # trigger a bug in pdksh 5.2.14.
455 for as_var in BASH_ENV ENV MAIL MAILPATH
456 do eval test x\${$as_var+set} = xset \
457   && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
458 done
459 PS1='$ '
460 PS2='> '
461 PS4='+ '
463 # NLS nuisances.
464 LC_ALL=C
465 export LC_ALL
466 LANGUAGE=C
467 export LANGUAGE
469 # CDPATH.
470 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
471 _m4_popdef([AS_EXIT])])# _AS_SHELL_SANITIZE
474 # AS_SHELL_SANITIZE
475 # -----------------
476 # This is only needed for the sake of Libtool, which screws up royally
477 # in its usage of M4sh internals.
478 m4_define([AS_SHELL_SANITIZE],
479 [_AS_SHELL_SANITIZE
480 m4_provide_if([AS_INIT], [],
481 [m4_provide([AS_INIT])
482 _AS_DETECT_REQUIRED([_AS_SHELL_FN_WORK])
483 _AS_DETECT_BETTER_SHELL
484 _AS_UNSET_PREPARE
485 ])])
488 ## ----------------------------- ##
489 ## 2. Wrappers around builtins.  ##
490 ## ----------------------------- ##
492 # This section is lexicographically sorted.
495 # AS_CASE(WORD, [PATTERN1], [IF-MATCHED1]...[DEFAULT])
496 # ----------------------------------------------------
497 # Expand into
498 # | case WORD in #(
499 # |   PATTERN1) IF-MATCHED1 ;; #(
500 # |   ...
501 # |   *) DEFAULT ;;
502 # | esac
503 # The shell comments are intentional, to work around people who don't
504 # realize the impacts of using insufficient m4 quoting.  This macro
505 # always uses : and provides a default case, to work around Solaris
506 # /bin/sh bugs regarding the exit status.
507 m4_define([_AS_CASE],
508 [ [@%:@(]
509   $1[)] :
510     $2 ;;])
511 m4_define([_AS_CASE_DEFAULT],
512 [ [@%:@(]
513   *[)] :
514     $1 ;;])
516 m4_defun([AS_CASE],
517 [case $1 in[]m4_map_args_pair([_$0], [_$0_DEFAULT],
518    m4_shift($@m4_if(m4_eval([$# & 1]), [1], [,])))
519 esac])# AS_CASE
522 # _AS_EXIT_PREPARE
523 # ----------------
524 # Ensure AS_EXIT and AS_SET_STATUS will work.
526 # We cannot simply use "exit N" because some shells (zsh and Solaris sh)
527 # will not set $? to N while running the code set by "trap 0"
528 # Some shells fork even for (exit N), so we use a helper function
529 # to set $? prior to the exit.
530 # Then there are shells that don't inherit $? correctly into the start of
531 # a shell function, so we must always be given an argument.
532 # Other shells don't use `$?' as default for `exit', hence just repeating
533 # the exit value can only help improving portability.
534 m4_defun([_AS_EXIT_PREPARE],
535 [AS_REQUIRE_SHELL_FN([as_fn_set_status],
536   [AS_FUNCTION_DESCRIBE([as_fn_set_status], [STATUS],
537     [Set $? to STATUS, without forking.])], [  return $[]1])]dnl
538 [AS_REQUIRE_SHELL_FN([as_fn_exit],
539   [AS_FUNCTION_DESCRIBE([as_fn_exit], [STATUS],
540     [Exit the shell with STATUS, even in a "trap 0" or "set -e" context.])],
541 [  set +e
542   as_fn_set_status $[1]
543   exit $[1]])])#_AS_EXIT_PREPARE
546 # AS_EXIT([EXIT-CODE = $?])
547 # -------------------------
548 # Exit, with status set to EXIT-CODE in the way that it's seen
549 # within "trap 0", and without interference from "set -e".  If
550 # EXIT-CODE is omitted, then use $?.
551 m4_defun([AS_EXIT],
552 [AS_REQUIRE([_AS_EXIT_PREPARE])[]as_fn_exit m4_ifval([$1], [$1], [$][?])])
555 # AS_FOR(MACRO, SHELL-VAR, [LIST = "$@"], [BODY = :])
556 # ---------------------------------------------------
557 # Expand to a shell loop that assigns SHELL-VAR to each of the
558 # whitespace-separated entries in LIST (or "$@" if LIST is empty),
559 # then executes BODY.  BODY may call break to abort the loop, or
560 # continue to proceed with the next element of LIST.  Requires that
561 # IFS be set to the normal space-tab-newline.  As an optimization,
562 # BODY should access MACRO rather than $SHELL-VAR.  Normally, MACRO
563 # expands to $SHELL-VAR, but if LIST contains only a single element
564 # that needs no additional shell quoting, then MACRO will expand to
565 # that element, thus providing a direct value rather than a shell
566 # variable indirection.
568 # Only use the optimization if LIST can be used without additional
569 # shell quoting in either a literal or double-quoted context (that is,
570 # we give up on default IFS chars, parameter expansion, command
571 # substitution, shell quoting, globs, or quadrigraphs).  Inline the
572 # m4_defn for speed.
573 m4_defun([AS_FOR],
574 [m4_pushdef([$1], m4_if([$3], [], [[$$2]], m4_translit([$3], ]dnl
575 m4_dquote(_m4_defn([m4_cr_symbols2]))[[%+=:,./-]), [], [[$3]], [[$$2]]))]dnl
576 [for $2[]m4_ifval([$3], [ in $3])
577 do :
578   $4
579 done[]_m4_popdef([$1])])
582 # AS_IF(TEST1, [IF-TRUE1 = :]...[IF-FALSE = :])
583 # ---------------------------------------------
584 # Expand into
585 # | if TEST1; then
586 # |   IF-TRUE1
587 # | elif TEST2; then
588 # |   IF-TRUE2
589 # [...]
590 # | else
591 # |   IF-FALSE
592 # | fi
593 # with simplifications if IF-TRUE1 and/or IF-FALSE is empty.
595 m4_define([_AS_IF],
596 [elif $1; then :
597   $2
599 m4_define([_AS_IF_ELSE],
600 [m4_ifnblank([$1],
601 [else
602   $1
603 ])])
605 m4_defun([AS_IF],
606 [if $1; then :
607   $2
608 m4_map_args_pair([_$0], [_$0_ELSE], m4_shift2($@))]dnl
609 [fi[]])# AS_IF
612 # AS_SET_STATUS(STATUS)
613 # ---------------------
614 # Set the shell status ($?) to STATUS, without forking.
615 m4_defun([AS_SET_STATUS],
616 [AS_REQUIRE([_AS_EXIT_PREPARE])[]as_fn_set_status $1])
619 # _AS_UNSET_PREPARE
620 # -----------------
621 # Define $as_unset to execute AS_UNSET, for backwards compatibility
622 # with older versions of M4sh.
623 m4_defun([_AS_UNSET_PREPARE],
624 [AS_FUNCTION_DESCRIBE([as_fn_unset], [VAR], [Portably unset VAR.])
625 as_fn_unset ()
627   AS_UNSET([$[1]])
629 as_unset=as_fn_unset])
632 # AS_UNSET(VAR)
633 # -------------
634 # Unset the env VAR, working around shells that do not allow unsetting
635 # a variable that is not already set.  You should not unset MAIL and
636 # MAILCHECK, as that triggers a bug in Bash 2.01.
637 m4_defun([AS_UNSET],
638 [{ AS_LITERAL_WORD_IF([$1], [], [eval ])$1=; unset $1;}])
645 ## ------------------------------------------ ##
646 ## 3. Error and warnings at the shell level.  ##
647 ## ------------------------------------------ ##
650 # AS_MESSAGE_FD
651 # -------------
652 # Must expand to the fd where messages will be sent.  Defaults to 1,
653 # although a script may reassign this value and use exec to either
654 # copy stdout to the new fd, or open the new fd on /dev/null.
655 m4_define([AS_MESSAGE_FD], [1])
657 # AS_MESSAGE_LOG_FD
658 # -----------------
659 # Must expand to either the empty string (when no logging is
660 # performed), or to the fd of a log file.  Defaults to empty, although
661 # a script may reassign this value and use exec to open a log.  When
662 # not empty, messages to AS_MESSAGE_FD are duplicated to the log,
663 # along with a LINENO reference.
664 m4_define([AS_MESSAGE_LOG_FD])
667 # AS_ORIGINAL_STDIN_FD
668 # --------------------
669 # Must expand to the fd of the script's original stdin.  Defaults to
670 # 0, although the script may reassign this value and use exec to
671 # shuffle fd's.
672 m4_define([AS_ORIGINAL_STDIN_FD], [0])
675 # AS_ESCAPE(STRING, [CHARS = `\"$])
676 # ---------------------------------
677 # Add backslash escaping to the CHARS in STRING.  In an effort to
678 # optimize use of this macro inside double-quoted shell constructs,
679 # the behavior is intentionally undefined if CHARS is longer than 4
680 # bytes, or contains bytes outside of the set [`\"$].  However,
681 # repeated bytes within the set are permissible (AS_ESCAPE([$1], [""])
682 # being a common way to be nice to syntax highlighting).
684 # Avoid the m4_bpatsubst if there are no interesting characters to escape.
685 # _AS_ESCAPE bypasses argument defaulting.
686 m4_define([AS_ESCAPE],
687 [_$0([$1], m4_if([$2], [], [[`], [\"$]], [m4_substr([$2], [0], [1]), [$2]]))])
689 # _AS_ESCAPE(STRING, KEY, SET)
690 # ----------------------------
691 # Backslash-escape all instances of the single byte KEY or up to four
692 # bytes in SET occurring in STRING.  Although a character can occur
693 # multiple times, optimum efficiency occurs when KEY and SET are
694 # distinct, and when SET does not exceed two bytes.  These particular
695 # semantics allow for the fewest number of parses of STRING, as well
696 # as taking advantage of the optimizations in m4 1.4.13+ when
697 # m4_translit is passed SET of size 2 or smaller.
698 m4_define([_AS_ESCAPE],
699 [m4_if(m4_index(m4_translit([[$1]], [$3], [$2$2$2$2]), [$2]), [-1],
700        [$0_], [m4_bpatsubst])([$1], [[$2$3]], [\\\&])])
701 m4_define([_AS_ESCAPE_], [$1])
704 # _AS_QUOTE(STRING)
705 # -----------------
706 # If there are quoted (via backslash) backquotes, output STRING
707 # literally and warn; otherwise, output STRING with ` and " quoted.
709 # Compatibility glue between the old AS_MSG suite which did not
710 # quote anything, and the modern suite which quotes the quotes.
711 # If STRING contains `\\' or `\$', it's modern.
712 # If STRING contains `\"' or `\`', it's old.
713 # Otherwise it's modern.
715 # Profiling shows that m4_index is 5 to 8x faster than m4_bregexp.  The
716 # slower implementation used:
717 # m4_bmatch([$1],
718 #           [\\[\\$]], [$2],
719 #           [\\[`"]], [$3],
720 #           [$2])
721 # The current implementation caters to the common case of no backslashes,
722 # to minimize m4_index expansions (hence the nested if).
723 m4_define([_AS_QUOTE],
724 [m4_cond([m4_index([$1], [\])], [-1], [_AS_QUOTE_MODERN],
725          [m4_eval(m4_index(m4_translit([[$1]], [$], [\]), [\\]) >= 0)],
726 [1], [_AS_QUOTE_MODERN],
727          [m4_eval(m4_index(m4_translit([[$1]], ["], [`]), [\`]) >= 0)],dnl"
728 [1], [_AS_QUOTE_OLD],
729          [_AS_QUOTE_MODERN])([$1])])
731 m4_define([_AS_QUOTE_MODERN],
732 [_AS_ESCAPE([$1], [`], [""])])
734 m4_define([_AS_QUOTE_OLD],
735 [m4_warn([obsolete],
736    [back quotes and double quotes must not be escaped in: $1])$1])
739 # _AS_ECHO_UNQUOTED(STRING, [FD = AS_MESSAGE_FD])
740 # -----------------------------------------------
741 # Perform shell expansions on STRING and echo the string to FD.
742 m4_define([_AS_ECHO_UNQUOTED],
743 [AS_ECHO(["$1"]) >&m4_default([$2], [AS_MESSAGE_FD])])
746 # _AS_ECHO(STRING, [FD = AS_MESSAGE_FD])
747 # --------------------------------------
748 # Protect STRING from backquote expansion, echo the result to FD.
749 m4_define([_AS_ECHO],
750 [_AS_ECHO_UNQUOTED([_AS_QUOTE([$1])], [$2])])
753 # _AS_ECHO_LOG(STRING)
754 # --------------------
755 # Log the string to AS_MESSAGE_LOG_FD.
756 m4_defun_init([_AS_ECHO_LOG],
757 [AS_REQUIRE([_AS_LINENO_PREPARE])],
758 [_AS_ECHO([$as_me:${as_lineno-$LINENO}: $1], AS_MESSAGE_LOG_FD)])
761 # _AS_ECHO_N_PREPARE
762 # ------------------
763 # Check whether to use -n, \c, or newline-tab to separate
764 # checking messages from result messages.
765 # Don't try to cache, since the results of this macro are needed to
766 # display the checking message.  In addition, caching something used once
767 # has little interest.
768 # Idea borrowed from dist 3.0.  Use `*c*,', not `*c,' because if `\c'
769 # failed there is also a newline to match.  Use `xy' because `\c' echoed
770 # in a command substitution prints only the first character of the output
771 # with ksh version M-11/16/88f on AIX 6.1; it needs to be reset by another
772 # backquoted echo.
773 m4_defun([_AS_ECHO_N_PREPARE],
774 [ECHO_C= ECHO_N= ECHO_T=
775 case `echo -n x` in @%:@(((((
776 -n*)
777   case `echo 'xy\c'` in
778   *c*) ECHO_T=' ';;     # ECHO_T is single tab character.
779   xy)  ECHO_C='\c';;
780   *)   echo `echo ksh88 bug on AIX 6.1` > /dev/null
781        ECHO_T=' ';;
782   esac;;
784   ECHO_N='-n';;
785 esac
786 ])# _AS_ECHO_N_PREPARE
789 # _AS_ECHO_N(STRING, [FD = AS_MESSAGE_FD])
790 # ----------------------------------------
791 # Same as _AS_ECHO, but echo doesn't return to a new line.
792 m4_define([_AS_ECHO_N],
793 [AS_ECHO_N(["_AS_QUOTE([$1])"]) >&m4_default([$2], [AS_MESSAGE_FD])])
796 # AS_MESSAGE(STRING, [FD = AS_MESSAGE_FD])
797 # ----------------------------------------
798 # Output "`basename $0`: STRING" to the open file FD, and if logging
799 # is enabled, copy it to the log with a reference to LINENO.
800 m4_defun_init([AS_MESSAGE],
801 [AS_REQUIRE([_AS_ME_PREPARE])],
802 [m4_ifval(AS_MESSAGE_LOG_FD,
803           [{ _AS_ECHO_LOG([$1])
804 _AS_ECHO([$as_me: $1], [$2]);}],
805           [_AS_ECHO([$as_me: $1], [$2])])[]])
808 # AS_WARN(PROBLEM)
809 # ----------------
810 # Output "`basename $0`: WARNING: PROBLEM" to stderr.
811 m4_define([AS_WARN],
812 [AS_MESSAGE([WARNING: $1], [2])])# AS_WARN
815 # _AS_ERROR_PREPARE
816 # -----------------
817 # Output the shell function used by AS_ERROR.  This is designed to be
818 # expanded during the m4_wrap cleanup.
820 # If AS_MESSAGE_LOG_FD is non-empty at the end of the script, then
821 # make this function take optional parameters that use LINENO at the
822 # points where AS_ERROR was expanded with non-empty AS_MESSAGE_LOG_FD;
823 # otherwise, assume the entire script does not do logging.
824 m4_define([_AS_ERROR_PREPARE],
825 [AS_REQUIRE_SHELL_FN([as_fn_error],
826   [AS_FUNCTION_DESCRIBE([as_fn_error], [STATUS ERROR]m4_ifval(AS_MESSAGE_LOG_FD,
827       [[ [[LINENO LOG_FD]]]]),
828     [Output "`basename @S|@0`: error: ERROR" to stderr.]
829 m4_ifval(AS_MESSAGE_LOG_FD,
830     [[If LINENO and LOG_FD are provided, also output the error to LOG_FD,
831       referencing LINENO.]])
832     [Then exit the script with STATUS, using 1 if that was 0.])],
833 [  as_status=$[1]; test $as_status -eq 0 && as_status=1
834 m4_ifval(AS_MESSAGE_LOG_FD,
835 [m4_pushdef([AS_MESSAGE_LOG_FD], [$[4]])dnl
836   if test "$[4]"; then
837     AS_LINENO_PUSH([$[3]])
838     _AS_ECHO_LOG([error: $[2]])
839   fi
840 m4_define([AS_MESSAGE_LOG_FD])], [m4_pushdef([AS_MESSAGE_LOG_FD])])dnl
841   AS_MESSAGE([error: $[2]], [2])
842 _m4_popdef([AS_MESSAGE_LOG_FD])dnl
843   AS_EXIT([$as_status])])])
845 # AS_ERROR(ERROR, [EXIT-STATUS = max($?/1)])
846 # ------------------------------------------
847 # Output "`basename $0`: error: ERROR" to stderr, then exit the
848 # script with EXIT-STATUS.
849 m4_defun_init([AS_ERROR],
850 [m4_append_uniq([_AS_CLEANUP],
851   [m4_divert_text([M4SH-INIT-FN], [_AS_ERROR_PREPARE[]])])],
852 [as_fn_error m4_default([$2], [$?]) "_AS_QUOTE([$1])"m4_ifval(AS_MESSAGE_LOG_FD,
853   [ "$LINENO" AS_MESSAGE_LOG_FD])])
856 # AS_LINENO_PUSH([LINENO])
857 # ------------------------
858 # If this is the outermost call to AS_LINENO_PUSH, make sure that
859 # AS_MESSAGE will print LINENO as the line number.
860 m4_defun([AS_LINENO_PUSH],
861 [as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack])
864 # AS_LINENO_POP([LINENO])
865 # -----------------------
866 # If this is call balances the outermost call to AS_LINENO_PUSH,
867 # AS_MESSAGE will restart printing $LINENO as the line number.
869 # No need to use AS_UNSET, since as_lineno is necessarily set.
870 m4_defun([AS_LINENO_POP],
871 [eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno])
875 ## -------------------------------------- ##
876 ## 4. Portable versions of common tools.  ##
877 ## -------------------------------------- ##
879 # This section is lexicographically sorted.
882 # AS_BASENAME(FILE-NAME)
883 # ----------------------
884 # Simulate the command 'basename FILE-NAME'.  Not all systems have basename.
885 # Also see the comments for AS_DIRNAME.
887 m4_defun([_AS_BASENAME_EXPR],
888 [$as_expr X/[]$1 : '.*/\([[^/][^/]*]\)/*$' \| \
889          X[]$1 : 'X\(//\)$' \| \
890          X[]$1 : 'X\(/\)' \| .])
892 m4_defun([_AS_BASENAME_SED],
893 [AS_ECHO([X/[]$1]) |
894     sed ['/^.*\/\([^/][^/]*\)\/*$/{
895             s//\1/
896             q
897           }
898           /^X\/\(\/\/\)$/{
899             s//\1/
900             q
901           }
902           /^X\/\(\/\).*/{
903             s//\1/
904             q
905           }
906           s/.*/./; q']])
908 m4_defun_init([AS_BASENAME],
909 [AS_REQUIRE([_$0_PREPARE])],
910 [$as_basename -- $1 ||
911 _AS_BASENAME_EXPR([$1]) 2>/dev/null ||
912 _AS_BASENAME_SED([$1])])
915 # _AS_BASENAME_PREPARE
916 # --------------------
917 # Avoid Solaris 9 /usr/ucb/basename, as `basename /' outputs an empty line.
918 # Also, traditional basename mishandles --.  Require here _AS_EXPR_PREPARE,
919 # to avoid problems when _AS_BASENAME is called from the M4SH-INIT diversion.
920 m4_defun([_AS_BASENAME_PREPARE],
921 [AS_REQUIRE([_AS_EXPR_PREPARE])]dnl
922 [if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
923   as_basename=basename
924 else
925   as_basename=false
927 ])# _AS_BASENAME_PREPARE
930 # AS_DIRNAME(FILE-NAME)
931 # ---------------------
932 # Simulate the command 'dirname FILE-NAME'.  Not all systems have dirname.
933 # This macro must be usable from inside ` `.
935 # Prefer expr to echo|sed, since expr is usually faster and it handles
936 # backslashes and newlines correctly.  However, older expr
937 # implementations (e.g. SunOS 4 expr and Solaris 8 /usr/ucb/expr) have
938 # a silly length limit that causes expr to fail if the matched
939 # substring is longer than 120 bytes.  So fall back on echo|sed if
940 # expr fails.
941 m4_defun_init([_AS_DIRNAME_EXPR],
942 [AS_REQUIRE([_AS_EXPR_PREPARE])],
943 [$as_expr X[]$1 : 'X\(.*[[^/]]\)//*[[^/][^/]]*/*$' \| \
944          X[]$1 : 'X\(//\)[[^/]]' \| \
945          X[]$1 : 'X\(//\)$' \| \
946          X[]$1 : 'X\(/\)' \| .])
948 m4_defun([_AS_DIRNAME_SED],
949 [AS_ECHO([X[]$1]) |
950     sed ['/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
951             s//\1/
952             q
953           }
954           /^X\(\/\/\)[^/].*/{
955             s//\1/
956             q
957           }
958           /^X\(\/\/\)$/{
959             s//\1/
960             q
961           }
962           /^X\(\/\).*/{
963             s//\1/
964             q
965           }
966           s/.*/./; q']])
968 m4_defun_init([AS_DIRNAME],
969 [AS_REQUIRE([_$0_PREPARE])],
970 [$as_dirname -- $1 ||
971 _AS_DIRNAME_EXPR([$1]) 2>/dev/null ||
972 _AS_DIRNAME_SED([$1])])
975 # _AS_DIRNAME_PREPARE
976 # -------------------
977 m4_defun([_AS_DIRNAME_PREPARE],
978 [AS_REQUIRE([_AS_EXPR_PREPARE])]dnl
979 [if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
980   as_dirname=dirname
981 else
982   as_dirname=false
984 ])# _AS_DIRNAME_PREPARE
987 # AS_ECHO(WORD)
988 # -------------
989 # Output WORD followed by a newline.  WORD must be a single shell word
990 # (typically a quoted string).  The bytes of WORD are output as-is, even
991 # if it starts with "-" or contains "\".
992 m4_defun_init([AS_ECHO],
993 [AS_REQUIRE([_$0_PREPARE])],
994 [$as_echo $1])
997 # AS_ECHO_N(WORD)
998 # ---------------
999 # Like AS_ECHO(WORD), except do not output the trailing newline.
1000 m4_defun_init([AS_ECHO_N],
1001 [AS_REQUIRE([_AS_ECHO_PREPARE])],
1002 [$as_echo_n $1])
1005 # _AS_ECHO_PREPARE
1006 # ----------------
1007 # Arrange for $as_echo 'FOO' to echo FOO without escape-interpretation;
1008 # and similarly for $as_echo_n, which omits the trailing newline.
1009 # 'FOO' is an optional single argument; a missing FOO is treated as empty.
1010 m4_defun([_AS_ECHO_PREPARE],
1011 [[as_nl='
1013 export as_nl
1014 # Printing a long string crashes Solaris 7 /usr/bin/printf.
1015 as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
1016 as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
1017 as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
1018 # Prefer a ksh shell builtin over an external printf program on Solaris,
1019 # but without wasting forks for bash or zsh.
1020 if test -z "$BASH_VERSION$ZSH_VERSION" \
1021     && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
1022   as_echo='print -r --'
1023   as_echo_n='print -rn --'
1024 elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
1025   as_echo='printf %s\n'
1026   as_echo_n='printf %s'
1027 else
1028   if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
1029     as_echo_body='eval /usr/ucb/echo -n "$][1$as_nl"'
1030     as_echo_n='/usr/ucb/echo -n'
1031   else
1032     as_echo_body='eval expr "X$][1" : "X\\(.*\\)"'
1033     as_echo_n_body='eval
1034       arg=$][1;
1035       case $arg in @%:@(
1036       *"$as_nl"*)
1037         expr "X$arg" : "X\\(.*\\)$as_nl";
1038         arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
1039       esac;
1040       expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
1041     '
1042     export as_echo_n_body
1043     as_echo_n='sh -c $as_echo_n_body as_echo'
1044   fi
1045   export as_echo_body
1046   as_echo='sh -c $as_echo_body as_echo'
1048 ]])# _AS_ECHO_PREPARE
1051 # AS_TEST_X
1052 # ---------
1053 # Check whether a file has executable or search permissions.
1054 m4_defun_init([AS_TEST_X],
1055 [AS_REQUIRE([_AS_TEST_PREPARE])],
1056 [$as_test_x $1[]])# AS_TEST_X
1059 # AS_EXECUTABLE_P
1060 # ---------------
1061 # Check whether a file is a regular file that has executable permissions.
1062 m4_defun_init([AS_EXECUTABLE_P],
1063 [AS_REQUIRE([_AS_TEST_PREPARE])],
1064 [{ test -f $1 && AS_TEST_X([$1]); }])# AS_EXECUTABLE_P
1067 # _AS_EXPR_PREPARE
1068 # ----------------
1069 # QNX 4.25 expr computes and issue the right result but exits with failure.
1070 # Tru64 expr mishandles leading zeros in numeric strings.
1071 # Detect these flaws.
1072 m4_defun([_AS_EXPR_PREPARE],
1073 [if expr a : '\(a\)' >/dev/null 2>&1 &&
1074    test "X`expr 00001 : '.*\(...\)'`" = X001; then
1075   as_expr=expr
1076 else
1077   as_expr=false
1079 ])# _AS_EXPR_PREPARE
1082 # _AS_ME_PREPARE
1083 # --------------
1084 # Define $as_me to the basename of the executable file's name.
1085 m4_defun([AS_ME_PREPARE], [AS_REQUIRE([_$0])])
1086 m4_defun([_AS_ME_PREPARE],
1087 [AS_REQUIRE([_AS_BASENAME_PREPARE])]dnl
1088 [as_me=`AS_BASENAME("$[0]")`
1091 # _AS_LINENO_WORKS
1092 # ----------------
1093 # Succeed if the currently executing shell supports LINENO.
1094 # This macro does not expand to a single shell command, so be careful
1095 # when using it.  Surrounding the body of this macro with {} would
1096 # cause "bash -c '_ASLINENO_WORKS'" to fail (with Bash 2.05, anyway),
1097 # but that bug is irrelevant to our use of LINENO.  We can't use
1098 # AS_VAR_ARITH, as this is expanded prior to shell functions.
1100 # Testing for LINENO support is hard; we use _AS_LINENO_WORKS inside
1101 # _AS_RUN, which sometimes eval's its argument (pdksh gives false
1102 # negatives if $LINENO is expanded by eval), and sometimes passes the
1103 # argument to another shell (if the current shell supports LINENO,
1104 # then expanding $LINENO prior to the string leads to false
1105 # positives).  Hence, we perform two tests, and coordinate with
1106 # _AS_DETECT_EXPAND (which ensures that only the first of two LINENO
1107 # is expanded in advance) and _AS_RUN (which sets $as_run to 'a' when
1108 # handing the test to another shell), so that we know which test to
1109 # trust.
1110 m4_define([_AS_LINENO_WORKS],
1111 [  as_lineno_1=$LINENO as_lineno_1a=$LINENO
1112   as_lineno_2=$LINENO as_lineno_2a=$LINENO
1113   eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&
1114   test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"'])
1117 # _AS_LINENO_PREPARE
1118 # ------------------
1119 # If LINENO is not supported by the shell, produce a version of this
1120 # script where LINENO is hard coded.
1121 # Comparing LINENO against _oline_ is not a good solution, since in
1122 # the case of embedded executables (such as config.status within
1123 # configure) you'd compare LINENO wrt config.status vs. _oline_ wrt
1124 # configure.
1126 # AS_ERROR normally uses LINENO if logging, but AS_LINENO_PREPARE uses
1127 # AS_ERROR.  Besides, if the logging fd is open, we don't want to use
1128 # $LINENO in the log complaining about broken LINENO.  We break the
1129 # circular require by changing AS_ERROR and AS_MESSAGE_LOG_FD.
1130 m4_defun([AS_LINENO_PREPARE], [AS_REQUIRE([_$0])])
1131 m4_defun([_AS_LINENO_PREPARE],
1132 [AS_REQUIRE([_AS_CR_PREPARE])]dnl
1133 [AS_REQUIRE([_AS_ME_PREPARE])]dnl
1134 [_AS_DETECT_SUGGESTED([_AS_LINENO_WORKS])]dnl
1135 [m4_pushdef([AS_MESSAGE_LOG_FD])]dnl
1136 [m4_pushdef([AS_ERROR],
1137   [{ AS_MESSAGE(]m4_dquote([error: $][1])[, [2]); AS_EXIT([1]); }])]dnl
1138 dnl Create $as_me.lineno as a copy of $as_myself, but with $LINENO
1139 dnl uniformly replaced by the line number.  The first 'sed' inserts a
1140 dnl line-number line after each line using $LINENO; the second 'sed'
1141 dnl does the real work.  The second script uses 'N' to pair each
1142 dnl line-number line with the line containing $LINENO, and appends
1143 dnl trailing '-' during substitution so that $LINENO is not a special
1144 dnl case at line end.  (Raja R Harinath suggested sed '=', and Paul
1145 dnl Eggert wrote the scripts with optimization help from Paolo Bonzini).
1146 [_AS_LINENO_WORKS || {
1147 [  # Blame Lee E. McMahon (1931-1989) for sed's syntax.  :-)
1148   sed -n '
1149     p
1150     /[$]LINENO/=
1151   ' <$as_myself |
1152     sed '
1153       s/[$]LINENO.*/&-/
1154       t lineno
1155       b
1156       :lineno
1157       N
1158       :loop
1159       s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
1160       t loop
1161       s/-\n.*//
1162     ' >$as_me.lineno &&
1163   chmod +x "$as_me.lineno"] ||
1164     AS_ERROR([cannot create $as_me.lineno; rerun with a POSIX shell])
1166   # Don't try to exec as it changes $[0], causing all sort of problems
1167   # (the dirname of $[0] is not the place where we might find the
1168   # original and so on.  Autoconf is especially sensitive to this).
1169   . "./$as_me.lineno"
1170   # Exit status is that of the last command.
1171   exit
1173 _m4_popdef([AS_MESSAGE_LOG_FD], [AS_ERROR])])# _AS_LINENO_PREPARE
1176 # _AS_LN_S_PREPARE
1177 # ----------------
1178 # Don't use conftest.sym to avoid file name issues on DJGPP, where this
1179 # would yield conftest.sym.exe for DJGPP < 2.04.  And don't use `conftest'
1180 # as base name to avoid prohibiting concurrency (e.g., concurrent
1181 # config.statuses).  On read-only media, assume 'cp -p' and hope we
1182 # are just running --help anyway.
1183 m4_defun([_AS_LN_S_PREPARE],
1184 [rm -f conf$$ conf$$.exe conf$$.file
1185 if test -d conf$$.dir; then
1186   rm -f conf$$.dir/conf$$.file
1187 else
1188   rm -f conf$$.dir
1189   mkdir conf$$.dir 2>/dev/null
1191 if (echo >conf$$.file) 2>/dev/null; then
1192   if ln -s conf$$.file conf$$ 2>/dev/null; then
1193     as_ln_s='ln -s'
1194     # ... but there are two gotchas:
1195     # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
1196     # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
1197     # In both cases, we have to default to `cp -p'.
1198     ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
1199       as_ln_s='cp -p'
1200   elif ln conf$$.file conf$$ 2>/dev/null; then
1201     as_ln_s=ln
1202   else
1203     as_ln_s='cp -p'
1204   fi
1205 else
1206   as_ln_s='cp -p'
1208 rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
1209 rmdir conf$$.dir 2>/dev/null
1210 ])# _AS_LN_S_PREPARE
1213 # AS_LN_S(FILE, LINK)
1214 # -------------------
1215 # FIXME: Should we add the glue code to handle properly relative symlinks
1216 # simulated with `ln' or `cp'?
1217 m4_defun_init([AS_LN_S],
1218 [AS_REQUIRE([_AS_LN_S_PREPARE])],
1219 [$as_ln_s $1 $2])
1222 # _AS_MKDIR_P
1223 # -----------
1224 # Emit code that can be used to emulate `mkdir -p` with plain `mkdir';
1225 # the code assumes that "$as_dir" contains the directory to create.
1226 # $as_dir is normalized, so there is no need to worry about using --.
1227 m4_define([_AS_MKDIR_P],
1228 [case $as_dir in #(
1229   -*) as_dir=./$as_dir;;
1230   esac
1231   test -d "$as_dir" || eval $as_mkdir_p || {
1232     as_dirs=
1233     while :; do
1234       case $as_dir in #(
1235       *\'*) as_qdir=`AS_ECHO(["$as_dir"]) | sed "s/'/'\\\\\\\\''/g"`;; #'(
1236       *) as_qdir=$as_dir;;
1237       esac
1238       as_dirs="'$as_qdir' $as_dirs"
1239       as_dir=`AS_DIRNAME("$as_dir")`
1240       test -d "$as_dir" && break
1241     done
1242     test -z "$as_dirs" || eval "mkdir $as_dirs"
1243   } || test -d "$as_dir" || AS_ERROR([cannot create directory $as_dir])
1246 # AS_MKDIR_P(DIR)
1247 # ---------------
1248 # Emulate `mkdir -p' with plain `mkdir' if needed.
1249 m4_defun_init([AS_MKDIR_P],
1250 [AS_REQUIRE([_$0_PREPARE])],
1251 [as_dir=$1; as_fn_mkdir_p])# AS_MKDIR_P
1254 # _AS_MKDIR_P_PREPARE
1255 # -------------------
1256 m4_defun([_AS_MKDIR_P_PREPARE],
1257 [AS_REQUIRE_SHELL_FN([as_fn_mkdir_p],
1258   [AS_FUNCTION_DESCRIBE([as_fn_mkdir_p], [],
1259     [Create "$as_dir" as a directory, including parents if necessary.])],
1261   _AS_MKDIR_P
1262 ])]dnl
1263 [if mkdir -p . 2>/dev/null; then
1264   as_mkdir_p='mkdir -p "$as_dir"'
1265 else
1266   test -d ./-p && rmdir ./-p
1267   as_mkdir_p=false
1269 ])# _AS_MKDIR_P_PREPARE
1272 # _AS_PATH_SEPARATOR_PREPARE
1273 # --------------------------
1274 # Compute the path separator.
1275 m4_defun([_AS_PATH_SEPARATOR_PREPARE],
1276 [# The user is always right.
1277 if test "${PATH_SEPARATOR+set}" != set; then
1278   PATH_SEPARATOR=:
1279   (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
1280     (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
1281       PATH_SEPARATOR=';'
1282   }
1284 ])# _AS_PATH_SEPARATOR_PREPARE
1287 # _AS_PATH_WALK([PATH = $PATH], BODY, [IF-NOT-FOUND])
1288 # ---------------------------------------------------
1289 # Walk through PATH running BODY for each `as_dir'.  If BODY never does a
1290 # `break', evaluate IF-NOT-FOUND.
1292 # Still very private as its interface looks quite bad.
1294 # `$as_dummy' forces splitting on constant user-supplied paths.
1295 # POSIX.2 field splitting is done only on the result of word
1296 # expansions, not on literal text.  This closes a longstanding sh security
1297 # hole.  Optimize it away when not needed, i.e., if there are no literal
1298 # path separators.
1299 m4_defun_init([_AS_PATH_WALK],
1300 [AS_REQUIRE([_AS_PATH_SEPARATOR_PREPARE])],
1301 [as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
1302 m4_ifvaln([$3], [as_found=false])dnl
1303 m4_bmatch([$1], [[:;]],
1304 [as_dummy="$1"
1305 for as_dir in $as_dummy],
1306 [for as_dir in m4_default([$1], [$PATH])])
1308   IFS=$as_save_IFS
1309   test -z "$as_dir" && as_dir=.
1310   m4_ifvaln([$3], [as_found=:])dnl
1311   $2
1312   m4_ifvaln([$3], [as_found=false])dnl
1313 done
1314 m4_ifvaln([$3], [$as_found || { $3; }])dnl
1315 IFS=$as_save_IFS
1319 # AS_SET_CATFILE(VAR, DIR-NAME, FILE-NAME)
1320 # ----------------------------------------
1321 # Set VAR to DIR-NAME/FILE-NAME.
1322 # Optimize the common case where $2 or $3 is '.'.
1323 m4_define([AS_SET_CATFILE],
1324 [case $2 in @%:@((
1325 .) AS_VAR_SET([$1], [$3]);;
1327   case $3 in @%:@(((
1328   .) AS_VAR_SET([$1], [$2]);;
1329   [[\\/]]* | ?:[[\\/]]* ) AS_VAR_SET([$1], [$3]);;
1330   *) AS_VAR_SET([$1], [$2/$3]);;
1331   esac;;
1332 esac[]])# AS_SET_CATFILE
1335 # _AS_TEST_PREPARE
1336 # ----------------
1337 # Find out whether `test -x' works.  If not, prepare a substitute
1338 # that should work well enough for most scripts.
1340 # Here are some of the problems with the substitute.
1341 # The 'ls' tests whether the owner, not the current user, can execute/search.
1342 # The eval means '*', '?', and '[' cause inadvertent file name globbing
1343 # after the 'eval', so jam together as many tokens as we can to minimize
1344 # the likelihood that the inadvertent globbing will actually do anything.
1345 # Luckily, this gorp is needed only on really ancient hosts.
1347 m4_defun([_AS_TEST_PREPARE],
1348 [if test -x / >/dev/null 2>&1; then
1349   as_test_x='test -x'
1350 else
1351   if ls -dL / >/dev/null 2>&1; then
1352     as_ls_L_option=L
1353   else
1354     as_ls_L_option=
1355   fi
1356   as_test_x='
1357     eval sh -c '\''
1358       if test -d "$[]1"; then
1359         test -d "$[]1/.";
1360       else
1361         case $[]1 in @%:@(
1362         -*)set "./$[]1";;
1363         esac;
1364         case `ls -ld'$as_ls_L_option' "$[]1" 2>/dev/null` in @%:@((
1365         ???[[sx]]*):;;*)false;;esac;fi
1366     '\'' sh
1367   '
1369 dnl as_executable_p is present for backward compatibility with Libtool
1370 dnl 1.5.22, but it should go away at some point.
1371 as_executable_p=$as_test_x
1372 ])# _AS_TEST_PREPARE
1377 ## ------------------ ##
1378 ## 5. Common idioms.  ##
1379 ## ------------------ ##
1381 # This section is lexicographically sorted.
1384 # AS_BOX(MESSAGE, [FRAME-CHARACTER = `-'])
1385 # ----------------------------------------
1386 # Output MESSAGE, a single line text, framed with FRAME-CHARACTER (which
1387 # must not be `/').
1388 m4_define([AS_BOX],
1389 [_$0(m4_expand([$1]), [$2])])
1391 m4_define([_AS_BOX],
1392 [m4_if(m4_index(m4_translit([[$1]], [`\"], [$$$]), [$]),
1393   [-1], [$0_LITERAL], [$0_INDIR])($@)])
1396 # _AS_BOX_LITERAL(MESSAGE, [FRAME-CHARACTER = `-'])
1397 # -------------------------------------------------
1398 m4_define([_AS_BOX_LITERAL],
1399 [AS_ECHO(["_AS_ESCAPE(m4_dquote(m4_expand([m4_text_box($@)])), [`], [\"$])"])])
1402 # _AS_BOX_INDIR(MESSAGE, [FRAME-CHARACTER = `-'])
1403 # -----------------------------------------------
1404 m4_define([_AS_BOX_INDIR],
1405 [sed 'h;s/./m4_default([$2], [-])/g;s/^.../@%:@@%:@ /;s/...$/ @%:@@%:@/;p;x;p;x' <<_ASBOX
1406 @%:@@%:@ $1 @%:@@%:@
1407 _ASBOX])
1410 # _AS_CLEAN_DIR(DIR)
1411 # ------------------
1412 # Remove all contents from within DIR, including any unwritable
1413 # subdirectories, but leave DIR itself untouched.
1414 m4_define([_AS_CLEAN_DIR],
1415 [if test -d $1; then
1416   find $1 -type d ! -perm -700 -exec chmod u+rwx {} \;
1417   rm -fr $1/* $1/.[[!.]] $1/.??*
1418 fi])
1421 # AS_FUNCTION_DESCRIBE(NAME, [ARGS], DESCRIPTION, [WRAP-COLUMN = 79])
1422 # -------------------------------------------------------------------
1423 # Output a shell comment describing NAME and its arguments ARGS, then
1424 # a separator line, then the DESCRIPTION wrapped at a decimal
1425 # WRAP-COLUMN.  The output resembles:
1426 #  # NAME ARGS
1427 #  # ---------
1428 #  # Wrapped DESCRIPTION text
1429 # NAME and ARGS are expanded, while DESCRIPTION is treated as a
1430 # whitespace-separated list of strings that are not expanded.
1431 m4_define([AS_FUNCTION_DESCRIBE],
1432 [@%:@ $1[]m4_ifval([$2], [ $2])
1433 @%:@ m4_translit(m4_format([%*s],
1434            m4_decr(m4_qlen(_m4_expand([$1[]m4_ifval([$2], [ $2])
1435 ]))), []), [ ], [-])
1436 m4_text_wrap([$3], [@%:@ ], [], [$4])])
1439 # AS_HELP_STRING(LHS, RHS, [INDENT-COLUMN = 26], [WRAP-COLUMN = 79])
1440 # ------------------------------------------------------------------
1442 # Format a help string so that it looks pretty when the user executes
1443 # "script --help".  This macro takes up to four arguments, a
1444 # "left hand side" (LHS), a "right hand side" (RHS), a decimal
1445 # INDENT-COLUMN which is the column where wrapped lines should begin
1446 # (the default of 26 is recommended), and a decimal WRAP-COLUMN which is
1447 # the column where lines should wrap (the default of 79 is recommended).
1448 # LHS is expanded, RHS is not.
1450 # For backwards compatibility not documented in the manual, INDENT-COLUMN
1451 # can also be specified as a string of white spaces, whose width
1452 # determines the indentation column.  Using TABs in INDENT-COLUMN is not
1453 # recommended, since screen width of TAB is not computed.
1455 # The resulting string is suitable for use in other macros that require
1456 # a help string (e.g. AC_ARG_WITH).
1458 # Here is the sample string from the Autoconf manual (Node: External
1459 # Software) which shows the proper spacing for help strings.
1461 #    --with-readline         support fancy command line editing
1462 #  ^ ^                       ^
1463 #  | |                       |
1464 #  | column 2                column 26
1465 #  |
1466 #  column 0
1468 # A help string is made up of a "left hand side" (LHS) and a "right
1469 # hand side" (RHS).  In the example above, the LHS is
1470 # "--with-readline", while the RHS is "support fancy command line
1471 # editing".
1473 # If the LHS contains more than (INDENT-COLUMN - 3) characters, then the
1474 # LHS is terminated with a newline so that the RHS starts on a line of its
1475 # own beginning at INDENT-COLUMN.  In the default case, this corresponds to an
1476 # LHS with more than 23 characters.
1478 # Therefore, in the example, if the LHS were instead
1479 # "--with-readline-blah-blah-blah", then the AS_HELP_STRING macro would
1480 # expand into:
1483 #    --with-readline-blah-blah-blah
1484 #  ^ ^                       support fancy command line editing
1485 #  | |                       ^
1486 #  | column 2                |
1487 #  column 0                  column 26
1490 # m4_text_wrap hacks^Wworks around the fact that m4_format does not
1491 # know quadrigraphs.
1493 m4_define([AS_HELP_STRING],
1494 [m4_text_wrap([$2], m4_cond([[$3]], [], [                          ],
1495                             [m4_eval([$3]+0)], [0], [[$3]],
1496                             [m4_format([[%*s]], [$3], [])]),
1497               m4_expand([  $1 ]), [$4])])# AS_HELP_STRING
1500 # AS_IDENTIFIER_IF(EXPRESSION, IF-IDENT, IF-NOT-IDENT)
1501 # ----------------------------------------------------
1502 # If EXPRESSION serves as an identifier (ie, after removal of @&t@, it
1503 # matches the regex `^[a-zA-Z_][a-zA-Z_0-9]*$'), execute IF-IDENT,
1504 # otherwise IF-NOT-IDENT.
1506 # This is generally faster than the alternative:
1507 #   m4_bmatch(m4_bpatsubst([[$1]], [@&t@]), ^m4_defn([m4_re_word])$,
1508 #             [$2], [$3])
1510 # Rather than expand m4_defn every time AS_IDENTIFIER_IF is expanded, we
1511 # inline its expansion up front.  Only use a regular expression if we
1512 # detect a potential quadrigraph.
1514 # First, check if the entire string matches m4_cr_symbol2.  Only then do
1515 # we worry if the first character also matches m4_cr_symbol1 (ie. does not
1516 # match m4_cr_digit).
1517 m4_define([AS_IDENTIFIER_IF],
1518 [m4_if(_$0(m4_if(m4_index([$1], [@]), [-1],
1519   [[$1]], [m4_bpatsubst([[$1]], [@&t@])])), [-], [$2], [$3])])
1521 m4_define([_AS_IDENTIFIER_IF],
1522 [m4_cond([[$1]], [], [],
1523          [m4_eval(m4_len(m4_translit([[$1]], ]]dnl
1524 m4_dquote(m4_dquote(m4_defn([m4_cr_symbols2])))[[)) > 0)], [1], [],
1525          [m4_len(m4_translit(m4_format([[%.1s]], [$1]), ]]dnl
1526 m4_dquote(m4_dquote(m4_defn([m4_cr_symbols1])))[[))], [0], [-])])
1529 # AS_LITERAL_IF(EXPRESSION, IF-LITERAL, IF-NOT-LITERAL,
1530 #               [IF-SIMPLE-REF = IF-NOT-LITERAL])
1531 # -----------------------------------------------------
1532 # If EXPRESSION has no shell indirections ($var or `expr`), expand
1533 # IF-LITERAL, else IF-NOT-LITERAL.  In some cases, IF-NOT-LITERAL
1534 # must be complex to safely deal with ``, while a simpler
1535 # expression IF-SIMPLE-REF can be used if the indirection
1536 # involves only shell variable expansion (as in ${varname}).
1538 # EXPRESSION is treated as a literal if it results in the same
1539 # interpretation whether it is unquoted or contained within double
1540 # quotes, with the exception that whitespace is ignored (on the
1541 # assumption that it will be flattened to _).  Therefore, neither `\$'
1542 # nor `a''b' is a literal, since both backslash and single quotes have
1543 # different quoting behavior in the two contexts; and `a*' is not a
1544 # literal, because it has different globbing.  Note, however, that
1545 # while `${a+b}' is neither a literal nor a simple ref, `a+b' is a
1546 # literal.  This macro is an *approximation*: it is possible that
1547 # there are some EXPRESSIONs which the shell would treat as literals,
1548 # but which this macro does not recognize.
1550 # Why do we reject EXPRESSION expanding with `[' or `]' as a literal?
1551 # Because AS_TR_SH is MUCH faster if it can use m4_translit on literals
1552 # instead of m4_bpatsubst; but m4_translit is much tougher to do safely
1553 # if `[' is translated.  That, and file globbing matters.
1555 # Note that the quadrigraph @S|@ can result in non-literals, but outright
1556 # rejecting all @ would make AC_INIT complain on its bug report address.
1558 # We used to use m4_bmatch(m4_quote($1), [[`$]], [$3], [$2]), but
1559 # profiling shows that it is faster to use m4_translit.
1561 # Because the translit is stripping quotes, it must also neutralize
1562 # anything that might be in a macro name, as well as comments, commas,
1563 # or unbalanced parentheses.  Valid shell variable characters and
1564 # unambiguous literal characters are deleted (`a.b'), and remaining
1565 # characters are normalized into `$' if they can form simple refs
1566 # (${a}), `+' if they can potentially form literals (a+b), ``' if they
1567 # can interfere with m4 parsing, or left alone otherwise.  If both `$'
1568 # and `+' are left, it is treated as a complex reference (${a+b}),
1569 # even though it could technically be a simple reference (${a}+b).
1570 # _AS_LITERAL_IF_ only has to check for an empty string after removing
1571 # one of the two normalized characters.
1573 # Rather than expand m4_defn every time AS_LITERAL_IF is expanded, we
1574 # inline its expansion up front.  _AS_LITERAL_IF expands to the name
1575 # of a macro that takes three arguments: IF-SIMPLE-REF,
1576 # IF-NOT-LITERAL, IF-LITERAL.  It also takes an optional argument of
1577 # any additional characters to allow as literals (useful for AS_TR_SH
1578 # and AS_TR_CPP to perform inline conversion of whitespace to _).  The
1579 # order of the arguments allows reuse of m4_default.
1580 m4_define([AS_LITERAL_IF],
1581 [_$0(m4_expand([$1]), [  ][
1582 ])([$4], [$3], [$2])])
1584 m4_define([_AS_LITERAL_IF],
1585 [m4_if(m4_index([$1], [@S|@]), [-1], [$0_(m4_translit([$1],
1586   [-:=%/@{}[]#(),.$2]]]m4_dquote(m4_dquote(m4_defn([m4_cr_symbols2])))[[,
1587   [++++++$$`````]))], [$0_NO])])
1589 m4_define([_AS_LITERAL_IF_],
1590 [m4_if(m4_translit([$1], [+]), [], [$0YES],
1591        m4_translit([$1], [$]), [], [m4_default], [$0NO])])
1593 m4_define([_AS_LITERAL_IF_YES], [$3])
1594 m4_define([_AS_LITERAL_IF_NO], [$2])
1596 # AS_LITERAL_WORD_IF(EXPRESSION, IF-LITERAL, IF-NOT-LITERAL,
1597 #                    [IF-SIMPLE-REF = IF-NOT-LITERAL])
1598 # ----------------------------------------------------------
1599 # Like AS_LITERAL_IF, except that spaces and tabs in EXPRESSION
1600 # are treated as non-literal.
1601 m4_define([AS_LITERAL_WORD_IF],
1602 [_AS_LITERAL_IF(m4_expand([$1]))([$4], [$3], [$2])])
1604 # AS_LITERAL_HEREDOC_IF(EXPRESSION, IF-LITERAL, IF-NOT-LITERAL)
1605 # -------------------------------------------------------------
1606 # Like AS_LITERAL_IF, except that a string is considered literal
1607 # if it results in the same output in both quoted and unquoted
1608 # here-documents.
1609 m4_define([AS_LITERAL_HEREDOC_IF],
1610 [_$0(m4_expand([$1]))([$2], [$3])])
1612 m4_define([_AS_LITERAL_HEREDOC_IF],
1613 [m4_if(m4_index([$1], [@S|@]), [-1],
1614   [m4_if(m4_index(m4_translit([[$1]], [\`], [$]), [$]), [-1],
1615     [$0_YES], [$0_NO])],
1616   [$0_NO])])
1618 m4_define([_AS_LITERAL_HEREDOC_IF_YES], [$1])
1619 m4_define([_AS_LITERAL_HEREDOC_IF_NO], [$2])
1622 # AS_TMPDIR(PREFIX, [DIRECTORY = $TMPDIR [= /tmp]])
1623 # -------------------------------------------------
1624 # Create as safely as possible a temporary directory in DIRECTORY
1625 # which name is inspired by PREFIX (should be 2-4 chars max).
1627 # Even though $tmp does not fit our normal naming scheme of $as_*,
1628 # it is a documented part of the public API and must not be changed.
1629 m4_define([AS_TMPDIR],
1630 [# Create a (secure) tmp directory for tmp files.
1631 m4_if([$2], [], [: "${TMPDIR:=/tmp}"])
1633   tmp=`(umask 077 && mktemp -d "m4_default([$2],
1634     [$TMPDIR])/$1XXXXXX") 2>/dev/null` &&
1635   test -d "$tmp"
1636 }  ||
1638   tmp=m4_default([$2], [$TMPDIR])/$1$$-$RANDOM
1639   (umask 077 && mkdir "$tmp")
1640 } || AS_ERROR([cannot create a temporary directory in m4_default([$2],
1641               [$TMPDIR])])])# AS_TMPDIR
1644 # AS_UNAME
1645 # --------
1646 # Try to describe this machine.  Meant for logs.
1647 m4_define([AS_UNAME],
1649 cat <<_ASUNAME
1650 m4_text_box([Platform.])
1652 hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
1653 uname -m = `(uname -m) 2>/dev/null || echo unknown`
1654 uname -r = `(uname -r) 2>/dev/null || echo unknown`
1655 uname -s = `(uname -s) 2>/dev/null || echo unknown`
1656 uname -v = `(uname -v) 2>/dev/null || echo unknown`
1658 /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
1659 /bin/uname -X     = `(/bin/uname -X) 2>/dev/null     || echo unknown`
1661 /bin/arch              = `(/bin/arch) 2>/dev/null              || echo unknown`
1662 /usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null       || echo unknown`
1663 /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
1664 /usr/bin/hostinfo      = `(/usr/bin/hostinfo) 2>/dev/null      || echo unknown`
1665 /bin/machine           = `(/bin/machine) 2>/dev/null           || echo unknown`
1666 /usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null       || echo unknown`
1667 /bin/universe          = `(/bin/universe) 2>/dev/null          || echo unknown`
1669 _ASUNAME
1671 _AS_PATH_WALK([$PATH], [AS_ECHO(["PATH: $as_dir"])])
1675 # _AS_VERSION_COMPARE_PREPARE
1676 # ---------------------------
1677 # Output variables for comparing version numbers.
1678 m4_defun([_AS_VERSION_COMPARE_PREPARE],
1679 [[as_awk_strverscmp='
1680   # Use only awk features that work with 7th edition Unix awk (1978).
1681   # My, what an old awk you have, Mr. Solaris!
1682   END {
1683     while (length(v1) && length(v2)) {
1684       # Set d1 to be the next thing to compare from v1, and likewise for d2.
1685       # Normally this is a single character, but if v1 and v2 contain digits,
1686       # compare them as integers and fractions as strverscmp does.
1687       if (v1 ~ /^[0-9]/ && v2 ~ /^[0-9]/) {
1688         # Split v1 and v2 into their leading digit string components d1 and d2,
1689         # and advance v1 and v2 past the leading digit strings.
1690         for (len1 = 1; substr(v1, len1 + 1) ~ /^[0-9]/; len1++) continue
1691         for (len2 = 1; substr(v2, len2 + 1) ~ /^[0-9]/; len2++) continue
1692         d1 = substr(v1, 1, len1); v1 = substr(v1, len1 + 1)
1693         d2 = substr(v2, 1, len2); v2 = substr(v2, len2 + 1)
1694         if (d1 ~ /^0/) {
1695           if (d2 ~ /^0/) {
1696             # Compare two fractions.
1697             while (d1 ~ /^0/ && d2 ~ /^0/) {
1698               d1 = substr(d1, 2); len1--
1699               d2 = substr(d2, 2); len2--
1700             }
1701             if (len1 != len2 && ! (len1 && len2 && substr(d1, 1, 1) == substr(d2, 1, 1))) {
1702               # The two components differ in length, and the common prefix
1703               # contains only leading zeros.  Consider the longer to be less.
1704               d1 = -len1
1705               d2 = -len2
1706             } else {
1707               # Otherwise, compare as strings.
1708               d1 = "x" d1
1709               d2 = "x" d2
1710             }
1711           } else {
1712             # A fraction is less than an integer.
1713             exit 1
1714           }
1715         } else {
1716           if (d2 ~ /^0/) {
1717             # An integer is greater than a fraction.
1718             exit 2
1719           } else {
1720             # Compare two integers.
1721             d1 += 0
1722             d2 += 0
1723           }
1724         }
1725       } else {
1726         # The normal case, without worrying about digits.
1727         d1 = substr(v1, 1, 1); v1 = substr(v1, 2)
1728         d2 = substr(v2, 1, 1); v2 = substr(v2, 2)
1729       }
1730       if (d1 < d2) exit 1
1731       if (d1 > d2) exit 2
1732     }
1733     # Beware Solaris /usr/xgp4/bin/awk (at least through Solaris 10),
1734     # which mishandles some comparisons of empty strings to integers.
1735     if (length(v2)) exit 1
1736     if (length(v1)) exit 2
1737   }
1738 ']])# _AS_VERSION_COMPARE_PREPARE
1741 # AS_VERSION_COMPARE(VERSION-1, VERSION-2,
1742 #                    [ACTION-IF-LESS], [ACTION-IF-EQUAL], [ACTION-IF-GREATER])
1743 # ----------------------------------------------------------------------------
1744 # Compare two strings possibly containing shell variables as version strings.
1746 # This usage is portable even to ancient awk,
1747 # so don't worry about finding a "nice" awk version.
1748 m4_defun_init([AS_VERSION_COMPARE],
1749 [AS_REQUIRE([_$0_PREPARE])],
1750 [as_arg_v1=$1
1751 as_arg_v2=$2
1752 awk "$as_awk_strverscmp" v1="$as_arg_v1" v2="$as_arg_v2" /dev/null
1753 AS_CASE([$?],
1754         [1], [$3],
1755         [0], [$4],
1756         [2], [$5])])# AS_VERSION_COMPARE
1760 ## --------------------------------------- ##
1761 ## 6. Common m4/sh character translation.  ##
1762 ## --------------------------------------- ##
1764 # The point of this section is to provide high level macros comparable
1765 # to m4's `translit' primitive, but m4/sh polymorphic.
1766 # Transliteration of literal strings should be handled by m4, while
1767 # shell variables' content will be translated at runtime (tr or sed).
1770 # _AS_CR_PREPARE
1771 # --------------
1772 # Output variables defining common character ranges.
1773 # See m4_cr_letters etc.
1774 m4_defun([_AS_CR_PREPARE],
1775 [# Avoid depending upon Character Ranges.
1776 as_cr_letters='abcdefghijklmnopqrstuvwxyz'
1777 as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
1778 as_cr_Letters=$as_cr_letters$as_cr_LETTERS
1779 as_cr_digits='0123456789'
1780 as_cr_alnum=$as_cr_Letters$as_cr_digits
1784 # _AS_TR_SH_PREPARE
1785 # -----------------
1786 m4_defun([_AS_TR_SH_PREPARE],
1787 [AS_REQUIRE([_AS_CR_PREPARE])]dnl
1788 [# Sed expression to map a string onto a valid variable name.
1789 as_tr_sh="eval sed 'y%*+%pp%;s%[[^_$as_cr_alnum]]%_%g'"
1793 # AS_TR_SH(EXPRESSION)
1794 # --------------------
1795 # Transform EXPRESSION into a valid shell variable name.
1796 # sh/m4 polymorphic.
1797 # Be sure to update the definition of `$as_tr_sh' if you change this.
1799 # AS_LITERAL_IF guarantees that a literal does not have any nested quotes,
1800 # once $1 is expanded.  m4_translit silently uses only the first occurrence
1801 # of a character that appears multiple times in argument 2, since we know
1802 # that m4_cr_not_symbols2 also contains [ and ].  m4_translit also silently
1803 # ignores characters in argument 3 that do not match argument 2; we use this
1804 # fact to skip worrying about the length of m4_cr_not_symbols2.
1806 # For speed, we inline the literal definitions that can be computed up front.
1807 m4_defun_init([AS_TR_SH],
1808 [AS_REQUIRE([_$0_PREPARE])],
1809 [_$0(m4_expand([$1]))])
1811 m4_define([_AS_TR_SH],
1812 [_AS_LITERAL_IF([$1], [*][       ][
1813 ])([], [$0_INDIR], [$0_LITERAL])([$1])])
1815 m4_define([_AS_TR_SH_LITERAL],
1816 [m4_translit([[$1]],
1817   [*+[]]]m4_dquote(m4_defn([m4_cr_not_symbols2]))[,
1818   [pp[]]]m4_dquote(m4_for(,1,255,,[[_]]))[)])
1820 m4_define([_AS_TR_SH_INDIR],
1821 [`AS_ECHO(["_AS_ESCAPE([[$1]], [`], [\])"]) | $as_tr_sh`])
1824 # _AS_TR_CPP_PREPARE
1825 # ------------------
1826 m4_defun([_AS_TR_CPP_PREPARE],
1827 [AS_REQUIRE([_AS_CR_PREPARE])]dnl
1828 [# Sed expression to map a string onto a valid CPP name.
1829 as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[[^_$as_cr_alnum]]%_%g'"
1833 # AS_TR_CPP(EXPRESSION)
1834 # ---------------------
1835 # Map EXPRESSION to an upper case string which is valid as rhs for a
1836 # `#define'.  sh/m4 polymorphic.  Be sure to update the definition
1837 # of `$as_tr_cpp' if you change this.
1839 # See implementation comments in AS_TR_SH.
1840 m4_defun_init([AS_TR_CPP],
1841 [AS_REQUIRE([_$0_PREPARE])],
1842 [_$0(m4_expand([$1]))])
1844 m4_define([_AS_TR_CPP],
1845 [_AS_LITERAL_IF([$1], [*][       ][
1846 ])([], [$0_INDIR], [$0_LITERAL])([$1])])
1848 m4_define([_AS_TR_CPP_LITERAL],
1849 [m4_translit([[$1]],
1850   [*[]]]m4_dquote(m4_defn([m4_cr_letters])m4_defn([m4_cr_not_symbols2]))[,
1851   [P[]]]m4_dquote(m4_defn([m4_cr_LETTERS])m4_for(,1,255,,[[_]]))[)])
1853 m4_define([_AS_TR_CPP_INDIR],
1854 [`AS_ECHO(["_AS_ESCAPE([[$1]], [`], [\])"]) | $as_tr_cpp`])
1857 # _AS_TR_PREPARE
1858 # --------------
1859 m4_defun([_AS_TR_PREPARE],
1860 [AS_REQUIRE([_AS_TR_SH_PREPARE])AS_REQUIRE([_AS_TR_CPP_PREPARE])])
1865 ## ------------------------------------------------------ ##
1866 ## 7. Common m4/sh handling of variables (indirections).  ##
1867 ## ------------------------------------------------------ ##
1870 # The purpose of this section is to provide a uniform API for
1871 # reading/setting sh variables with or without indirection.
1872 # Typically, one can write
1873 #   AS_VAR_SET(var, val)
1874 # or
1875 #   AS_VAR_SET(as_$var, val)
1876 # and expect the right thing to happen.  In the descriptions below,
1877 # a literal name matches the regex [a-zA-Z_][a-zA-Z0-9_]*, an
1878 # indirect name is a shell expression that produces a literal name
1879 # when passed through eval, and a polymorphic name is either type.
1882 # _AS_VAR_APPEND_PREPARE
1883 # ----------------------
1884 # Define as_fn_append to the optimum definition for the current
1885 # shell (bash and zsh provide the += assignment operator to avoid
1886 # quadratic append growth over repeated appends).
1887 m4_defun([_AS_VAR_APPEND_PREPARE],
1888 [AS_FUNCTION_DESCRIBE([as_fn_append], [VAR VALUE],
1889 [Append the text in VALUE to the end of the definition contained in
1890 VAR.  Take advantage of any shell optimizations that allow amortized
1891 linear growth over repeated appends, instead of the typical quadratic
1892 growth present in naive implementations.])
1893 AS_IF([_AS_RUN(["AS_ESCAPE(m4_quote(_AS_VAR_APPEND_WORKS))"])],
1894 [eval 'as_fn_append ()
1895   {
1896     eval $[]1+=\$[]2
1897   }'],
1898 [as_fn_append ()
1899   {
1900     eval $[]1=\$$[]1\$[]2
1901   }]) # as_fn_append
1904 # _AS_VAR_APPEND_WORKS
1905 # --------------------
1906 # Output a shell test to discover whether += works.
1907 m4_define([_AS_VAR_APPEND_WORKS],
1908 [as_var=1; as_var+=2; test x$as_var = x12])
1910 # AS_VAR_APPEND(VAR, VALUE)
1911 # -------------------------
1912 # Append the shell expansion of VALUE to the end of the existing
1913 # contents of the polymorphic shell variable VAR, taking advantage of
1914 # any shell optimizations that allow repeated appends to result in
1915 # amortized linear scaling rather than quadratic behavior.  This macro
1916 # is not worth the overhead unless the expected final size of the
1917 # contents of VAR outweigh the typical VALUE size of repeated appends.
1918 # Note that unlike AS_VAR_SET, VALUE must be properly quoted to avoid
1919 # field splitting and file name expansion.
1920 m4_defun_init([AS_VAR_APPEND],
1921 [AS_REQUIRE([_AS_VAR_APPEND_PREPARE], [], [M4SH-INIT-FN])],
1922 [as_fn_append $1 $2])
1925 # _AS_VAR_ARITH_PREPARE
1926 # ---------------------
1927 # Define as_fn_arith to the optimum definition for the current
1928 # shell (using POSIX $(()) where supported).
1929 m4_defun([_AS_VAR_ARITH_PREPARE],
1930 [AS_FUNCTION_DESCRIBE([as_fn_arith], [ARG...],
1931 [Perform arithmetic evaluation on the ARGs, and store the result in
1932 the global $as_val.  Take advantage of shells that can avoid forks.
1933 The arguments must be portable across $(()) and expr.])
1934 AS_IF([_AS_RUN(["AS_ESCAPE(m4_quote(_AS_VAR_ARITH_WORKS))"])],
1935 [eval 'as_fn_arith ()
1936   {
1937     as_val=$(( $[]* ))
1938   }'],
1939 [as_fn_arith ()
1940   {
1941     as_val=`expr "$[]@" || test $? -eq 1`
1942   }]) # as_fn_arith
1945 # _AS_VAR_ARITH_WORKS
1946 # -------------------
1947 # Output a shell test to discover whether $(()) works.
1948 m4_define([_AS_VAR_ARITH_WORKS],
1949 [test $(( 1 + 1 )) = 2])
1951 # AS_VAR_ARITH(VAR, EXPR)
1952 # -----------------------
1953 # Perform the arithmetic evaluation of the arguments in EXPR, and set
1954 # contents of the polymorphic shell variable VAR to the result, taking
1955 # advantage of any shell optimizations that perform arithmetic without
1956 # forks.  Note that numbers occuring within EXPR must be written in
1957 # decimal, and without leading zeroes; variables containing numbers
1958 # must be expanded prior to arithmetic evaluation; the first argument
1959 # must not be a negative number; there is no portable equality
1960 # operator; and operators must be given as separate arguments and
1961 # properly quoted.
1962 m4_defun_init([AS_VAR_ARITH],
1963 [_AS_DETECT_SUGGESTED([_AS_VAR_ARITH_WORKS])]dnl
1964 [AS_REQUIRE([_AS_VAR_ARITH_PREPARE], [], [M4SH-INIT-FN])],
1965 [as_fn_arith $2 && AS_VAR_SET([$1], [$as_val])])
1968 # AS_VAR_COPY(DEST, SOURCE)
1969 # -------------------------
1970 # Set the polymorphic shell variable DEST to the contents of the polymorphic
1971 # shell variable SOURCE.
1972 m4_define([AS_VAR_COPY],
1973 [AS_LITERAL_WORD_IF([$1[]$2], [$1=$$2], [eval $1=\$$2])])
1976 # AS_VAR_GET(VARIABLE)
1977 # --------------------
1978 # Get the value of the shell VARIABLE.
1979 # Evaluates to $VARIABLE if there is no indirection in VARIABLE,
1980 # else to the appropriate `eval' sequence.
1981 # This macro is deprecated because it sometimes mishandles trailing newlines;
1982 # use AS_VAR_COPY instead.
1983 m4_define([AS_VAR_GET],
1984 [AS_LITERAL_WORD_IF([$1],
1985                [$$1],
1986   [`eval 'as_val=${'_AS_ESCAPE([[$1]], [`], [\])'};AS_ECHO(["$as_val"])'`])])
1989 # AS_VAR_IF(VARIABLE, VALUE, IF-TRUE, IF-FALSE)
1990 # ---------------------------------------------
1991 # Implement a shell `if test $VARIABLE = VALUE; then-else'.
1992 # Polymorphic, and avoids sh expansion error upon interrupt or term signal.
1993 m4_define([AS_VAR_IF],
1994 [AS_LITERAL_WORD_IF([$1],
1995   [AS_IF(m4_ifval([$2], [[test "x$$1" = x[]$2]], [[${$1:+false} :]])],
1996   [AS_VAR_COPY([as_val], [$1])
1997    AS_IF(m4_ifval([$2], [[test "x$as_val" = x[]$2]], [[${as_val:+false} :]])],
1998   [AS_IF(m4_ifval([$2],
1999     [[eval test \"x\$"$1"\" = x"_AS_ESCAPE([$2], [`], [\"$])"]],
2000     [[eval \${$1:+false} :]])]),
2001 [$3], [$4])])
2004 # AS_VAR_PUSHDEF and AS_VAR_POPDEF
2005 # --------------------------------
2008 # Sometimes we may have to handle literals (e.g. `stdlib.h'), while at
2009 # other moments, the same code may have to get the value from a
2010 # variable (e.g., `ac_header').  To have a uniform handling of both
2011 # cases, when a new value is about to be processed, declare a local
2012 # variable, e.g.:
2014 #   AS_VAR_PUSHDEF([header], [ac_cv_header_$1])
2016 # and then in the body of the macro, use `header' as is.  It is of
2017 # first importance to use `AS_VAR_*' to access this variable.
2019 # If the value `$1' was a literal (e.g. `stdlib.h'), then `header' is
2020 # in fact the value `ac_cv_header_stdlib_h'.  If `$1' was indirect,
2021 # then `header's value in m4 is in fact `$as_header', the shell
2022 # variable that holds all of the magic to get the expansion right.
2024 # At the end of the block, free the variable with
2026 #   AS_VAR_POPDEF([header])
2029 # AS_VAR_POPDEF(VARNAME)
2030 # ----------------------
2031 # Free the shell variable accessor VARNAME.  To be dnl'ed.
2032 m4_define([AS_VAR_POPDEF],
2033 [m4_popdef([$1])])
2036 # AS_VAR_PUSHDEF(VARNAME, VALUE)
2037 # ------------------------------
2038 # Define the m4 macro VARNAME to an accessor to the shell variable
2039 # named VALUE.  VALUE does not need to be a valid shell variable name:
2040 # the transliteration is handled here.  To be dnl'ed.
2042 # AS_TR_SH attempts to play with diversions if _AS_TR_SH_PREPARE has
2043 # not been expanded.  However, users are expected to do subsequent
2044 # calls that trigger AS_LITERAL_IF([VARNAME]), and that macro performs
2045 # expansion inside an argument collection context, where diversions
2046 # don't work.  Therefore, we must require the preparation ourselves.
2047 m4_defun_init([AS_VAR_PUSHDEF],
2048 [AS_REQUIRE([_AS_TR_SH_PREPARE])],
2049 [_$0([$1], m4_expand([$2]))])
2051 m4_define([_AS_VAR_PUSHDEF],
2052 [_AS_LITERAL_IF([$2], [  ][
2053 ])([], [as_$1=_AS_TR_SH_INDIR([$2])
2054 m4_pushdef([$1], [$as_[$1]])],
2055 [m4_pushdef([$1], [_AS_TR_SH_LITERAL([$2])])])])
2058 # AS_VAR_SET(VARIABLE, VALUE)
2059 # ---------------------------
2060 # Set the contents of the polymorphic shell VARIABLE to the shell
2061 # expansion of VALUE.  VALUE is immune to field splitting and file
2062 # name expansion.
2063 m4_define([AS_VAR_SET],
2064 [AS_LITERAL_WORD_IF([$1],
2065                [$1=$2],
2066                [eval "$1=_AS_ESCAPE([$2], [`], [\"$])"])])
2069 # AS_VAR_SET_IF(VARIABLE, IF-TRUE, IF-FALSE)
2070 # ------------------------------------------
2071 # Implement a shell `if-then-else' depending whether VARIABLE is set
2072 # or not.  Polymorphic.
2073 m4_define([AS_VAR_SET_IF],
2074 [AS_IF([AS_VAR_TEST_SET([$1])], [$2], [$3])])
2077 # AS_VAR_TEST_SET(VARIABLE)
2078 # -------------------------
2079 # Expands into an expression which is true if VARIABLE
2080 # is set.  Polymorphic.
2081 m4_define([AS_VAR_TEST_SET],
2082 [AS_LITERAL_WORD_IF([$1],
2083   [${$1+:} false],
2084   [{ as_var=$1; eval \${$as_var+:} false; }],
2085   [eval \${$1+:} false])])
2088 ## -------------------- ##
2089 ## 8. Setting M4sh up.  ##
2090 ## -------------------- ##
2093 # AS_INIT_GENERATED(FILE, [COMMENT])
2094 # ----------------------------------
2095 # Generate a child script FILE with all initialization necessary to
2096 # reuse the environment learned by the parent script, and make the
2097 # file executable.  If COMMENT is supplied, it is inserted after the
2098 # `#!' sequence but before initialization text begins.  After this
2099 # macro, additional text can be appended to FILE to form the body of
2100 # the child script.  The macro ends with non-zero status if the
2101 # file could not be fully written (such as if the disk is full).
2102 m4_defun([AS_INIT_GENERATED],
2103 [m4_require([AS_PREPARE])]dnl
2104 [m4_pushdef([AS_MESSAGE_LOG_FD])]dnl
2105 [as_write_fail=0
2106 cat >$1 <<_ASEOF || as_write_fail=1
2107 #! $SHELL
2108 # Generated by $as_me.
2110 SHELL=\${CONFIG_SHELL-$SHELL}
2111 export SHELL
2112 _ASEOF
2113 cat >>$1 <<\_ASEOF || as_write_fail=1
2114 _AS_SHELL_SANITIZE
2115 _AS_PREPARE
2116 m4_if(AS_MESSAGE_FD, [1], [], [exec AS_MESSAGE_FD>&1
2117 ])]dnl
2118 [m4_text_box([Main body of $1 script.])
2119 _ASEOF
2120 test $as_write_fail = 0 && chmod +x $1[]dnl
2121 _m4_popdef([AS_MESSAGE_LOG_FD])])# AS_INIT_GENERATED
2124 # AS_INIT
2125 # -------
2126 # Initialize m4sh.
2127 m4_define([AS_INIT],
2128 [# Wrap our cleanup prior to m4sugar's cleanup.
2129 m4_wrap([_AS_CLEANUP])
2130 m4_init
2131 m4_provide([AS_INIT])
2133 # Forbidden tokens and exceptions.
2134 m4_pattern_forbid([^_?AS_])
2136 # Bangshe and minimal initialization.
2137 m4_divert_text([BINSH], [@%:@! /bin/sh])
2138 m4_divert_text([HEADER-COMMENT],
2139                [@%:@ Generated from __file__ by m4_PACKAGE_STRING.])
2140 m4_divert_text([M4SH-SANITIZE], [_AS_SHELL_SANITIZE])
2141 m4_divert_text([M4SH-INIT-FN], [m4_text_box([M4sh Shell Functions.])])
2143 # Let's go!
2144 m4_divert([BODY])dnl
2145 m4_text_box([Main body of script.])
2146 _AS_DETECT_REQUIRED([_AS_SHELL_FN_WORK])dnl
2147 AS_REQUIRE([_AS_UNSET_PREPARE], [], [M4SH-INIT-FN])dnl