Sort AS_VAR_* interfaces.
[autoconf.git] / lib / m4sugar / m4sh.m4
blobd0b1b8c4f3cffd9a458d09c05a4c897dcbeccc7c
1 # This file is part of Autoconf.                          -*- Autoconf -*-
2 # M4 sugar for common shell constructs.
3 # Requires GNU M4 and M4sugar.
5 # Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
6 # Free Software Foundation, Inc.
8 # This program is free software: you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2, or (at your option)
11 # any later version.
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 # 02110-1301, USA.
23 # As a special exception, the Free Software Foundation gives unlimited
24 # permission to copy, distribute and modify the configure scripts that
25 # are the output of Autoconf.  You need not follow the terms of the GNU
26 # General Public License when using or distributing such scripts, even
27 # though portions of the text of Autoconf appear in them.  The GNU
28 # General Public License (GPL) does govern all other use of the material
29 # that constitutes the Autoconf program.
31 # Certain portions of the Autoconf source text are designed to be copied
32 # (in certain cases, depending on the input) into the output of
33 # Autoconf.  We call these the "data" portions.  The rest of the Autoconf
34 # source text consists of comments plus executable code that decides which
35 # of the data portions to output in any given case.  We call these
36 # comments and executable code the "non-data" portions.  Autoconf never
37 # copies any of the non-data portions into its output.
39 # This special exception to the GPL applies to versions of Autoconf
40 # released by the Free Software Foundation.  When you make and
41 # distribute a modified version of Autoconf, you may extend this special
42 # exception to the GPL to apply to your modified version as well, *unless*
43 # your modified version has the potential to copy into its output some
44 # of the text that was the non-data portion of the version that you started
45 # with.  (In other words, unless your change moves or copies text from
46 # the non-data portions to the data portions.)  If your modification has
47 # such potential, you must delete any notice of this special exception
48 # to the GPL from your modified version.
50 # Written by Akim Demaille, Pavel Roskin, Alexandre Oliva, Lars J. Aas
51 # and many other people.
54 # We heavily use m4's diversions both for the initializations and for
55 # required macros, because in both cases we have to issue soon in
56 # output something which is discovered late.
59 # KILL is only used to suppress output.
61 # - BINSH
62 #   AC_REQUIRE'd #! /bin/sh line
63 # - HEADER-REVISION
64 #   RCS keywords etc.
65 # - HEADER-COMMENT
66 #   Purpose of the script etc.
67 # - HEADER-COPYRIGHT
68 #   Copyright notice(s)
69 # - M4SH-SANITIZE
70 #   M4sh's shell setup
71 # - M4SH-INIT-FN
72 #   M4sh initialization (shell functions)
73 # - M4SH-INIT
74 #   M4sh initialization (detection code)
75 # - BODY
76 #   The body of the script.
79 # _m4_divert(DIVERSION-NAME)
80 # --------------------------
81 # Convert a diversion name into its number.  Otherwise, return
82 # DIVERSION-NAME which is supposed to be an actual diversion number.
83 # Of course it would be nicer to use m4_case here, instead of zillions
84 # of little macros, but it then takes twice longer to run `autoconf'!
85 m4_define([_m4_divert(BINSH)],             0)
86 m4_define([_m4_divert(HEADER-REVISION)],   1)
87 m4_define([_m4_divert(HEADER-COMMENT)],    2)
88 m4_define([_m4_divert(HEADER-COPYRIGHT)],  3)
89 m4_define([_m4_divert(M4SH-SANITIZE)],     4)
90 m4_define([_m4_divert(M4SH-INIT-FN)],      5)
91 m4_define([_m4_divert(M4SH-INIT)],         6)
92 m4_define([_m4_divert(BODY)],           1000)
94 # Aaarg.  Yet it starts with compatibility issues...  Libtool wants to
95 # use NOTICE to insert its own LIBTOOL-INIT stuff.  People should ask
96 # before diving into our internals :(
97 m4_copy([_m4_divert(M4SH-INIT)], [_m4_divert(NOTICE)])
101 ## ------------------------- ##
102 ## 1. Sanitizing the shell.  ##
103 ## ------------------------- ##
104 # Please maintain lexicographic sorting of this section, ignoring leading _.
106 # AS_BOURNE_COMPATIBLE
107 # --------------------
108 # Try to be as Bourne and/or POSIX as possible.
110 # This does not set BIN_SH, due to the problems described in
111 # <http://lists.gnu.org/archive/html/autoconf-patches/2006-03/msg00081.html>.
112 # People who need BIN_SH should set it in their environment before invoking
113 # configure; apparently this would include UnixWare, as described in
114 # <http://lists.gnu.org/archive/html/bug-autoconf/2006-06/msg00025.html>.
115 m4_define([AS_BOURNE_COMPATIBLE],
116 [# Be more Bourne compatible
117 DUALCASE=1; export DUALCASE # for MKS sh
121 # _AS_BOURNE_COMPATIBLE
122 # ---------------------
123 # This is the part of AS_BOURNE_COMPATIBLE which has to be repeated inside
124 # each instance.
125 m4_define([_AS_BOURNE_COMPATIBLE],
126 [AS_IF([test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1],
127  [emulate sh
128   NULLCMD=:
129   [#] Pre-4.2 versions of Zsh do word splitting on ${1+"$[@]"}, which
130   # is contrary to our usage.  Disable this feature.
131   alias -g '${1+"$[@]"}'='"$[@]"'
132   setopt NO_GLOB_SUBST],
133  [AS_CASE([`(set -o) 2>/dev/null`], [*posix*], [set -o posix])])
137 # _AS_CLEANUP
138 # -----------
139 # Expanded as the last thing before m4sugar cleanup begins.  Macros
140 # may append m4sh cleanup hooks to this as appropriate.
141 m4_define([_AS_CLEANUP],
142 [m4_divert_text([M4SH-SANITIZE], [_AS_DETECT_BETTER_SHELL])])
145 # AS_COPYRIGHT(TEXT)
146 # ------------------
147 # Emit TEXT, a copyright notice, as a shell comment near the top of the
148 # script.  TEXT is evaluated once; to accomplish that, we do not prepend
149 # `# ' but `@%:@ '.
150 m4_define([AS_COPYRIGHT],
151 [m4_divert_text([HEADER-COPYRIGHT],
152 [m4_bpatsubst([
153 $1], [^], [@%:@ ])])])
156 # _AS_DETECT_REQUIRED(TEST)
157 # -------------------------
158 # Refuse to execute under a shell that does not pass the given TEST.
159 # Does not do AS_REQUIRE for the better-shell detection code.
160 m4_defun([_AS_DETECT_REQUIRED],
161 [m4_set_add([_AS_DETECT_REQUIRED_BODY],
162            [($1) || AS_EXIT(1)
163 ])])
166 # _AS_DETECT_SUGGESTED(TEST)
167 # --------------------------
168 # Prefer to execute under a shell that passes the given TEST.
169 # Does not do AS_REQUIRE for the better-shell detection code.
170 m4_defun([_AS_DETECT_SUGGESTED],
171 [m4_set_add([_AS_DETECT_SUGGESTED_BODY],
172            [($1) || AS_EXIT(1)
173 ])])
176 # _AS_DETECT_BETTER_SHELL
177 # -----------------------
178 # The real workhorse for detecting a shell with the correct
179 # features.
181 # In previous versions, we prepended /usr/posix/bin to the path, but that
182 # caused a regression on OpenServer 6.0.0
183 # <http://lists.gnu.org/archive/html/bug-autoconf/2006-06/msg00017.html>
184 # and on HP-UX 11.11, see the failure of test 120 in
185 # <http://lists.gnu.org/archive/html/bug-autoconf/2006-10/msg00003.html>
187 # FIXME: The code should test for the OSF bug described in
188 # <http://lists.gnu.org/archive/html/autoconf-patches/2006-03/msg00081.html>.
190 m4_defun([_AS_DETECT_BETTER_SHELL],
191 [if test "x$CONFIG_SHELL" = x; then
192 dnl Remove any tests from suggested that are also required
193   m4_set_foreach([_AS_DETECT_SUGGESTED_BODY], [AS_snippet],
194                  [m4_set_contains([_AS_DETECT_REQUIRED_BODY],
195                                   _m4_defn([AS_snippet]),
196                                   [m4_set_remove([_AS_DETECT_SUGGESTED_BODY],
197                                                  _m4_defn([AS_snippet]))])])dnl
198   m4_set_empty([_AS_DETECT_REQUIRED_BODY], [as_have_required=yes],
199     [as_bourne_compatible="AS_ESCAPE(m4_expand([_AS_BOURNE_COMPATIBLE]))"
200     as_required="AS_ESCAPE(m4_expand(m4_set_contents([_AS_DETECT_REQUIRED_BODY])))"
201     as_suggested="AS_ESCAPE(m4_expand(m4_set_contents([_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_candidate_shells=
208     _AS_PATH_WALK([/bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH],
209       [case $as_dir in
210          /*)
211            for as_base in sh bash ksh sh5; do
212              as_candidate_shells="$as_candidate_shells $as_dir/$as_base"
213            done;;
214        esac])
216       for as_shell in $as_candidate_shells $SHELL; do
217          # Try only shells that exist, to save several forks.
218          AS_IF([{ test -f "$as_shell" || test -f "$as_shell.exe"; } &&
219                 _AS_RUN(["$as_required"], ["$as_shell"])],
220                [CONFIG_SHELL=$as_shell
221                as_have_required=yes
222                m4_set_empty([_AS_DETECT_SUGGESTED_BODY], [break],
223                  [AS_IF([_AS_RUN(["$as_suggested"], ["$as_shell"])], [break])])])
224       done
226       AS_IF([test "x$CONFIG_SHELL" != x],
227         [# We cannot yet assume a decent shell, so we have to provide a
228         # neutralization value for shells without unset; and this also
229         # works around shells that cannot unset nonexistent variables.
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         exec "$CONFIG_SHELL" "$as_myself" ${1+"$[@]"}])
236     AS_IF([test x$as_have_required = xno],
237       [echo This script requires a shell more modern than all the
238       echo shells that I found on your system.  Please install a
239       echo modern shell, or manually run the script under such a
240       echo shell if you do have one.
241       AS_EXIT(1)])
242     ])
244 ])# _AS_DETECT_BETTER_SHELL
247 # _AS_PREPARE
248 # -----------
249 # This macro has a very special status.  Normal use of M4sh relies
250 # heavily on AS_REQUIRE, so that needed initializations (such as
251 # _AS_TEST_PREPARE) are performed on need, not on demand.  But
252 # Autoconf is the first client of M4sh, and for two reasons: configure
253 # and config.status.  Relying on AS_REQUIRE is of course fine for
254 # configure, but fails for config.status (which is created by
255 # configure).  So we need a means to force the inclusion of the
256 # various _AS_PREPARE_* on top of config.status.  That's basically why
257 # there are so many _AS_PREPARE_* below, and that's also why it is
258 # important not to forget some: config.status needs them.
259 m4_defun([_AS_PREPARE],
260 [m4_pushdef([AS_REQUIRE], [])dnl
261 AS_FUNCTION_DESCRIBE([as_func_mkdir_p], [],
262 [Create "$as_dir" as a directory, including parents if necessary.])
263 as_func_mkdir_p ()
265   _AS_MKDIR_P
268 _AS_EXPR_PREPARE
269 _AS_BASENAME_PREPARE
270 _AS_DIRNAME_PREPARE
271 _AS_ME_PREPARE
272 _AS_LINENO_PREPARE
273 _AS_ECHO_N_PREPARE[]dnl We do not need this ourselves but user code might.
274 _AS_LN_S_PREPARE
275 _AS_MKDIR_P_PREPARE
276 _AS_TEST_PREPARE
277 _AS_TR_CPP_PREPARE
278 _AS_TR_SH_PREPARE
279 _AS_UNSET_PREPARE
280 m4_popdef([AS_REQUIRE])dnl
283 # AS_PREPARE
284 # ----------
285 # Output all the M4sh possible initialization into the initialization
286 # diversion.  We do not use _AS_PREPARE so that the m4_provide symbols for
287 # AS_REQUIRE and AS_REQUIRE_SHELL_FN are defined properly, and so that
288 # shell functions are placed in M4SH-INIT-FN.
289 m4_defun([AS_PREPARE],
290 [AS_REQUIRE([_AS_EXPR_PREPARE])
291 AS_REQUIRE([_AS_BASENAME_PREPARE])
292 AS_REQUIRE([_AS_DIRNAME_PREPARE])
293 AS_REQUIRE([_AS_ME_PREPARE])
294 AS_REQUIRE([_AS_LINENO_PREPARE])
295 AS_REQUIRE([_AS_ECHO_N_PREPARE])
296 AS_REQUIRE([_AS_LN_S_PREPARE])
297 AS_REQUIRE([_AS_MKDIR_P_PREPARE])
298 AS_REQUIRE([_AS_TEST_PREPARE])
299 AS_REQUIRE([_AS_TR_CPP_PREPARE])
300 AS_REQUIRE([_AS_TR_SH_PREPARE])
301 AS_REQUIRE([_AS_UNSET_PREPARE])
305 # AS_REQUIRE(NAME-TO-CHECK, [BODY-TO-EXPAND = NAME-TO-CHECK],
306 #            [DIVERSION = M4SH-INIT])
307 # -----------------------------------------------------------
308 # BODY-TO-EXPAND is some initialization which must be expanded in the
309 # given diversion when expanded (required or not).  The expansion
310 # goes in the named diversion or an earlier one.
312 m4_defun([AS_REQUIRE],
313 [m4_define([_m4_divert_desired], [m4_default_quoted([$3], [M4SH-INIT])])dnl
314 m4_if(m4_eval(_m4_divert(_m4_divert_dump) <= _m4_divert(_m4_divert_desired)), 1,
315       [m4_require([$1], [$2])],
316       [m4_divert_require([_m4_divert_desired], [$1], [$2])])])
319 # AS_REQUIRE_SHELL_FN(NAME-TO-CHECK, COMMENT, BODY-TO-EXPAND,
320 #                     [DIVERSION = M4SH-INIT-FN])
321 # -----------------------------------------------------------
322 # BODY-TO-EXPAND is the body of a shell function to be emitted in the
323 # given diversion when expanded (required or not).  Unlike other
324 # xx_REQUIRE macros, BODY-TO-EXPAND is mandatory.  If COMMENT is
325 # provided (often via AS_FUNCTION_DESCRIBE), it is listed with a
326 # newline before the function name.
327 m4_define([AS_REQUIRE_SHELL_FN],
328 [AS_REQUIRE([AS_SHELL_FN_$1],
329 [m4_provide([AS_SHELL_FN_$1])m4_n([$2])$1 ()
332 } [#] $1
333 ], m4_default_quoted([$4], [M4SH-INIT-FN]))])
336 # _AS_RUN(TEST, [SHELL])
337 # ----------------------
338 # Run TEST under the current shell (if one parameter is used)
339 # or under the given SHELL, protecting it from syntax errors.
340 m4_define([_AS_RUN],
341 [m4_ifval([$2], [{ $as_echo "$as_bourne_compatible"$1 | ($2); }],
342                 [(eval $1)]) 2>/dev/null])
345 # _AS_SHELL_FN_WORK
346 # -----------------
347 # This is a spy to detect "in the wild" shells that do not support shell
348 # functions correctly.  It is based on the m4sh.at Autotest testcases.
349 m4_define([_AS_SHELL_FN_WORK],
350 [as_func_return ()
352   (exit [$]1)
354 as_func_success ()
356   as_func_return 0
358 as_func_failure ()
360   as_func_return 1
362 as_func_ret_success ()
364   return 0
366 as_func_ret_failure ()
368   return 1
371 exitcode=0
372 AS_IF([as_func_success], [],
373   [exitcode=1
374   echo as_func_success failed.])
375 AS_IF([as_func_failure],
376   [exitcode=1
377   echo as_func_failure succeeded.])
378 AS_IF([as_func_ret_success], [],
379   [exitcode=1
380   echo as_func_ret_success failed.])
381 AS_IF([as_func_ret_failure],
382   [exitcode=1
383   echo as_func_ret_failure succeeded.])
384 AS_IF([( set x; as_func_ret_success y && test x = "[$]1" )], [],
385   [exitcode=1
386   echo positional parameters were not saved.])
387 test x$exitcode = x0[]dnl
388 ])# _AS_SHELL_FN_WORK
391 # _AS_SHELL_SANITIZE
392 # ------------------
393 # This is the prolog that is emitted by AS_INIT and AS_INIT_GENERATED.
394 m4_defun([_AS_SHELL_SANITIZE],
395 [## --------------------- ##
396 ## M4sh Initialization.  ##
397 ## --------------------- ##
399 AS_BOURNE_COMPATIBLE
401 # PATH needs CR
402 _AS_CR_PREPARE
403 _AS_ECHO_PREPARE
404 _AS_PATH_SEPARATOR_PREPARE
406 # IFS
407 # We need space, tab and new line, in precisely that order.  Quoting is
408 # there to prevent editors from complaining about space-tab.
409 # (If _AS_PATH_WALK were called with IFS unset, it would disable word
410 # splitting by setting IFS to empty value.)
411 IFS=" ""        $as_nl"
413 # Find who we are.  Look in the path if we contain no directory separator.
414 case $[0] in
415   *[[\\/]]* ) as_myself=$[0] ;;
416   *) _AS_PATH_WALK([],
417                    [test -r "$as_dir/$[0]" && as_myself=$as_dir/$[0] && break])
418      ;;
419 esac
420 # We did not find ourselves, most probably we were run as `sh COMMAND'
421 # in which case we are not to be found in the path.
422 if test "x$as_myself" = x; then
423   as_myself=$[0]
425 if test ! -f "$as_myself"; then
426   AS_ECHO(["$as_myself: error: cannot find myself; rerun with an absolute file name"]) >&2
427   AS_EXIT
430 # Unset variables that we do not need and which cause bugs (e.g. in
431 # pre-3.0 UWIN ksh).  But do not cause bugs in bash 2.01; the "|| exit 1"
432 # suppresses any "Segmentation fault" message there.  '((' could
433 # trigger a bug in pdksh 5.2.14.
434 for as_var in BASH_ENV ENV MAIL MAILPATH
435 do eval test x\${$as_var+set} = xset && dnl
436  ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
437 done
438 PS1='$ '
439 PS2='> '
440 PS4='+ '
442 # NLS nuisances.
443 LC_ALL=C
444 export LC_ALL
445 LANGUAGE=C
446 export LANGUAGE
448 # CDPATH.
449 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
450 ])# _AS_SHELL_SANITIZE
453 # AS_SHELL_SANITIZE
454 # -----------------
455 # This is only needed for the sake of Libtool, which screws up royally
456 # in its usage of M4sh internals.
457 m4_define([AS_SHELL_SANITIZE],
458 [_AS_SHELL_SANITIZE
459 m4_provide_if([AS_INIT], [],
460 [m4_provide([AS_INIT])
461 _AS_DETECT_REQUIRED([_AS_SHELL_FN_WORK])
462 _AS_DETECT_BETTER_SHELL
463 _AS_UNSET_PREPARE
464 ])])
467 ## ----------------------------- ##
468 ## 2. Wrappers around builtins.  ##
469 ## ----------------------------- ##
471 # This section is lexicographically sorted.
474 # AS_CASE(WORD, [PATTERN1], [IF-MATCHED1]...[DEFAULT])
475 # ----------------------------------------------------
476 # Expand into
477 # | case WORD in
478 # | PATTERN1) IF-MATCHED1 ;;
479 # | ...
480 # | *) DEFAULT ;;
481 # | esac
482 m4_define([_AS_CASE],
483 [  $1[)] m4_default([$2], [:]) ;;
485 m4_define([_AS_CASE_DEFAULT],
486 [  *[)] $1 ;;
488 m4_defun([AS_CASE],
489 [m4_ifval([$2$3],
490 [case $1 in
491 m4_transform_pair([_$0], [_$0_DEFAULT], m4_shift($@))dnl
492 esac
493 ])dnl
494 ])# AS_CASE
497 # AS_EXIT([EXIT-CODE = 1])
498 # ------------------------
499 # Exit and set exit code to EXIT-CODE in the way that it's seen
500 # within "trap 0".
502 # We cannot simply use "exit N" because some shells (zsh and Solaris sh)
503 # will not set $? to N while running the code set by "trap 0"
504 # So we set $? by executing "exit N" in the subshell and then exit.
505 # Other shells don't use `$?' as default for `exit', hence just repeating
506 # the exit value can only help improving portability.
507 m4_define([AS_EXIT],
508 [{ (exit m4_default([$1], 1)); exit m4_default([$1], 1); }])
511 # AS_IF(TEST1, [IF-TRUE1]...[IF-FALSE])
512 # -------------------------------------
513 # Expand into
514 # | if TEST1; then
515 # |   IF-TRUE1
516 # | elif TEST2; then
517 # |   IF-TRUE2
518 # [...]
519 # | else
520 # |   IF-FALSE
521 # | fi
522 # with simplifications if IF-TRUE1 and/or IF-FALSE is empty.
524 m4_define([_AS_IF],
525 [elif $1; then
526   m4_default([$2], [:])
528 m4_define([_AS_IF_ELSE],
529 [m4_ifvaln([$1],
530 [else
531   $1])])
532 m4_defun([AS_IF],
533 [m4_ifval([$2$3],
534 [if $1; then
535   m4_default([$2], [:])
536 m4_transform_pair([_$0], [_$0_ELSE], m4_shift2($@))dnl
538 ])dnl
539 ])# AS_IF
542 # _AS_UNSET_PREPARE
543 # -----------------
544 # Define $as_unset to execute AS_UNSET, for backwards compatibility
545 # with older versions of M4sh.
546 m4_defun([_AS_UNSET_PREPARE],
547 [AS_FUNCTION_DESCRIBE([as_func_unset], [VAR], [Portably unset VAR.])
548 as_func_unset ()
550   AS_UNSET([$[1]])
552 as_unset=as_func_unset
556 # AS_UNSET(VAR)
557 # -------------
558 # Unset the env VAR, working around shells that do not allow unsetting
559 # a variable that is not already set.  You should not unset MAIL and
560 # MAILCHECK, as that triggers a bug in Bash 2.01.
561 m4_defun([AS_UNSET],
562 [{ AS_LITERAL_IF([$1], [], [eval ])$1=; unset $1;}])
569 ## ------------------------------------------ ##
570 ## 3. Error and warnings at the shell level.  ##
571 ## ------------------------------------------ ##
573 # If AS_MESSAGE_LOG_FD is defined, shell messages are duplicated there
574 # too.
577 # AS_ESCAPE(STRING, [CHARS = $"`\])
578 # ---------------------------------
579 # Escape the CHARS in STRING.
581 # Avoid the m4_bpatsubst if there are no interesting characters to escape.
582 # _AS_ESCAPE bypasses argument defaulting.
583 m4_define([AS_ESCAPE],
584 [_$0([$1], m4_default([$2], [\"$`]))])
585 m4_define([_AS_ESCAPE],
586 [m4_if(m4_len([$1]),
587        m4_len(m4_translit([[$1]], [$2])),
588        [$1], [m4_bpatsubst([$1], [[$2]], [\\\&])])])
591 # _AS_QUOTE_IFELSE(STRING, IF-MODERN-QUOTATION, IF-OLD-QUOTATION)
592 # ---------------------------------------------------------------
593 # Compatibility glue between the old AS_MSG suite which did not
594 # quote anything, and the modern suite which quotes the quotes.
595 # If STRING contains `\\' or `\$', it's modern.
596 # If STRING contains `\"' or `\`', it's old.
597 # Otherwise it's modern.
599 # Profiling shows that m4_index is 5 to 8x faster than m4_bregexp.  The
600 # slower implementation used:
601 # m4_bmatch([$1],
602 #           [\\[\\$]], [$2],
603 #           [\\[`"]], [$3],
604 #           [$2])
605 # The current implementation caters to the common case of no backslashes,
606 # to minimize m4_index expansions (hence the nested if).
607 m4_define([_AS_QUOTE_IFELSE],
608 [m4_cond([m4_index([$1], [\])], [-1], [$2],
609          [m4_eval(m4_index([$1], [\\]) >= 0)], [1], [$2],
610          [m4_eval(m4_index([$1], [\$]) >= 0)], [1], [$2],
611          [m4_eval(m4_index([$1], [\`]) >= 0)], [1], [$3],
612          [m4_eval(m4_index([$1], [\"]) >= 0)], [1], [$3],
613          [$2])])
616 # _AS_QUOTE(STRING, [CHARS = `"])
617 # -------------------------------
618 # If there are quoted (via backslash) backquotes do nothing, else
619 # backslash all the quotes.
620 m4_define([_AS_QUOTE],
621 [_AS_QUOTE_IFELSE([$1],
622                   [_AS_ESCAPE([$1], m4_default([$2], [`""]))],
623                   [m4_warn([obsolete],
624            [back quotes and double quotes must not be escaped in: $1])dnl
625 $1])])
628 # _AS_ECHO_UNQUOTED(STRING, [FD = AS_MESSAGE_FD])
629 # -----------------------------------------------
630 # Perform shell expansions on STRING and echo the string to FD.
631 m4_define([_AS_ECHO_UNQUOTED],
632 [AS_ECHO(["$1"]) >&m4_default([$2], [AS_MESSAGE_FD])])
635 # _AS_ECHO(STRING, [FD = AS_MESSAGE_FD])
636 # --------------------------------------
637 # Protect STRING from backquote expansion, echo the result to FD.
638 m4_define([_AS_ECHO],
639 [_AS_ECHO_UNQUOTED([_AS_QUOTE([$1])], [$2])])
642 # _AS_ECHO_LOG(STRING)
643 # --------------------
644 # Log the string to AS_MESSAGE_LOG_FD.
645 m4_define([_AS_ECHO_LOG],
646 [AS_REQUIRE([_AS_LINENO_PREPARE])dnl
647 _AS_ECHO([$as_me:${as_lineno-$LINENO}: $1], [AS_MESSAGE_LOG_FD])])
650 # _AS_ECHO_N_PREPARE
651 # ------------------
652 # Check whether to use -n, \c, or newline-tab to separate
653 # checking messages from result messages.
654 # Don't try to cache, since the results of this macro are needed to
655 # display the checking message.  In addition, caching something used once
656 # has little interest.
657 # Idea borrowed from dist 3.0.  Use `*c*,', not `*c,' because if `\c'
658 # failed there is also a newline to match.
659 m4_defun([_AS_ECHO_N_PREPARE],
660 [ECHO_C= ECHO_N= ECHO_T=
661 case `echo -n x` in
662 -n*)
663   case `echo 'x\c'` in
664   *c*) ECHO_T=' ';;     # ECHO_T is single tab character.
665   *)   ECHO_C='\c';;
666   esac;;
668   ECHO_N='-n';;
669 esac
670 ])# _AS_ECHO_N_PREPARE
673 # _AS_ECHO_N(STRING, [FD = AS_MESSAGE_FD])
674 # ----------------------------------------
675 # Same as _AS_ECHO, but echo doesn't return to a new line.
676 m4_define([_AS_ECHO_N],
677 [AS_ECHO_N(["_AS_QUOTE([$1])"]) >&m4_default([$2], [AS_MESSAGE_FD])])
680 # AS_MESSAGE(STRING, [FD = AS_MESSAGE_FD])
681 # ----------------------------------------
682 m4_define([AS_MESSAGE],
683 [AS_REQUIRE([_AS_ME_PREPARE])dnl
684 m4_ifset([AS_MESSAGE_LOG_FD],
685           [{ _AS_ECHO_LOG([$1])
686 _AS_ECHO([$as_me: $1], [$2]);}],
687           [_AS_ECHO([$as_me: $1], [$2])])[]dnl
691 # AS_WARN(PROBLEM)
692 # ----------------
693 m4_define([AS_WARN],
694 [AS_MESSAGE([WARNING: $1], [2])])# AS_WARN
697 # AS_ERROR(ERROR, [EXIT-STATUS = 1])
698 # ----------------------------------
699 m4_define([AS_ERROR],
700 [{ AS_MESSAGE([error: $1], [2])
701    AS_EXIT([$2]); }[]dnl
702 ])# AS_ERROR
706 # AS_LINENO_PUSH([LINENO])
707 # ------------------------
708 # If this is the outermost call to AS_LINENO_PUSH, make sure that
709 # AS_MESSAGE will print LINENO as the line number.
710 m4_defun([AS_LINENO_PUSH],
711 [as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack])
714 # AS_LINENO_POP([LINENO])
715 # ------------------------
716 # If this is call balances the outermost call to AS_LINENO_PUSH,
717 # AS_MESSAGE will restart printing $LINENO as the line number.
718 m4_defun([AS_LINENO_POP],
719 [eval $as_lineno_stack; test "x$as_lineno_stack" = x && AS_UNSET([as_lineno])])
723 ## -------------------------------------- ##
724 ## 4. Portable versions of common tools.  ##
725 ## -------------------------------------- ##
727 # This section is lexicographically sorted.
730 # AS_BASENAME(FILE-NAME)
731 # ----------------------
732 # Simulate the command 'basename FILE-NAME'.  Not all systems have basename.
733 # Also see the comments for AS_DIRNAME.
735 m4_defun([_AS_BASENAME_EXPR],
736 [$as_expr X/[]$1 : '.*/\([[^/][^/]*]\)/*$' \| \
737          X[]$1 : 'X\(//\)$' \| \
738          X[]$1 : 'X\(/\)' \| .])
740 m4_defun([_AS_BASENAME_SED],
741 [AS_ECHO([X/[]$1]) |
742     sed ['/^.*\/\([^/][^/]*\)\/*$/{
743             s//\1/
744             q
745           }
746           /^X\/\(\/\/\)$/{
747             s//\1/
748             q
749           }
750           /^X\/\(\/\).*/{
751             s//\1/
752             q
753           }
754           s/.*/./; q']])
756 m4_defun([AS_BASENAME],
757 [AS_REQUIRE([_$0_PREPARE])dnl
758 $as_basename -- $1 ||
759 _AS_BASENAME_EXPR([$1]) 2>/dev/null ||
760 _AS_BASENAME_SED([$1])])
763 # _AS_BASENAME_PREPARE
764 # --------------------
765 # Avoid Solaris 9 /usr/ucb/basename, as `basename /' outputs an empty line.
766 # Also, traditional basename mishandles --.  Require here _AS_EXPR_PREPARE,
767 # to avoid problems when _AS_BASENAME is called from the M4SH-INIT diversion
768 # (AS_REQUIRE is nowhere near being as sophisticated as AC_REQUIRE).
769 m4_defun([_AS_BASENAME_PREPARE],
770 [AS_REQUIRE([_AS_EXPR_PREPARE])dnl
771 if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
772   as_basename=basename
773 else
774   as_basename=false
776 ])# _AS_BASENAME_PREPARE
779 # AS_DIRNAME(FILE-NAME)
780 # ---------------------
781 # Simulate the command 'dirname FILE-NAME'.  Not all systems have dirname.
782 # This macro must be usable from inside ` `.
784 # Prefer expr to echo|sed, since expr is usually faster and it handles
785 # backslashes and newlines correctly.  However, older expr
786 # implementations (e.g. SunOS 4 expr and Solaris 8 /usr/ucb/expr) have
787 # a silly length limit that causes expr to fail if the matched
788 # substring is longer than 120 bytes.  So fall back on echo|sed if
789 # expr fails.
790 m4_defun([_AS_DIRNAME_EXPR],
791 [AS_REQUIRE([_AS_EXPR_PREPARE])dnl
792 $as_expr X[]$1 : 'X\(.*[[^/]]\)//*[[^/][^/]]*/*$' \| \
793          X[]$1 : 'X\(//\)[[^/]]' \| \
794          X[]$1 : 'X\(//\)$' \| \
795          X[]$1 : 'X\(/\)' \| .])
797 m4_defun([_AS_DIRNAME_SED],
798 [AS_ECHO([X[]$1]) |
799     sed ['/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
800             s//\1/
801             q
802           }
803           /^X\(\/\/\)[^/].*/{
804             s//\1/
805             q
806           }
807           /^X\(\/\/\)$/{
808             s//\1/
809             q
810           }
811           /^X\(\/\).*/{
812             s//\1/
813             q
814           }
815           s/.*/./; q']])
817 m4_defun([AS_DIRNAME],
818 [AS_REQUIRE([_$0_PREPARE])dnl
819 $as_dirname -- $1 ||
820 _AS_DIRNAME_EXPR([$1]) 2>/dev/null ||
821 _AS_DIRNAME_SED([$1])])
824 # _AS_DIRNAME_PREPARE
825 # --------------------
826 m4_defun([_AS_DIRNAME_PREPARE],
827 [AS_REQUIRE([_AS_EXPR_PREPARE])dnl
828 if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
829   as_dirname=dirname
830 else
831   as_dirname=false
833 ])# _AS_DIRNAME_PREPARE
836 # AS_ECHO(WORD)
837 # -------------
838 # Output WORD followed by a newline.  WORD must be a single shell word
839 # (typically a quoted string).  The bytes of WORD are output as-is, even
840 # if it starts with "-" or contains "\".
841 m4_defun([AS_ECHO],
842 [AS_REQUIRE([_$0_PREPARE])dnl
843 $as_echo $1])
846 # AS_ECHO_N(WORD)
847 # -------------
848 # Like AS_ECHO(WORD), except do not output the trailing newline.
849 m4_defun([AS_ECHO_N],
850 [AS_REQUIRE([_AS_ECHO_PREPARE])dnl
851 $as_echo_n $1])
854 # _AS_ECHO_PREPARE
855 # -----------------
856 # Arrange for $as_echo 'FOO' to echo FOO without escape-interpretation;
857 # and similarly for $as_echo_foo, which omits the trailing newline.
858 # 'FOO' is an optional single argument; a missing FOO is treated as empty.
859 m4_defun([_AS_ECHO_PREPARE],
860 [[as_nl='
862 export as_nl
863 # Printing a long string crashes Solaris 7 /usr/bin/printf.
864 as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
865 as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
866 as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
867 if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
868   as_echo='printf %s\n'
869   as_echo_n='printf %s'
870 else
871   if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
872     as_echo_body='eval /usr/ucb/echo -n "$][1$as_nl"'
873     as_echo_n='/usr/ucb/echo -n'
874   else
875     as_echo_body='eval expr "X$][1" : "X\\(.*\\)"'
876     as_echo_n_body='eval
877       arg=$][1;
878       case $arg in
879       *"$as_nl"*)
880         expr "X$arg" : "X\\(.*\\)$as_nl";
881         arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
882       esac;
883       expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
884     '
885     export as_echo_n_body
886     as_echo_n='sh -c $as_echo_n_body as_echo'
887   fi
888   export as_echo_body
889   as_echo='sh -c $as_echo_body as_echo'
891 ]])# _AS_ECHO_PREPARE
894 # AS_TEST_X
895 # ---------
896 # Check whether a file has executable or search permissions.
897 m4_defun([AS_TEST_X],
898 [AS_REQUIRE([_AS_TEST_PREPARE])dnl
899 $as_test_x $1[]dnl
900 ])# AS_TEST_X
903 # AS_EXECUTABLE_P
904 # ---------------
905 # Check whether a file is a regular file that has executable permissions.
906 m4_defun([AS_EXECUTABLE_P],
907 [AS_REQUIRE([_AS_TEST_PREPARE])dnl
908 { test -f $1 && AS_TEST_X([$1]); }dnl
909 ])# AS_EXECUTABLE_P
912 # _AS_EXPR_PREPARE
913 # ----------------
914 # QNX 4.25 expr computes and issue the right result but exits with failure.
915 # Tru64 expr mishandles leading zeros in numeric strings.
916 # Detect these flaws.
917 m4_defun([_AS_EXPR_PREPARE],
918 [if expr a : '\(a\)' >/dev/null 2>&1 &&
919    test "X`expr 00001 : '.*\(...\)'`" = X001; then
920   as_expr=expr
921 else
922   as_expr=false
924 ])# _AS_EXPR_PREPARE
927 # _AS_ME_PREPARE
928 # --------------
929 # Define $as_me to the basename of the executable file's name.
930 m4_defun([AS_ME_PREPARE], [AS_REQUIRE([_$0])])
931 m4_defun([_AS_ME_PREPARE],
932 [AS_REQUIRE([_AS_BASENAME_PREPARE])dnl
933 as_me=`AS_BASENAME("$[0]")`
936 # _AS_LINENO_WORKS
937 # ---------------
938 # Succeed if the currently executing shell supports LINENO.
939 # This macro does not expand to a single shell command, so be careful
940 # when using it.  Surrounding the body of this macro with {} would
941 # cause "bash -c '_ASLINENO_WORKS'" to fail (with Bash 2.05, anyway),
942 # but that bug is irrelevant to our use of LINENO.
943 m4_define([_AS_LINENO_WORKS],
945   as_lineno_1=$LINENO
946   as_lineno_2=$LINENO
947   test "x$as_lineno_1" != "x$as_lineno_2" &&
948   test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2"])
951 # _AS_LINENO_PREPARE
952 # ------------------
953 # If LINENO is not supported by the shell, produce a version of this
954 # script where LINENO is hard coded.
955 # Comparing LINENO against _oline_ is not a good solution, since in
956 # the case of embedded executables (such as config.status within
957 # configure) you'd compare LINENO wrt config.status vs. _oline_ wrt
958 # configure.
959 m4_defun([AS_LINENO_PREPARE], [AS_REQUIRE([_$0])])
960 m4_defun([_AS_LINENO_PREPARE],
961 [AS_REQUIRE([_AS_CR_PREPARE])dnl
962 AS_REQUIRE([_AS_ME_PREPARE])dnl
963 _AS_DETECT_SUGGESTED([_AS_LINENO_WORKS])dnl
964 dnl Even if the logging fd is open, we don't want to use $LINENO in the
965 dnl AS_ERROR complaining that LINENO is broken.
966 m4_pushdef([AS_MESSAGE_LOG_FD])dnl
967 _AS_LINENO_WORKS || {
969   dnl Create $as_me.lineno as a copy of $as_myself, but with $LINENO
970   dnl uniformly replaced by the line number.  The first 'sed' inserts a
971   dnl line-number line after each line using $LINENO; the second 'sed'
972   dnl does the real work.  The second script uses 'N' to pair each
973   dnl line-number line with the line containing $LINENO, and appends
974   dnl trailing '-' during substitution so that $LINENO is not a special
975   dnl case at line end.  (Raja R Harinath suggested sed '=', and Paul
976   dnl Eggert wrote the scripts with optimization help from Paolo Bonzini).
977   # Blame Lee E. McMahon (1931-1989) for sed's syntax.  :-)
978   sed -n '
979     p
980     /[[$]]LINENO/=
981   ' <$as_myself |
982     sed '
983       s/[[$]]LINENO.*/&-/
984       t lineno
985       b
986       :lineno
987       N
988       :loop
989       s/[[$]]LINENO\([[^'$as_cr_alnum'_]].*\n\)\(.*\)/\2\1\2/
990       t loop
991       s/-\n.*//
992     ' >$as_me.lineno &&
993   chmod +x "$as_me.lineno" ||
994     AS_ERROR([cannot create $as_me.lineno; rerun with a POSIX shell])
996   # Don't try to exec as it changes $[0], causing all sort of problems
997   # (the dirname of $[0] is not the place where we might find the
998   # original and so on.  Autoconf is especially sensitive to this).
999   . "./$as_me.lineno"
1000   # Exit status is that of the last command.
1001   exit
1003 m4_popdef([AS_MESSAGE_LOG_FD])dnl
1004 ])# _AS_LINENO_PREPARE
1007 # _AS_LN_S_PREPARE
1008 # ----------------
1009 # Don't use conftest.sym to avoid file name issues on DJGPP, where this
1010 # would yield conftest.sym.exe for DJGPP < 2.04.  And don't use `conftest'
1011 # as base name to avoid prohibiting concurrency (e.g., concurrent
1012 # config.statuses).  On read-only media, assume 'cp -p' and hope we
1013 # are just running --help anyway.
1014 m4_defun([_AS_LN_S_PREPARE],
1015 [rm -f conf$$ conf$$.exe conf$$.file
1016 if test -d conf$$.dir; then
1017   rm -f conf$$.dir/conf$$.file
1018 else
1019   rm -f conf$$.dir
1020   mkdir conf$$.dir 2>/dev/null
1022 if (echo >conf$$.file) 2>/dev/null; then
1023   if ln -s conf$$.file conf$$ 2>/dev/null; then
1024     as_ln_s='ln -s'
1025     # ... but there are two gotchas:
1026     # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
1027     # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
1028     # In both cases, we have to default to `cp -p'.
1029     ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
1030       as_ln_s='cp -p'
1031   elif ln conf$$.file conf$$ 2>/dev/null; then
1032     as_ln_s=ln
1033   else
1034     as_ln_s='cp -p'
1035   fi
1036 else
1037   as_ln_s='cp -p'
1039 rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
1040 rmdir conf$$.dir 2>/dev/null
1041 ])# _AS_LN_S_PREPARE
1044 # AS_LN_S(FILE, LINK)
1045 # -------------------
1046 # FIXME: Should we add the glue code to handle properly relative symlinks
1047 # simulated with `ln' or `cp'?
1048 m4_defun([AS_LN_S],
1049 [AS_REQUIRE([_AS_LN_S_PREPARE])dnl
1050 $as_ln_s $1 $2
1054 # _AS_MKDIR_P
1055 # -----------
1056 # Emit code that can be used to emulate `mkdir -p` with plain `mkdir';
1057 # the code assumes that "$as_dir" contains the directory to create.
1058 # $as_dir is normalized, so there is no need to worry about using --.
1059 m4_define([_AS_MKDIR_P],
1060 [case $as_dir in #(
1061   -*) as_dir=./$as_dir;;
1062   esac
1063   test -d "$as_dir" || eval $as_mkdir_p || {
1064     as_dirs=
1065     while :; do
1066       case $as_dir in #(
1067       *\'*) as_qdir=`AS_ECHO(["$as_dir"]) | sed "s/'/'\\\\\\\\''/g"`;; #'(
1068       *) as_qdir=$as_dir;;
1069       esac
1070       as_dirs="'$as_qdir' $as_dirs"
1071       as_dir=`AS_DIRNAME("$as_dir")`
1072       test -d "$as_dir" && break
1073     done
1074     test -z "$as_dirs" || eval "mkdir $as_dirs"
1075   } || test -d "$as_dir" || AS_ERROR([cannot create directory $as_dir])
1078 # AS_MKDIR_P(DIR)
1079 # ---------------
1080 # Emulate `mkdir -p' with plain `mkdir' if needed.
1081 m4_define([AS_MKDIR_P],
1082 [AS_REQUIRE([_$0_PREPARE])dnl
1083 as_dir=$1; as_func_mkdir_p])# AS_MKDIR_P
1086 # _AS_MKDIR_P_PREPARE
1087 # -------------------
1088 m4_defun([_AS_MKDIR_P_PREPARE],
1089 [AS_REQUIRE_SHELL_FN([as_func_mkdir_p],
1090   [AS_FUNCTION_DESCRIBE([as_func_mkdir_p], [],
1091     [Create "$as_dir" as a directory, including parents if necessary.])],
1093   _AS_MKDIR_P
1095 if mkdir -p . 2>/dev/null; then
1096   as_mkdir_p='mkdir -p "$as_dir"'
1097 else
1098   test -d ./-p && rmdir ./-p
1099   as_mkdir_p=false
1101 ])# _AS_MKDIR_P_PREPARE
1104 # _AS_PATH_SEPARATOR_PREPARE
1105 # --------------------------
1106 # Compute the path separator.
1107 m4_defun([_AS_PATH_SEPARATOR_PREPARE],
1108 [# The user is always right.
1109 if test "${PATH_SEPARATOR+set}" != set; then
1110   PATH_SEPARATOR=:
1111   (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
1112     (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
1113       PATH_SEPARATOR=';'
1114   }
1116 ])# _AS_PATH_SEPARATOR_PREPARE
1119 # _AS_PATH_WALK([PATH = $PATH], BODY)
1120 # -----------------------------------
1121 # Walk through PATH running BODY for each `as_dir'.
1123 # Still very private as its interface looks quite bad.
1125 # `$as_dummy' forces splitting on constant user-supplied paths.
1126 # POSIX.2 field splitting is done only on the result of word
1127 # expansions, not on literal text.  This closes a longstanding sh security
1128 # hole.  Optimize it away when not needed, i.e., if there are no literal
1129 # path separators.
1130 m4_define([_AS_PATH_WALK],
1131 [AS_REQUIRE([_AS_PATH_SEPARATOR_PREPARE])dnl
1132 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
1133 m4_bmatch([$1], [[:;]],
1134 [as_dummy="$1"
1135 for as_dir in $as_dummy],
1136 [for as_dir in m4_default([$1], [$PATH])])
1138   IFS=$as_save_IFS
1139   test -z "$as_dir" && as_dir=.
1140   $2
1141 done
1142 IFS=$as_save_IFS
1146 # AS_SET_CATFILE(VAR, DIR-NAME, FILE-NAME)
1147 # ----------------------------------------
1148 # Set VAR to DIR-NAME/FILE-NAME.
1149 # Optimize the common case where $2 or $3 is '.'.
1150 m4_define([AS_SET_CATFILE],
1151 [case $2 in
1152 .) $1=$3;;
1154   case $3 in
1155   .) $1=$2;;
1156   [[\\/]]* | ?:[[\\/]]* ) $1=$3;;
1157   *) $1=$2/$3;;
1158   esac;;
1159 esac[]dnl
1160 ])# AS_SET_CATFILE
1163 # _AS_TEST_PREPARE
1164 # ----------------
1165 # Find out whether `test -x' works.  If not, prepare a substitute
1166 # that should work well enough for most scripts.
1168 # Here are some of the problems with the substitute.
1169 # The 'ls' tests whether the owner, not the current user, can execute/search.
1170 # The eval means '*', '?', and '[' cause inadvertent file name globbing
1171 # after the 'eval', so jam together as many tokens as we can to minimize
1172 # the likelihood that the inadvertent globbing will actually do anything.
1173 # Luckily, this gorp is needed only on really ancient hosts.
1175 m4_defun([_AS_TEST_PREPARE],
1176 [if test -x / >/dev/null 2>&1; then
1177   as_test_x='test -x'
1178 else
1179   if ls -dL / >/dev/null 2>&1; then
1180     as_ls_L_option=L
1181   else
1182     as_ls_L_option=
1183   fi
1184   as_test_x='
1185     eval sh -c '\''
1186       if test -d "$[]1"; then
1187         test -d "$[]1/.";
1188       else
1189         case $[]1 in
1190         -*)set "./$[]1";;
1191         esac;
1192         case `ls -ld'$as_ls_L_option' "$[]1" 2>/dev/null` in
1193         ???[[sx]]*):;;*)false;;esac;fi
1194     '\'' sh
1195   '
1197 dnl as_executable_p is present for backward compatibility with Libtool
1198 dnl 1.5.22, but it should go away at some point.
1199 as_executable_p=$as_test_x
1200 ])# _AS_TEST_PREPARE
1205 ## ------------------ ##
1206 ## 5. Common idioms.  ##
1207 ## ------------------ ##
1209 # This section is lexicographically sorted.
1212 # AS_BOX(MESSAGE, [FRAME-CHARACTER = `-'])
1213 # ----------------------------------------
1214 # Output MESSAGE, a single line text, framed with FRAME-CHARACTER (which
1215 # must not be `/').
1216 m4_define([AS_BOX],
1217 [AS_LITERAL_IF([$1],
1218                [_AS_BOX_LITERAL($@)],
1219                [_AS_BOX_INDIR($@)])])
1222 # _AS_BOX_LITERAL(MESSAGE, [FRAME-CHARACTER = `-'])
1223 # -------------------------------------------------
1224 m4_define([_AS_BOX_LITERAL],
1225 [cat <<\_ASBOX
1226 m4_text_box($@)
1227 _ASBOX])
1230 # _AS_BOX_INDIR(MESSAGE, [FRAME-CHARACTER = `-'])
1231 # -----------------------------------------------
1232 m4_define([_AS_BOX_INDIR],
1233 [sed 'h;s/./m4_default([$2], [-])/g;s/^.../@%:@@%:@ /;s/...$/ @%:@@%:@/;p;x;p;x' <<_ASBOX
1234 @%:@@%:@ $1 @%:@@%:@
1235 _ASBOX])
1238 # AS_FUNCTION_DESCRIBE(NAME, [ARGS], DESCRIPTION, [WRAP-COLUMN = 79])
1239 # -------------------------------------------------------------------
1240 # Output a shell comment describing NAME and its arguments ARGS, then
1241 # a separator line, then the DESCRIPTION wrapped at a decimal
1242 # WRAP-COLUMN.  The output resembles:
1243 #  # NAME ARGS
1244 #  # ---------
1245 #  # Wrapped DESCRIPTION text
1246 # NAME and ARGS are expanded, while DESCRIPTION is treated as a
1247 # whitespace-separated list of strings that are not expanded.
1248 m4_define([AS_FUNCTION_DESCRIBE],
1249 [@%:@ $1[]m4_ifval([$2], [ $2])
1250 @%:@ m4_translit(m4_format([%*s],
1251                    m4_qlen(m4_expand([$1[]m4_ifval([$2], [ $2])])), []),
1252                  [ ], [-])
1253 m4_text_wrap([$3], [@%:@ ], [], [$4])])
1256 # AS_HELP_STRING(LHS, RHS, [INDENT-COLUMN = 26], [WRAP-COLUMN = 79])
1257 # ------------------------------------------------------------------
1259 # Format a help string so that it looks pretty when the user executes
1260 # "script --help".  This macro takes up to four arguments, a
1261 # "left hand side" (LHS), a "right hand side" (RHS), a decimal
1262 # INDENT-COLUMN which is the column where wrapped lines should begin
1263 # (the default of 26 is recommended), and a decimal WRAP-COLUMN which is
1264 # the column where lines should wrap (the default of 79 is recommended).
1265 # LHS is expanded, RHS is not.
1267 # For backwards compatibility not documented in the manual, INDENT-COLUMN
1268 # can also be specified as a string of white spaces, whose width
1269 # determines the indentation column.  Using TABs in INDENT-COLUMN is not
1270 # recommended, since screen width of TAB is not computed.
1272 # The resulting string is suitable for use in other macros that require
1273 # a help string (e.g. AC_ARG_WITH).
1275 # Here is the sample string from the Autoconf manual (Node: External
1276 # Software) which shows the proper spacing for help strings.
1278 #    --with-readline         support fancy command line editing
1279 #  ^ ^                       ^
1280 #  | |                       |
1281 #  | column 2                column 26
1282 #  |
1283 #  column 0
1285 # A help string is made up of a "left hand side" (LHS) and a "right
1286 # hand side" (RHS).  In the example above, the LHS is
1287 # "--with-readline", while the RHS is "support fancy command line
1288 # editing".
1290 # If the LHS contains more than (INDENT-COLUMN - 3) characters, then the
1291 # LHS is terminated with a newline so that the RHS starts on a line of its
1292 # own beginning at INDENT-COLUMN.  In the default case, this corresponds to an
1293 # LHS with more than 23 characters.
1295 # Therefore, in the example, if the LHS were instead
1296 # "--with-readline-blah-blah-blah", then the AS_HELP_STRING macro would
1297 # expand into:
1300 #    --with-readline-blah-blah-blah
1301 #  ^ ^                       support fancy command line editing
1302 #  | |                       ^
1303 #  | column 2                |
1304 #  column 0                  column 26
1307 # m4_text_wrap hacks^Wworks around the fact that m4_format does not
1308 # know quadrigraphs.
1310 m4_define([AS_HELP_STRING],
1311 [m4_text_wrap([$2], m4_cond([[$3]], [], [                          ],
1312                             [m4_eval([$3]+0)], [0], [[$3]],
1313                             [m4_format([[%*s]], [$3], [])]),
1314               m4_expand([  $1 ]), [$4])dnl
1315 ])# AS_HELP_STRING
1318 # AS_IDENTIFIER_IF(EXPRESSION, IF-IDENT, IF-NOT-IDENT)
1319 # ----------------------------------------------------
1320 # If EXPRESSION serves as an identifier (ie, after removal of @&t@, it
1321 # matches the regex `^[a-zA-Z_][a-zA-Z_0-9]*$'), execute IF-IDENT,
1322 # otherwise IF-NOT-IDENT.
1324 # This is generally faster than the alternative:
1325 #   m4_bmatch(m4_bpatsubst([[$1]], [@&t@]), ^m4_defn([m4_re_word])$,
1326 #             [$2], [$3])
1328 # Rather than expand m4_defn every time AS_IDENTIFIER_IF is expanded, we
1329 # inline its expansion up front.  Only use a regular expression if we
1330 # detect a potential quadrigraph.
1332 # First, check if the entire string matches m4_cr_symbol2.  Only then do
1333 # we worry if the first character also matches m4_cr_symbol1 (ie. does not
1334 # match m4_cr_digit).
1335 m4_define([AS_IDENTIFIER_IF],
1336 [m4_if(m4_index([$1], [@]), [-1],
1337        [_$0($@)],
1338        [_$0(m4_bpatsubst([[$1]], [@&t@]), [$2], [$3])])])
1339 m4_define([_AS_IDENTIFIER_IF],
1340 [m4_cond([[$1]], [], [$3],
1341          [m4_eval(m4_len(m4_translit([[$1]], ]]dnl
1342 m4_dquote(m4_dquote(m4_defn([m4_cr_symbols2])))[[)) > 0)], [1], [$3],
1343          [m4_len(m4_translit(m4_format([[%.1s]], [$1]), ]]dnl
1344 m4_dquote(m4_dquote(m4_defn([m4_cr_symbols1])))[[))], [0], [$2], [$3])])
1347 # AS_LITERAL_IF(EXPRESSION, IF-LITERAL, IF-NOT-LITERAL)
1348 # -----------------------------------------------------
1349 # If EXPRESSION has shell indirections ($var or `expr`), expand
1350 # IF-INDIR, else IF-NOT-INDIR.
1351 # This is an *approximation*: for instance EXPRESSION = `\$' is
1352 # definitely a literal, but will not be recognized as such.
1354 # Why do we reject EXPRESSION expanding with `[' or `]' as a literal?
1355 # Because AS_TR_SH is MUCH faster if it can use m4_translit on literals
1356 # instead of m4_bpatsubst; but m4_translit is much tougher to do safely
1357 # if `[' is translated.
1359 # Note that the quadrigraph @S|@ can result in non-literals, but outright
1360 # rejecting all @ would make AC_INIT complain on its bug report address.
1362 # We used to use m4_bmatch(m4_quote($1), [[`$]], [$3], [$2]), but
1363 # profiling shows that it is faster to use m4_translit.
1365 # Because the translit is stripping quotes, it must also neutralize anything
1366 # that might be in a macro name, as well as comments and commas.  All the
1367 # problem characters are unified so that a single m4_index can scan the
1368 # result.
1370 # Rather than expand m4_defn every time AS_LITERAL_IF is expanded, we
1371 # inline its expansion up front.
1372 m4_define([AS_LITERAL_IF],
1373 [m4_cond([m4_eval(m4_index(m4_quote($1), [@S|@]) == -1)], [0], [$3],
1374          [m4_index(m4_translit(m4_quote($1),
1375                                [[]`,#]]]dnl
1376 m4_dquote(m4_dquote(m4_defn([m4_cr_symbols2])))[[,
1377                                [$$$]),
1378                    [$])], [-1], [$2],
1379          [$3])])
1382 # AS_TMPDIR(PREFIX, [DIRECTORY = $TMPDIR [= /tmp]])
1383 # -------------------------------------------------
1384 # Create as safely as possible a temporary directory in DIRECTORY
1385 # which name is inspired by PREFIX (should be 2-4 chars max).
1386 m4_define([AS_TMPDIR],
1387 [AS_REQUIRE([_AS_ME_PREPARE])dnl
1388 # Create a (secure) tmp directory for tmp files.
1389 m4_if([$2], [], [: ${TMPDIR=/tmp}])
1391   tmp=`(umask 077 && mktemp -d "m4_default([$2], [$TMPDIR])/$1XXXXXX") 2>/dev/null` &&
1392   test -n "$tmp" && test -d "$tmp"
1393 }  ||
1395   tmp=m4_default([$2], [$TMPDIR])/$1$$-$RANDOM
1396   (umask 077 && mkdir "$tmp")
1397 } || AS_ERROR([cannot create a temporary directory in m4_default([$2], [$TMPDIR])])dnl
1398 ])# AS_TMPDIR
1401 # AS_UNAME
1402 # --------
1403 # Try to describe this machine.  Meant for logs.
1404 m4_define([AS_UNAME],
1406 cat <<_ASUNAME
1407 m4_text_box([Platform.])
1409 hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
1410 uname -m = `(uname -m) 2>/dev/null || echo unknown`
1411 uname -r = `(uname -r) 2>/dev/null || echo unknown`
1412 uname -s = `(uname -s) 2>/dev/null || echo unknown`
1413 uname -v = `(uname -v) 2>/dev/null || echo unknown`
1415 /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
1416 /bin/uname -X     = `(/bin/uname -X) 2>/dev/null     || echo unknown`
1418 /bin/arch              = `(/bin/arch) 2>/dev/null              || echo unknown`
1419 /usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null       || echo unknown`
1420 /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
1421 /usr/bin/hostinfo      = `(/usr/bin/hostinfo) 2>/dev/null      || echo unknown`
1422 /bin/machine           = `(/bin/machine) 2>/dev/null           || echo unknown`
1423 /usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null       || echo unknown`
1424 /bin/universe          = `(/bin/universe) 2>/dev/null          || echo unknown`
1426 _ASUNAME
1428 _AS_PATH_WALK([$PATH], [AS_ECHO(["PATH: $as_dir"])])
1432 # _AS_VERSION_COMPARE_PREPARE
1433 # ---------------------------
1434 # Output variables for comparing version numbers.
1435 m4_defun([_AS_VERSION_COMPARE_PREPARE],
1436 [[as_awk_strverscmp='
1437   # Use only awk features that work with 7th edition Unix awk (1978).
1438   # My, what an old awk you have, Mr. Solaris!
1439   END {
1440     while (length(v1) && length(v2)) {
1441       # Set d1 to be the next thing to compare from v1, and likewise for d2.
1442       # Normally this is a single character, but if v1 and v2 contain digits,
1443       # compare them as integers and fractions as strverscmp does.
1444       if (v1 ~ /^[0-9]/ && v2 ~ /^[0-9]/) {
1445         # Split v1 and v2 into their leading digit string components d1 and d2,
1446         # and advance v1 and v2 past the leading digit strings.
1447         for (len1 = 1; substr(v1, len1 + 1) ~ /^[0-9]/; len1++) continue
1448         for (len2 = 1; substr(v2, len2 + 1) ~ /^[0-9]/; len2++) continue
1449         d1 = substr(v1, 1, len1); v1 = substr(v1, len1 + 1)
1450         d2 = substr(v2, 1, len2); v2 = substr(v2, len2 + 1)
1451         if (d1 ~ /^0/) {
1452           if (d2 ~ /^0/) {
1453             # Compare two fractions.
1454             while (d1 ~ /^0/ && d2 ~ /^0/) {
1455               d1 = substr(d1, 2); len1--
1456               d2 = substr(d2, 2); len2--
1457             }
1458             if (len1 != len2 && ! (len1 && len2 && substr(d1, 1, 1) == substr(d2, 1, 1))) {
1459               # The two components differ in length, and the common prefix
1460               # contains only leading zeros.  Consider the longer to be less.
1461               d1 = -len1
1462               d2 = -len2
1463             } else {
1464               # Otherwise, compare as strings.
1465               d1 = "x" d1
1466               d2 = "x" d2
1467             }
1468           } else {
1469             # A fraction is less than an integer.
1470             exit 1
1471           }
1472         } else {
1473           if (d2 ~ /^0/) {
1474             # An integer is greater than a fraction.
1475             exit 2
1476           } else {
1477             # Compare two integers.
1478             d1 += 0
1479             d2 += 0
1480           }
1481         }
1482       } else {
1483         # The normal case, without worrying about digits.
1484         d1 = substr(v1, 1, 1); v1 = substr(v1, 2)
1485         d2 = substr(v2, 1, 1); v2 = substr(v2, 2)
1486       }
1487       if (d1 < d2) exit 1
1488       if (d1 > d2) exit 2
1489     }
1490     # Beware Solaris /usr/xgp4/bin/awk (at least through Solaris 10),
1491     # which mishandles some comparisons of empty strings to integers.
1492     if (length(v2)) exit 1
1493     if (length(v1)) exit 2
1494   }
1495 ']])# _AS_VERSION_COMPARE_PREPARE
1498 # AS_VERSION_COMPARE(VERSION-1, VERSION-2,
1499 #                    [ACTION-IF-LESS], [ACTION-IF-EQUAL], [ACTION-IF-GREATER])
1500 # -----------------------------------------------------------------------------
1501 # Compare two strings possibly containing shell variables as version strings.
1502 m4_defun([AS_VERSION_COMPARE],
1503 [AS_REQUIRE([_$0_PREPARE])dnl
1504 as_arg_v1=$1
1505 as_arg_v2=$2
1506 dnl This usage is portable even to ancient awk,
1507 dnl so don't worry about finding a "nice" awk version.
1508 awk "$as_awk_strverscmp" v1="$as_arg_v1" v2="$as_arg_v2" /dev/null
1509 case $? in
1510 1) $3;;
1511 0) $4;;
1512 2) $5;;
1513 esac[]dnl
1514 ])# _AS_VERSION_COMPARE
1518 ## --------------------------------------- ##
1519 ## 6. Common m4/sh character translation.  ##
1520 ## --------------------------------------- ##
1522 # The point of this section is to provide high level macros comparable
1523 # to m4's `translit' primitive, but m4/sh polymorphic.
1524 # Transliteration of literal strings should be handled by m4, while
1525 # shell variables' content will be translated at runtime (tr or sed).
1528 # _AS_CR_PREPARE
1529 # --------------
1530 # Output variables defining common character ranges.
1531 # See m4_cr_letters etc.
1532 m4_defun([_AS_CR_PREPARE],
1533 [# Avoid depending upon Character Ranges.
1534 as_cr_letters='abcdefghijklmnopqrstuvwxyz'
1535 as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
1536 as_cr_Letters=$as_cr_letters$as_cr_LETTERS
1537 as_cr_digits='0123456789'
1538 as_cr_alnum=$as_cr_Letters$as_cr_digits
1542 # _AS_TR_SH_PREPARE
1543 # -----------------
1544 m4_defun([_AS_TR_SH_PREPARE],
1545 [AS_REQUIRE([_AS_CR_PREPARE])dnl
1546 # Sed expression to map a string onto a valid variable name.
1547 as_tr_sh="eval sed 'y%*+%pp%;s%[[^_$as_cr_alnum]]%_%g'"
1551 # AS_TR_SH(EXPRESSION)
1552 # --------------------
1553 # Transform EXPRESSION into a valid shell variable name.
1554 # sh/m4 polymorphic.
1555 # Be sure to update the definition of `$as_tr_sh' if you change this.
1557 # AS_LITERAL_IF guarantees that a literal does not have any nested quotes,
1558 # once $1 is expanded.  m4_translit silently uses only the first occurrence
1559 # of a character that appears multiple times in argument 2, since we know
1560 # that m4_cr_not_symbols2 also contains [ and ].  m4_translit also silently
1561 # ignores characters in argument 3 that do not match argument 2; we use this
1562 # fact to skip worrying about the length of m4_cr_not_symbols2.
1564 # For speed, we inline the literal definitions that can be computed up front.
1565 m4_defun([AS_TR_SH],
1566 [AS_REQUIRE([_$0_PREPARE])dnl
1567 AS_LITERAL_IF([$1],
1568               [m4_translit([$1], [*+[]]]]dnl
1569 m4_dquote(m4_dquote(m4_defn([m4_cr_not_symbols2])))[[,
1570                                  [pp[]]]]dnl
1571 m4_dquote(m4_dquote(m4_for(,1,255,,[[_]])))[[)],
1572               [`AS_ECHO(["$1"]) | $as_tr_sh`])])
1575 # _AS_TR_CPP_PREPARE
1576 # ------------------
1577 m4_defun([_AS_TR_CPP_PREPARE],
1578 [AS_REQUIRE([_AS_CR_PREPARE])dnl
1579 # Sed expression to map a string onto a valid CPP name.
1580 as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[[^_$as_cr_alnum]]%_%g'"
1584 # AS_TR_CPP(EXPRESSION)
1585 # ---------------------
1586 # Map EXPRESSION to an upper case string which is valid as rhs for a
1587 # `#define'.  sh/m4 polymorphic.  Be sure to update the definition
1588 # of `$as_tr_cpp' if you change this.
1590 # See implementation comments in AS_TR_SH.
1591 m4_defun([AS_TR_CPP],
1592 [AS_REQUIRE([_$0_PREPARE])dnl
1593 AS_LITERAL_IF([$1],
1594               [m4_translit([$1], [*[]]]]dnl
1595 m4_dquote(m4_dquote(m4_defn([m4_cr_letters])m4_defn([m4_cr_not_symbols2])))[[,
1596                                  [P[]]]]dnl
1597 m4_dquote(m4_dquote(m4_defn([m4_cr_LETTERS])m4_for(,1,255,,[[_]])))[[)],
1598               [`AS_ECHO(["$1"]) | $as_tr_cpp`])])
1601 # _AS_TR_PREPARE
1602 # --------------
1603 m4_defun([_AS_TR_PREPARE],
1604 [AS_REQUIRE([_AS_TR_SH_PREPARE])dnl
1605 AS_REQUIRE([_AS_TR_CPP_PREPARE])dnl
1611 ## ------------------------------------------------------ ##
1612 ## 7. Common m4/sh handling of variables (indirections).  ##
1613 ## ------------------------------------------------------ ##
1616 # The purpose of this section is to provide a uniform API for
1617 # reading/setting sh variables with or without indirection.
1618 # Typically, one can write
1619 #   AS_VAR_SET(var, val)
1620 # or
1621 #   AS_VAR_SET(as_$var, val)
1622 # and expect the right thing to happen.  In the descriptions below,
1623 # a literal name matches the regex [a-zA-Z_][a-zA-Z0-9_]*, an
1624 # indirect name is a shell expression that produces a literal name
1625 # when passed through eval, and a polymorphic name is either type.
1630 # AS_VAR_GET(VARIABLE)
1631 # --------------------
1632 # Get the value of the shell VARIABLE.
1633 # Evaluates to $VARIABLE if there are no indirection in VARIABLE,
1634 # else into the appropriate `eval' sequence.
1635 # FIXME: This mishandles values that end in newlines.
1636 # Fixing this will require changing the API.
1637 m4_define([AS_VAR_GET],
1638 [AS_LITERAL_IF([$1],
1639                [$$1],
1640                [`eval 'as_val=${'m4_bpatsubst([$1], [[\\`]], [\\\&])'};dnl
1641 AS_ECHO(["$as_val"])'`])])
1644 # AS_VAR_IF(VARIABLE, VALUE, IF-TRUE, IF-FALSE)
1645 # ---------------------------------------------
1646 # Implement a shell `if test $VARIABLE = VALUE; then-else'.
1647 # Polymorphic, and avoids sh expansion error upon interrupt or term signal.
1648 m4_define([AS_VAR_IF],
1649 [AS_LITERAL_IF([$1],
1650   [AS_IF([test "x$$1" = x""$2], [$3], [$4])],
1651   [as_val=AS_VAR_GET([$1])
1652    AS_IF([test "x$as_val" = x""$2], [$3], [$4])])])
1655 # AS_VAR_PUSHDEF and AS_VAR_POPDEF
1656 # --------------------------------
1659 # Sometimes we may have to handle literals (e.g. `stdlib.h'), while at
1660 # other moments, the same code may have to get the value from a
1661 # variable (e.g., `ac_header').  To have a uniform handling of both
1662 # cases, when a new value is about to be processed, declare a local
1663 # variable, e.g.:
1665 #   AS_VAR_PUSHDEF([header], [ac_cv_header_$1])
1667 # and then in the body of the macro, use `header' as is.  It is of
1668 # first importance to use `AS_VAR_*' to access this variable.
1670 # If the value `$1' was a literal (e.g. `stdlib.h'), then `header' is
1671 # in fact the value `ac_cv_header_stdlib_h'.  If `$1' was indirect,
1672 # then `header's value in m4 is in fact `$as_header', the shell
1673 # variable that holds all of the magic to get the expansion right.
1675 # At the end of the block, free the variable with
1677 #   AS_VAR_POPDEF([header])
1680 # AS_VAR_POPDEF(VARNAME)
1681 # ----------------------
1682 # Free the shell variable accessor VARNAME.  To be dnl'ed.
1683 m4_define([AS_VAR_POPDEF],
1684 [m4_popdef([$1])])
1687 # AS_VAR_PUSHDEF(VARNAME, VALUE)
1688 # ------------------------------
1689 # Define the m4 macro VARNAME to an accessor to the shell variable
1690 # named VALUE.  VALUE does not need to be a valid shell variable name:
1691 # the transliteration is handled here.  To be dnl'ed.
1692 m4_define([AS_VAR_PUSHDEF],
1693 [AS_LITERAL_IF([$2],
1694                [m4_pushdef([$1], [AS_TR_SH($2)])],
1695                [as_$1=AS_TR_SH($2)
1696 m4_pushdef([$1], [$as_[$1]])])])
1699 # AS_VAR_SET(VARIABLE, VALUE)
1700 # ---------------------------
1701 # Set the contents of the polymorphic shell VARIABLE to the shell
1702 # expansion of VALUE.
1703 m4_define([AS_VAR_SET],
1704 [AS_LITERAL_IF([$1],
1705                [$1=$2],
1706                [eval "$1=AS_ESCAPE([$2])"])])
1709 # AS_VAR_SET_IF(VARIABLE, IF-TRUE, IF-FALSE)
1710 # ------------------------------------------
1711 # Implement a shell `if-then-else' depending whether VARIABLE is set
1712 # or not.  Polymorphic.
1713 m4_define([AS_VAR_SET_IF],
1714 [AS_IF([AS_VAR_TEST_SET([$1])], [$2], [$3])])
1717 # AS_VAR_TEST_SET(VARIABLE)
1718 # -------------------------
1719 # Expands into the `test' expression which is true if VARIABLE
1720 # is set.  Polymorphic.  Should be dnl'ed.
1721 m4_define([AS_VAR_TEST_SET],
1722 [AS_LITERAL_IF([$1],
1723                [test "${$1+set}" = set],
1724                [{ as_var=$1; eval "test \"\${$as_var+set}\" = set"; }])])
1727 ## -------------------- ##
1728 ## 8. Setting M4sh up.  ##
1729 ## -------------------- ##
1732 # AS_INIT_GENERATED
1733 # -----------------
1734 # Emit m4sh initialization code in a suitable form for a quoted
1735 # here document.  Does not emit the `#!' sequence, which should be
1736 # generated with `#! $SHELL'; see the manual or autoconf/status.m4
1737 # for more detail.
1738 m4_defun([AS_INIT_GENERATED],
1739 [m4_require([AS_PREPARE])dnl
1740 _AS_SHELL_SANITIZE
1741 _AS_PREPARE])
1743 # AS_INIT
1744 # -------
1745 # Initialize m4sh.
1746 m4_define([AS_INIT],
1747 [# Wrap our cleanup prior to m4sugar's cleanup.
1748 m4_wrap([_AS_CLEANUP])
1749 m4_init
1750 m4_provide([AS_INIT])
1752 # Forbidden tokens and exceptions.
1753 m4_pattern_forbid([^_?AS_])
1755 # Bangshe and minimal initialization.
1756 m4_divert_text([BINSH], [@%:@! /bin/sh])
1757 m4_divert_text([HEADER-COMMENT],
1758                [@%:@ Generated from __file__ by m4_PACKAGE_STRING.])
1759 m4_divert_text([M4SH-SANITIZE], [_AS_SHELL_SANITIZE])
1761 # Let's go!
1762 m4_divert_pop([KILL])[]dnl
1763 m4_divert_push([BODY])[]dnl
1764 _AS_DETECT_REQUIRED([_AS_SHELL_FN_WORK])dnl
1765 AS_REQUIRE([_AS_UNSET_PREPARE])dnl For backwards compatibility.