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 Free
6 # 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 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 # You should have received a copy of the GNU General Public License
19 # along with this program. If not, see <http://www.gnu.org/licenses/>.
21 # As a special exception, the Free Software Foundation gives unlimited
22 # permission to copy, distribute and modify the configure scripts that
23 # are the output of Autoconf. You need not follow the terms of the GNU
24 # General Public License when using or distributing such scripts, even
25 # though portions of the text of Autoconf appear in them. The GNU
26 # General Public License (GPL) does govern all other use of the material
27 # that constitutes the Autoconf program.
29 # Certain portions of the Autoconf source text are designed to be copied
30 # (in certain cases, depending on the input) into the output of
31 # Autoconf. We call these the "data" portions. The rest of the Autoconf
32 # source text consists of comments plus executable code that decides which
33 # of the data portions to output in any given case. We call these
34 # comments and executable code the "non-data" portions. Autoconf never
35 # copies any of the non-data portions into its output.
37 # This special exception to the GPL applies to versions of Autoconf
38 # released by the Free Software Foundation. When you make and
39 # distribute a modified version of Autoconf, you may extend this special
40 # exception to the GPL to apply to your modified version as well, *unless*
41 # your modified version has the potential to copy into its output some
42 # of the text that was the non-data portion of the version that you started
43 # with. (In other words, unless your change moves or copies text from
44 # the non-data portions to the data portions.) If your modification has
45 # such potential, you must delete any notice of this special exception
46 # to the GPL from your modified version.
48 # Written by Akim Demaille, Pavel Roskin, Alexandre Oliva, Lars J. Aas
49 # and many other people.
52 # We heavily use m4's diversions both for the initializations and for
53 # required macros, because in both cases we have to issue soon in
54 # output something which is discovered late.
57 # KILL is only used to suppress output.
60 # AC_REQUIRE'd #! /bin/sh line
64 # Purpose of the script etc.
72 # The body of the script.
75 # _m4_divert(DIVERSION-NAME)
76 # --------------------------
77 # Convert a diversion name into its number. Otherwise, return
78 # DIVERSION-NAME which is supposed to be an actual diversion number.
79 # Of course it would be nicer to use m4_case here, instead of zillions
80 # of little macros, but it then takes twice longer to run `autoconf'!
81 m4_define([_m4_divert(BINSH)], 0)
82 m4_define([_m4_divert(HEADER-REVISION)], 1)
83 m4_define([_m4_divert(HEADER-COMMENT)], 2)
84 m4_define([_m4_divert(HEADER-COPYRIGHT)], 3)
85 m4_define([_m4_divert(M4SH-SANITIZE)], 4)
86 m4_define([_m4_divert(M4SH-INIT)], 5)
87 m4_define([_m4_divert(BODY)], 1000)
89 # Aaarg. Yet it starts with compatibility issues... Libtool wants to
90 # use NOTICE to insert its own LIBTOOL-INIT stuff. People should ask
91 # before diving into our internals :(
92 m4_copy([_m4_divert(M4SH-INIT)], [_m4_divert(NOTICE)])
96 ## ------------------------- ##
97 ## 1. Sanitizing the shell. ##
98 ## ------------------------- ##
101 # AS_REQUIRE(NAME-TO-CHECK, [BODY-TO-EXPAND = NAME-TO-CHECK])
102 # -----------------------------------------------------------
103 # BODY-TO-EXPAND is some initialization which must be expanded in the
104 # M4SH-INIT section when expanded (required or not). This is very
105 # different from m4_require. For instance:
107 # m4_defun([_FOO_PREPARE], [foo=foo])
109 # [m4_require([_FOO_PREPARE])dnl
112 # m4_defun([_BAR_PREPARE], [bar=bar])
114 # [AS_REQUIRE([_BAR_PREPARE])dnl
134 # Due to the simple implementation, all the AS_REQUIRE calls have to be at
135 # the very beginning of the macro body, or the AS_REQUIREs may not be nested.
136 # More exactly, if a macro doesn't have all AS_REQUIREs at its beginning,
137 # it may not be AS_REQUIREd.
139 m4_define([AS_REQUIRE],
140 [m4_provide_if([$1], [],
141 [m4_divert_text([M4SH-INIT], [m4_default([$2], [$1])])])])
144 # AS_REQUIRE_SHELL_FN(NAME-TO-CHECK, BODY-TO-EXPAND)
145 # --------------------------------------------------
146 # BODY-TO-EXPAND is the body of a shell function to be emitted in the
147 # M4SH-INIT section when expanded (required or not). Unlike other
148 # xx_REQUIRE macros, BODY-TO-EXPAND is mandatory.
150 m4_define([AS_REQUIRE_SHELL_FN],
151 [_AS_DETECT_REQUIRED([_AS_SHELL_FN_WORK])dnl
152 m4_provide_if([AS_SHELL_FN_$1], [],
153 [m4_provide([AS_SHELL_FN_$1])m4_divert_text([M4SH-INIT], [$1() {
158 # AS_BOURNE_COMPATIBLE
159 # --------------------
160 # Try to be as Bourne and/or POSIX as possible.
162 # This does not set BIN_SH, due to the problems described in
163 # <http://lists.gnu.org/archive/html/autoconf-patches/2006-03/msg00081.html>.
164 # People who need BIN_SH should set it in their environment before invoking
165 # configure; apparently this would include UnixWare, as described in
166 # <http://lists.gnu.org/archive/html/bug-autoconf/2006-06/msg00025.html>.
167 m4_define([AS_BOURNE_COMPATIBLE],
168 [# Be more Bourne compatible
169 DUALCASE=1; export DUALCASE # for MKS sh
173 # _AS_BOURNE_COMPATIBLE
174 # ---------------------
175 # This is the part of AS_BOURNE_COMPATIBLE which has to be repeated inside
177 m4_define([_AS_BOURNE_COMPATIBLE],
178 [AS_IF([test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1],
181 [#] Pre-4.2 versions of Zsh do word splitting on ${1+"$[@]"}, which
182 # is contrary to our usage. Disable this feature.
183 alias -g '${1+"$[@]"}'='"$[@]"'
184 setopt NO_GLOB_SUBST],
185 [AS_CASE([`(set -o) 2>/dev/null`], [*posix*], [set -o posix])])
189 # _AS_RUN(TEST, [SHELL])
190 # ----------------------
191 # Run TEST under the current shell (if one parameter is used)
192 # or under the given SHELL, protecting it from syntax errors.
196 _AS_BOURNE_COMPATIBLE
200 [(eval "AS_ESCAPE(m4_quote($1))")])])
203 # _AS_DETECT_REQUIRED(TEST)
204 # -------------------------
205 # Refuse to execute under a shell that does not pass the given TEST.
206 m4_define([_AS_DETECT_REQUIRED_BODY], [:])
207 m4_defun([_AS_DETECT_REQUIRED],
208 [m4_require([_AS_DETECT_BETTER_SHELL])dnl
209 m4_expand_once([m4_append([_AS_DETECT_REQUIRED_BODY], [
211 ])], [_AS_DETECT_REQUIRED_provide($1)])])
214 # _AS_DETECT_SUGGESTED(TEST)
215 # --------------------------
216 # Prefer to execute under a shell that passes the given TEST.
217 m4_define([_AS_DETECT_SUGGESTED_BODY], [:])
218 m4_defun([_AS_DETECT_SUGGESTED],
219 [m4_require([_AS_DETECT_BETTER_SHELL])dnl
220 m4_expand_once([m4_append([_AS_DETECT_SUGGESTED_BODY], [
222 ])], [_AS_DETECT_SUGGESTED_provide($1)])])
225 # _AS_DETECT_BETTER_SHELL
226 # -----------------------
227 # The real workhorse for detecting a shell with the correct
230 # In previous versions, we prepended /usr/posix/bin to the path, but that
231 # caused a regression on OpenServer 6.0.0
232 # <http://lists.gnu.org/archive/html/bug-autoconf/2006-06/msg00017.html>
233 # and on HP-UX 11.11, see the failure of test 120 in
234 # <http://lists.gnu.org/archive/html/bug-autoconf/2006-10/msg00003.html>
236 # FIXME: The code should test for the OSF bug described in
237 # <http://lists.gnu.org/archive/html/autoconf-patches/2006-03/msg00081.html>.
239 m4_defun_once([_AS_DETECT_BETTER_SHELL],
240 [m4_wrap([m4_divert_text([M4SH-SANITIZE], [
241 AS_REQUIRE([_AS_UNSET_PREPARE])dnl
242 if test "x$CONFIG_SHELL" = x; then
243 AS_IF([_AS_RUN([_AS_DETECT_REQUIRED_BODY]) 2>/dev/null],
244 [as_have_required=yes],
245 [as_have_required=no])
246 AS_IF([test $as_have_required = yes &&dnl
247 _AS_RUN([_AS_DETECT_SUGGESTED_BODY]) 2> /dev/null],
249 [as_candidate_shells=
250 _AS_PATH_WALK([/bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH],
253 for as_base in sh bash ksh sh5; do
254 as_candidate_shells="$as_candidate_shells $as_dir/$as_base"
258 for as_shell in $as_candidate_shells $SHELL; do
259 # Try only shells that exist, to save several forks.
260 AS_IF([{ test -f "$as_shell" || test -f "$as_shell.exe"; } &&
261 _AS_RUN([_AS_DETECT_REQUIRED_BODY],
262 [("$as_shell") 2> /dev/null])],
263 [CONFIG_SHELL=$as_shell
265 AS_IF([_AS_RUN([_AS_DETECT_SUGGESTED_BODY], ["$as_shell" 2> /dev/null])],
269 AS_IF([test "x$CONFIG_SHELL" != x],
270 [for as_var in BASH_ENV ENV
271 do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
274 exec "$CONFIG_SHELL" "$as_myself" ${1+"$[@]"}])
276 AS_IF([test $as_have_required = no],
277 [echo This script requires a shell more modern than all the
278 echo shells that I found on your system. Please install a
279 echo modern shell, or manually run the script under such a
280 echo shell if you do have one.
284 ])])])# _AS_DETECT_BETTER_SHELL
289 # This is a spy to detect "in the wild" shells that do not support shell
290 # functions correctly. It is based on the m4sh.at Autotest testcases.
291 m4_define([_AS_SHELL_FN_WORK],
301 as_func_ret_success () {
304 as_func_ret_failure () {
309 AS_IF([as_func_success], [],
311 echo as_func_success failed.])
312 AS_IF([as_func_failure],
314 echo as_func_failure succeeded.])
315 AS_IF([as_func_ret_success], [],
317 echo as_func_ret_success failed.])
318 AS_IF([as_func_ret_failure],
320 echo as_func_ret_failure succeeded.])
321 AS_IF([( set x; as_func_ret_success y && test x = "[$]1" )], [],
323 echo positional parameters were not saved.])
324 test $exitcode = 0[]dnl
325 ])# _AS_SHELL_FN_WORK
330 # Emit TEXT, a copyright notice, as a shell comment near the top of the
331 # script. TEXT is evaluated once; to accomplish that, we do not prepend
333 m4_define([AS_COPYRIGHT],
334 [m4_divert_text([HEADER-COPYRIGHT],
336 $1], [^], [@%:@ ])])])
341 m4_defun([AS_SHELL_SANITIZE],
342 [## --------------------- ##
343 ## M4sh Initialization. ##
344 ## --------------------- ##
351 _AS_PATH_SEPARATOR_PREPARE
355 # We need space, tab and new line, in precisely that order. Quoting is
356 # there to prevent editors from complaining about space-tab.
357 # (If _AS_PATH_WALK were called with IFS unset, it would disable word
358 # splitting by setting IFS to empty value.)
361 # Find who we are. Look in the path if we contain no directory separator.
363 *[[\\/]]* ) as_myself=$[0] ;;
365 [test -r "$as_dir/$[0]" && as_myself=$as_dir/$[0] && break])
368 # We did not find ourselves, most probably we were run as `sh COMMAND'
369 # in which case we are not to be found in the path.
370 if test "x$as_myself" = x; then
373 if test ! -f "$as_myself"; then
374 AS_ECHO(["$as_myself: error: cannot find myself; rerun with an absolute file name"]) >&2
378 # Work around bugs in pre-3.0 UWIN ksh.
379 for as_var in ENV MAIL MAILPATH
380 do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
388 LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
389 LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
392 if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
393 eval $as_var=C; export $as_var
395 ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
399 # Required to use basename.
403 # Name of the executable.
404 as_me=`AS_BASENAME("$[0]")`
408 ])# AS_SHELL_SANITIZE
413 # This macro has a very special status. Normal use of M4sh relies
414 # heavily on AS_REQUIRE, so that needed initializations (such as
415 # _AS_TEST_PREPARE) are performed on need, not on demand. But
416 # Autoconf is the first client of M4sh, and for two reasons: configure
417 # and config.status. Relying on AS_REQUIRE is of course fine for
418 # configure, but fails for config.status (which is created by
419 # configure). So we need a means to force the inclusion of the
420 # various _AS_PREPARE_* on top of config.status. That's basically why
421 # there are so many _AS_PREPARE_* below, and that's also why it is
422 # important not to forget some: config.status needs them.
423 m4_defun([_AS_PREPARE],
427 _AS_ECHO_N_PREPARE[]dnl We do not need this ourselves but user code might.
439 # Output all the M4sh possible initialization into the initialization
441 m4_defun([AS_PREPARE],
442 [m4_divert_text([M4SH-INIT], [_AS_PREPARE])])
445 ## ----------------------------- ##
446 ## 2. Wrappers around builtins. ##
447 ## ----------------------------- ##
449 # This section is lexicographically sorted.
452 # AS_CASE(WORD, [PATTERN1], [IF-MATCHED1]...[DEFAULT])
453 # ----------------------------------------------------
456 # | PATTERN1) IF-MATCHED1 ;;
460 m4_define([_AS_CASE],
461 [m4_if([$#], 0, [m4_fatal([$0: too few arguments: $#])],
462 [$#], 1, [ *) $1 ;;],
463 [$#], 2, [ $1) m4_default([$2], [:]) ;;],
464 [ $1) m4_default([$2], [:]) ;;
465 $0(m4_shift2($@))])dnl
470 _AS_CASE(m4_shift($@))
476 # AS_EXIT([EXIT-CODE = 1])
477 # ------------------------
478 # Exit and set exit code to EXIT-CODE in the way that it's seen
481 # We cannot simply use "exit N" because some shells (zsh and Solaris sh)
482 # will not set $? to N while running the code set by "trap 0"
483 # So we set $? by executing "exit N" in the subshell and then exit.
484 # Other shells don't use `$?' as default for `exit', hence just repeating
485 # the exit value can only help improving portability.
487 [{ (exit m4_default([$1], 1)); exit m4_default([$1], 1); }])
490 # AS_IF(TEST1, [IF-TRUE1]...[IF-FALSE])
491 # -------------------------------------
501 # with simplifications if IF-TRUE1 and/or IF-FALSE is empty.
506 m4_default([$2], [:])
507 m4_ifval([$3], [$0(m4_shift2($@))])],
516 m4_default([$2], [:])
517 m4_ifval([$3], [_$0(m4_shift2($@))])[]dnl
525 # AS_UNSET depends upon $as_unset: compute it.
526 # Use MAIL to trigger a bug in Bash 2.01;
527 # the "|| exit" suppresses the resulting "Segmentation fault" message.
528 # Avoid 'if ((', as that triggers a bug in pdksh 5.2.14.
529 m4_defun([_AS_UNSET_PREPARE],
530 [# Support unset when possible.
531 if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
539 # AS_UNSET(VAR, [VALUE-IF-UNSET-NOT-SUPPORTED = `'])
540 # --------------------------------------------------
541 # Try to unset the env VAR, otherwise set it to
542 # VALUE-IF-UNSET-NOT-SUPPORTED. `as_unset' must have been computed.
544 [AS_REQUIRE([_AS_UNSET_PREPARE])dnl
545 $as_unset $1 || test "${$1+set}" != set || { $1=$2; export $1; }])
552 ## ------------------------------------------ ##
553 ## 3. Error and warnings at the shell level. ##
554 ## ------------------------------------------ ##
556 # If AS_MESSAGE_LOG_FD is defined, shell messages are duplicated there
560 # AS_ESCAPE(STRING, [CHARS = $"`\])
561 # ---------------------------------
562 # Escape the CHARS in STRING.
564 # Avoid the m4_bpatsubst if there are no interesting characters to escape.
565 # _AS_ESCAPE bypasses argument defaulting.
566 m4_define([AS_ESCAPE],
567 [_$0([$1], m4_default([$2], [\"$`]))])
568 m4_define([_AS_ESCAPE],
570 m4_len(m4_translit([[$1]], [$2])),
571 [$1], [m4_bpatsubst([$1], [[$2]], [\\\&])])])
574 # _AS_QUOTE_IFELSE(STRING, IF-MODERN-QUOTATION, IF-OLD-QUOTATION)
575 # ---------------------------------------------------------------
576 # Compatibility glue between the old AS_MSG suite which did not
577 # quote anything, and the modern suite which quotes the quotes.
578 # If STRING contains `\\' or `\$', it's modern.
579 # If STRING contains `\"' or `\`', it's old.
580 # Otherwise it's modern.
582 # Profiling shows that m4_index is 5 to 8x faster than m4_bregexp. The
583 # slower implementation used:
588 # The current implementation caters to the common case of no backslashes,
589 # to minimize m4_index expansions (hence the nested if).
590 m4_define([_AS_QUOTE_IFELSE],
591 [m4_cond([m4_index([$1], [\])], [-1], [$2],
592 [m4_eval(m4_index([$1], [\\]) >= 0)], [1], [$2],
593 [m4_eval(m4_index([$1], [\$]) >= 0)], [1], [$2],
594 [m4_eval(m4_index([$1], [\`]) >= 0)], [1], [$3],
595 [m4_eval(m4_index([$1], [\"]) >= 0)], [1], [$3],
599 # _AS_QUOTE(STRING, [CHARS = `"])
600 # -------------------------------
601 # If there are quoted (via backslash) backquotes do nothing, else
602 # backslash all the quotes.
603 m4_define([_AS_QUOTE],
604 [_AS_QUOTE_IFELSE([$1],
605 [_AS_ESCAPE([$1], m4_default([$2], [`""]))],
607 [back quotes and double quotes must not be escaped in: $1])dnl
611 # _AS_ECHO_UNQUOTED(STRING, [FD = AS_MESSAGE_FD])
612 # -----------------------------------------------
613 # Perform shell expansions on STRING and echo the string to FD.
614 m4_define([_AS_ECHO_UNQUOTED],
615 [AS_ECHO(["$1"]) >&m4_default([$2], [AS_MESSAGE_FD])])
618 # _AS_ECHO(STRING, [FD = AS_MESSAGE_FD])
619 # --------------------------------------
620 # Protect STRING from backquote expansion, echo the result to FD.
621 m4_define([_AS_ECHO],
622 [_AS_ECHO_UNQUOTED([_AS_QUOTE([$1])], [$2])])
625 # _AS_ECHO_LOG(STRING)
626 # --------------------
627 # Log the string to AS_MESSAGE_LOG_FD.
628 m4_define([_AS_ECHO_LOG],
629 [_AS_ECHO([$as_me:$LINENO: $1], [AS_MESSAGE_LOG_FD])])
634 # Check whether to use -n, \c, or newline-tab to separate
635 # checking messages from result messages.
636 # Don't try to cache, since the results of this macro are needed to
637 # display the checking message. In addition, caching something used once
638 # has little interest.
639 # Idea borrowed from dist 3.0. Use `*c*,', not `*c,' because if `\c'
640 # failed there is also a newline to match.
641 m4_defun([_AS_ECHO_N_PREPARE],
642 [ECHO_C= ECHO_N= ECHO_T=
646 *c*) ECHO_T=' ';; # ECHO_T is single tab character.
652 ])# _AS_ECHO_N_PREPARE
655 # _AS_ECHO_N(STRING, [FD = AS_MESSAGE_FD])
656 # ----------------------------------------
657 # Same as _AS_ECHO, but echo doesn't return to a new line.
658 m4_define([_AS_ECHO_N],
659 [AS_ECHO_N(["_AS_QUOTE([$1])"]) >&m4_default([$2], [AS_MESSAGE_FD])])
662 # AS_MESSAGE(STRING, [FD = AS_MESSAGE_FD])
663 # ----------------------------------------
664 m4_define([AS_MESSAGE],
665 [m4_ifset([AS_MESSAGE_LOG_FD],
666 [{ _AS_ECHO_LOG([$1])
667 _AS_ECHO([$as_me: $1], [$2]);}],
668 [_AS_ECHO([$as_me: $1], [$2])])[]dnl
675 [AS_MESSAGE([WARNING: $1], [2])])# AS_WARN
678 # AS_ERROR(ERROR, [EXIT-STATUS = 1])
679 # ----------------------------------
680 m4_define([AS_ERROR],
681 [{ AS_MESSAGE([error: $1], [2])
682 AS_EXIT([$2]); }[]dnl
687 ## -------------------------------------- ##
688 ## 4. Portable versions of common tools. ##
689 ## -------------------------------------- ##
691 # This section is lexicographically sorted.
694 # AS_BASENAME(FILE-NAME)
695 # ----------------------
696 # Simulate the command 'basename FILE-NAME'. Not all systems have basename.
697 # Also see the comments for AS_DIRNAME.
699 m4_defun([_AS_BASENAME_EXPR],
700 [AS_REQUIRE([_AS_EXPR_PREPARE])dnl
701 $as_expr X/[]$1 : '.*/\([[^/][^/]*]\)/*$' \| \
702 X[]$1 : 'X\(//\)$' \| \
703 X[]$1 : 'X\(/\)' \| .])
705 m4_defun([_AS_BASENAME_SED],
707 sed ['/^.*\/\([^/][^/]*\)\/*$/{
721 m4_defun([AS_BASENAME],
722 [AS_REQUIRE([_$0_PREPARE])dnl
723 $as_basename -- $1 ||
724 _AS_BASENAME_EXPR([$1]) 2>/dev/null ||
725 _AS_BASENAME_SED([$1])])
728 # _AS_BASENAME_PREPARE
729 # --------------------
730 # Avoid Solaris 9 /usr/ucb/basename, as `basename /' outputs an empty line.
731 # Also, traditional basename mishandles --.
732 m4_defun([_AS_BASENAME_PREPARE],
733 [if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
738 ])# _AS_BASENAME_PREPARE
741 # AS_DIRNAME(FILE-NAME)
742 # ---------------------
743 # Simulate the command 'dirname FILE-NAME'. Not all systems have dirname.
744 # This macro must be usable from inside ` `.
746 # Prefer expr to echo|sed, since expr is usually faster and it handles
747 # backslashes and newlines correctly. However, older expr
748 # implementations (e.g. SunOS 4 expr and Solaris 8 /usr/ucb/expr) have
749 # a silly length limit that causes expr to fail if the matched
750 # substring is longer than 120 bytes. So fall back on echo|sed if
752 m4_defun([_AS_DIRNAME_EXPR],
753 [AS_REQUIRE([_AS_EXPR_PREPARE])dnl
754 $as_expr X[]$1 : 'X\(.*[[^/]]\)//*[[^/][^/]]*/*$' \| \
755 X[]$1 : 'X\(//\)[[^/]]' \| \
756 X[]$1 : 'X\(//\)$' \| \
757 X[]$1 : 'X\(/\)' \| .])
759 m4_defun([_AS_DIRNAME_SED],
761 sed ['/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
779 m4_defun([AS_DIRNAME],
780 [AS_REQUIRE([_$0_PREPARE])dnl
782 _AS_DIRNAME_EXPR([$1]) 2>/dev/null ||
783 _AS_DIRNAME_SED([$1])])
786 # _AS_DIRNAME_PREPARE
787 # --------------------
788 m4_defun([_AS_DIRNAME_PREPARE],
789 [if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
794 ])# _AS_DIRNAME_PREPARE
799 # Output WORD followed by a newline. WORD must be a single shell word
800 # (typically a quoted string). The bytes of WORD are output as-is, even
801 # if it starts with "-" or contains "\".
803 [AS_REQUIRE([_$0_PREPARE])dnl
809 # Like AS_ECHO(WORD), except do not output the trailing newline.
810 m4_defun([AS_ECHO_N],
811 [AS_REQUIRE([_AS_ECHO_PREPARE])dnl
817 # Arrange for $as_echo 'FOO' to echo FOO without escape-interpretation;
818 # and similarly for $as_echo_foo, which omits the trailing newline.
819 # 'FOO' is an optional single argument; a missing FOO is treated as empty.
820 m4_defun([_AS_ECHO_PREPARE],
824 # Printing a long string crashes Solaris 7 /usr/bin/printf.
825 as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
826 as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
827 as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
828 if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
829 as_echo='printf %s\n'
830 as_echo_n='printf %s'
832 if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
833 as_echo_body='eval /usr/ucb/echo -n "$][1$as_nl"'
834 as_echo_n='/usr/ucb/echo -n'
836 as_echo_body='eval expr "X$][1" : "X\\(.*\\)"'
841 expr "X$arg" : "X\\(.*\\)$as_nl";
842 arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
844 expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
846 export as_echo_n_body
847 as_echo_n='sh -c $as_echo_n_body as_echo'
850 as_echo='sh -c $as_echo_body as_echo'
852 ]])# _AS_ECHO_PREPARE
857 # Check whether a file has executable or search permissions.
858 m4_defun([AS_TEST_X],
859 [AS_REQUIRE([_AS_TEST_PREPARE])dnl
866 # Check whether a file is a regular file that has executable permissions.
867 m4_defun([AS_EXECUTABLE_P],
868 [AS_REQUIRE([_AS_TEST_PREPARE])dnl
869 { test -f $1 && AS_TEST_X([$1]); }dnl
875 # QNX 4.25 expr computes and issue the right result but exits with failure.
876 # Tru64 expr mishandles leading zeros in numeric strings.
877 # Detect these flaws.
878 m4_defun([_AS_EXPR_PREPARE],
879 [if expr a : '\(a\)' >/dev/null 2>&1 &&
880 test "X`expr 00001 : '.*\(...\)'`" = X001; then
890 # Succeed if the currently executing shell supports LINENO.
891 # This macro does not expand to a single shell command, so be careful
892 # when using it. Surrounding the body of this macro with {} would
893 # cause "bash -c '_ASLINENO_WORKS'" to fail (with Bash 2.05, anyway),
894 # but that bug is irrelevant to our use of LINENO.
895 m4_define([_AS_LINENO_WORKS],
899 test "x$as_lineno_1" != "x$as_lineno_2" &&
900 test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2"])
905 # If LINENO is not supported by the shell, produce a version of this
906 # script where LINENO is hard coded.
907 # Comparing LINENO against _oline_ is not a good solution, since in
908 # the case of embedded executables (such as config.status within
909 # configure) you'd compare LINENO wrt config.status vs. _oline_ wrt
911 m4_define([_AS_LINENO_PREPARE],
912 [AS_REQUIRE([_AS_CR_PREPARE])dnl
913 _AS_DETECT_SUGGESTED([_AS_LINENO_WORKS])
914 _AS_LINENO_WORKS || {
916 # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
917 # uniformly replaced by the line number. The first 'sed' inserts a
918 # line-number line after each line using $LINENO; the second 'sed'
919 # does the real work. The second script uses 'N' to pair each
920 # line-number line with the line containing $LINENO, and appends
921 # trailing '-' during substitution so that $LINENO is not a special
923 # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
924 # scripts with optimization help from Paolo Bonzini. Blame Lee
925 # E. McMahon (1931-1989) for sed's syntax. :-)
937 s/[[$]]LINENO\([[^'$as_cr_alnum'_]].*\n\)\(.*\)/\2\1\2/
941 chmod +x "$as_me.lineno" ||
942 AS_ERROR([cannot create $as_me.lineno; rerun with a POSIX shell])
944 # Don't try to exec as it changes $[0], causing all sort of problems
945 # (the dirname of $[0] is not the place where we might find the
946 # original and so on. Autoconf is especially sensitive to this).
948 # Exit status is that of the last command.
951 ])# _AS_LINENO_PREPARE
956 # Don't use conftest.sym to avoid file name issues on DJGPP, where this
957 # would yield conftest.sym.exe for DJGPP < 2.04. And don't use `conftest'
958 # as base name to avoid prohibiting concurrency (e.g., concurrent
960 m4_defun([_AS_LN_S_PREPARE],
961 [rm -f conf$$ conf$$.exe conf$$.file
962 if test -d conf$$.dir; then
963 rm -f conf$$.dir/conf$$.file
969 if ln -s conf$$.file conf$$ 2>/dev/null; then
971 # ... but there are two gotchas:
972 # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
973 # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
974 # In both cases, we have to default to `cp -p'.
975 ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
977 elif ln conf$$.file conf$$ 2>/dev/null; then
982 rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
983 rmdir conf$$.dir 2>/dev/null
987 # AS_LN_S(FILE, LINK)
988 # -------------------
989 # FIXME: Should we add the glue code to handle properly relative symlinks
990 # simulated with `ln' or `cp'?
992 [AS_REQUIRE([_AS_LN_S_PREPARE])dnl
999 # Emulate `mkdir -p' with plain `mkdir'.
1000 m4_define([AS_MKDIR_P],
1001 [AS_REQUIRE([_$0_PREPARE])dnl
1004 -*) as_dir=./$as_dir;;
1006 test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
1010 *\'*) as_qdir=`AS_ECHO(["$as_dir"]) | sed "s/'/'\\\\\\\\''/g"`;; #'(
1011 *) as_qdir=$as_dir;;
1013 as_dirs="'$as_qdir' $as_dirs"
1014 as_dir=`AS_DIRNAME("$as_dir")`
1015 test -d "$as_dir" && break
1017 test -z "$as_dirs" || eval "mkdir $as_dirs"
1018 } || test -d "$as_dir" || AS_ERROR([cannot create directory $as_dir]); }dnl
1022 # _AS_MKDIR_P_PREPARE
1023 # -------------------
1024 m4_defun([_AS_MKDIR_P_PREPARE],
1025 [if mkdir -p . 2>/dev/null; then
1028 test -d ./-p && rmdir ./-p
1031 ])# _AS_MKDIR_P_PREPARE
1034 # _AS_PATH_SEPARATOR_PREPARE
1035 # --------------------------
1036 # Compute the path separator.
1037 m4_defun([_AS_PATH_SEPARATOR_PREPARE],
1038 [# The user is always right.
1039 if test "${PATH_SEPARATOR+set}" != set; then
1041 (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
1042 (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
1046 ])# _AS_PATH_SEPARATOR_PREPARE
1049 # _AS_PATH_WALK([PATH = $PATH], BODY)
1050 # -----------------------------------
1051 # Walk through PATH running BODY for each `as_dir'.
1053 # Still very private as its interface looks quite bad.
1055 # `$as_dummy' forces splitting on constant user-supplied paths.
1056 # POSIX.2 field splitting is done only on the result of word
1057 # expansions, not on literal text. This closes a longstanding sh security
1058 # hole. Optimize it away when not needed, i.e., if there are no literal
1060 m4_define([_AS_PATH_WALK],
1061 [AS_REQUIRE([_AS_PATH_SEPARATOR_PREPARE])dnl
1062 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
1063 m4_bmatch([$1], [[:;]],
1065 for as_dir in $as_dummy],
1066 [for as_dir in m4_default([$1], [$PATH])])
1069 test -z "$as_dir" && as_dir=.
1076 # AS_SET_CATFILE(VAR, DIR-NAME, FILE-NAME)
1077 # ----------------------------------------
1078 # Set VAR to DIR-NAME/FILE-NAME.
1079 # Optimize the common case where $2 or $3 is '.'.
1080 m4_define([AS_SET_CATFILE],
1086 [[\\/]]* | ?:[[\\/]]* ) $1=$3;;
1095 # Find out whether `test -x' works. If not, prepare a substitute
1096 # that should work well enough for most scripts.
1098 # Here are some of the problems with the substitute.
1099 # The 'ls' tests whether the owner, not the current user, can execute/search.
1100 # The eval means '*', '?', and '[' cause inadvertent file name globbing
1101 # after the 'eval', so jam together as many tokens as we can to minimize
1102 # the likelihood that the inadvertent globbing will actually do anything.
1103 # Luckily, this gorp is needed only on really ancient hosts.
1105 m4_defun([_AS_TEST_PREPARE],
1106 [if test -x / >/dev/null 2>&1; then
1109 if ls -dL / >/dev/null 2>&1; then
1116 if test -d "$[]1"; then
1122 case `ls -ld'$as_ls_L_option' "$[]1" 2>/dev/null` in
1123 ???[[sx]]*):;;*)false;;esac;fi
1127 dnl as_executable_p is present for backward compatibility with Libtool
1128 dnl 1.5.22, but it should go away at some point.
1129 as_executable_p=$as_test_x
1130 ])# _AS_TEST_PREPARE
1135 ## ------------------ ##
1136 ## 5. Common idioms. ##
1137 ## ------------------ ##
1139 # This section is lexicographically sorted.
1142 # AS_BOX(MESSAGE, [FRAME-CHARACTER = `-'])
1143 # ----------------------------------------
1144 # Output MESSAGE, a single line text, framed with FRAME-CHARACTER (which
1147 [AS_LITERAL_IF([$1],
1148 [_AS_BOX_LITERAL($@)],
1149 [_AS_BOX_INDIR($@)])])
1152 # _AS_BOX_LITERAL(MESSAGE, [FRAME-CHARACTER = `-'])
1153 # -------------------------------------------------
1154 m4_define([_AS_BOX_LITERAL],
1160 # _AS_BOX_INDIR(MESSAGE, [FRAME-CHARACTER = `-'])
1161 # -----------------------------------------------
1162 m4_define([_AS_BOX_INDIR],
1163 [sed 'h;s/./m4_default([$2], [-])/g;s/^.../@%:@@%:@ /;s/...$/ @%:@@%:@/;p;x;p;x' <<_ASBOX
1164 @%:@@%:@ $1 @%:@@%:@
1168 # AS_HELP_STRING(LHS, RHS, [COLUMN])
1169 # ----------------------------------
1171 # Format a help string so that it looks pretty when
1172 # the user executes "script --help". This macro takes three
1173 # arguments, a "left hand side" (LHS), a "right hand side" (RHS), and
1174 # the COLUMN which is a string of white spaces which leads to the
1175 # the RHS column (default: 26 white spaces).
1177 # The resulting string is suitable for use in other macros that require
1178 # a help string (e.g. AC_ARG_WITH).
1180 # Here is the sample string from the Autoconf manual (Node: External
1181 # Software) which shows the proper spacing for help strings.
1183 # --with-readline support fancy command line editing
1186 # | column 2 column 26
1190 # A help string is made up of a "left hand side" (LHS) and a "right
1191 # hand side" (RHS). In the example above, the LHS is
1192 # "--with-readline", while the RHS is "support fancy command line
1195 # If the LHS contains more than (COLUMN - 3) characters, then the LHS is
1196 # terminated with a newline so that the RHS starts on a line of its own
1197 # beginning with COLUMN. In the default case, this corresponds to an
1198 # LHS with more than 23 characters.
1200 # Therefore, in the example, if the LHS were instead
1201 # "--with-readline-blah-blah-blah", then the AS_HELP_STRING macro would
1205 # --with-readline-blah-blah-blah
1206 # ^ ^ support fancy command line editing
1209 # column 0 column 26
1212 # m4_text_wrap hacks^Wworks around the fact that m4_format does not
1213 # know quadrigraphs.
1215 m4_define([AS_HELP_STRING],
1216 [m4_pushdef([AS_Prefix], m4_default([$3], [ ]))dnl
1217 m4_pushdef([AS_Prefix_Format],
1218 [ %-]m4_eval(m4_len(AS_Prefix) - 3)[s ])dnl [ %-23s ]
1219 m4_text_wrap([$2], AS_Prefix, m4_format(AS_Prefix_Format, [[$1]]))dnl
1220 m4_popdef([AS_Prefix_Format])dnl
1221 m4_popdef([AS_Prefix])dnl
1225 # AS_IDENTIFIER_IF(EXPRESSION, IF-IDENT, IF-NOT-IDENT)
1226 # ----------------------------------------------------
1227 # If EXPRESSION serves as an identifier (ie, after removal of @&t@, it
1228 # matches the regex `^[a-zA-Z_][a-zA-Z_0-9]*$'), execute IF-IDENT,
1229 # otherwise IF-NOT-IDENT.
1231 # This is generally faster than the alternative:
1232 # m4_bmatch(m4_bpatsubst([[$1]], [@&t@]), ^m4_defn([m4_re_word])$,
1235 # Rather than expand m4_defn every time AS_IDENTIFIER_IF is expanded, we
1236 # inline its expansion up front. Only use a regular expression if we
1237 # detect a potential quadrigraph.
1239 # First, check if the entire string matches m4_cr_symbol2. Only then do
1240 # we worry if the first character also matches m4_cr_symbol1 (ie. does not
1241 # match m4_cr_digit).
1242 m4_define([AS_IDENTIFIER_IF],
1243 [m4_if(m4_index([$1], [@]), [-1],
1245 [_$0(m4_bpatsubst([[$1]], [@&t@]), [$2], [$3])])])
1246 m4_define([_AS_IDENTIFIER_IF],
1247 [m4_cond([[$1]], [], [$3],
1248 [m4_eval(m4_len(m4_translit([[$1]], ]]dnl
1249 m4_dquote(m4_dquote(m4_defn([m4_cr_symbols2])))[[)) > 0)], [1], [$3],
1250 [m4_len(m4_translit(m4_format([[%.1s]], [$1]), ]]dnl
1251 m4_dquote(m4_dquote(m4_defn([m4_cr_symbols1])))[[))], [0], [$2], [$3])])
1254 # AS_LITERAL_IF(EXPRESSION, IF-LITERAL, IF-NOT-LITERAL)
1255 # -----------------------------------------------------
1256 # If EXPRESSION has shell indirections ($var or `expr`), expand
1257 # IF-INDIR, else IF-NOT-INDIR.
1258 # This is an *approximation*: for instance EXPRESSION = `\$' is
1259 # definitely a literal, but will not be recognized as such.
1261 # Why do we reject EXPRESSION expanding with `[' or `]' as a literal?
1262 # Because AS_TR_SH is MUCH faster if it can use m4_translit on literals
1263 # instead of m4_bpatsubst; but m4_translit is much tougher to do safely
1264 # if `[' is translated.
1266 # Note that the quadrigraph @S|@ can result in non-literals, but outright
1267 # rejecting all @ would make AC_INIT complain on its bug report address.
1269 # We used to use m4_bmatch(m4_quote($1), [[`$]], [$3], [$2]), but
1270 # profiling shows that it is faster to use m4_translit.
1272 # Because the translit is stripping quotes, it must also neutralize anything
1273 # that might be in a macro name, as well as comments and commas. All the
1274 # problem characters are unified so that a single m4_index can scan the
1277 # Rather than expand m4_defn every time AS_LITERAL_IF is expanded, we
1278 # inline its expansion up front.
1279 m4_define([AS_LITERAL_IF],
1280 [m4_cond([m4_eval(m4_index(m4_quote($1), [@S|@]) == -1)], [0], [$3],
1281 [m4_index(m4_translit(m4_quote($1),
1282 [[]`,#]]m4_dquote(m4_defn([m4_cr_symbols2]))[,
1288 # AS_TMPDIR(PREFIX, [DIRECTORY = $TMPDIR [= /tmp]])
1289 # -------------------------------------------------
1290 # Create as safely as possible a temporary directory in DIRECTORY
1291 # which name is inspired by PREFIX (should be 2-4 chars max).
1292 m4_define([AS_TMPDIR],
1293 [# Create a (secure) tmp directory for tmp files.
1294 m4_if([$2], [], [: ${TMPDIR=/tmp}])
1296 tmp=`(umask 077 && mktemp -d "m4_default([$2], [$TMPDIR])/$1XXXXXX") 2>/dev/null` &&
1297 test -n "$tmp" && test -d "$tmp"
1300 tmp=m4_default([$2], [$TMPDIR])/$1$$-$RANDOM
1301 (umask 077 && mkdir "$tmp")
1304 AS_ECHO(["$me: cannot create a temporary directory in m4_default([$2], [$TMPDIR])"]) >&2
1312 # Try to describe this machine. Meant for logs.
1313 m4_define([AS_UNAME],
1316 m4_text_box([Platform.])
1318 hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
1319 uname -m = `(uname -m) 2>/dev/null || echo unknown`
1320 uname -r = `(uname -r) 2>/dev/null || echo unknown`
1321 uname -s = `(uname -s) 2>/dev/null || echo unknown`
1322 uname -v = `(uname -v) 2>/dev/null || echo unknown`
1324 /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
1325 /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
1327 /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
1328 /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
1329 /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
1330 /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown`
1331 /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
1332 /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
1333 /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
1337 _AS_PATH_WALK([$PATH], [AS_ECHO(["PATH: $as_dir"])])
1341 # _AS_VERSION_COMPARE_PREPARE
1342 # ---------------------------
1343 # Output variables for comparing version numbers.
1344 m4_defun([_AS_VERSION_COMPARE_PREPARE],
1345 [[as_awk_strverscmp='
1346 # Use only awk features that work with 7th edition Unix awk (1978).
1347 # My, what an old awk you have, Mr. Solaris!
1349 while (length(v1) && length(v2)) {
1350 # Set d1 to be the next thing to compare from v1, and likewise for d2.
1351 # Normally this is a single character, but if v1 and v2 contain digits,
1352 # compare them as integers and fractions as strverscmp does.
1353 if (v1 ~ /^[0-9]/ && v2 ~ /^[0-9]/) {
1354 # Split v1 and v2 into their leading digit string components d1 and d2,
1355 # and advance v1 and v2 past the leading digit strings.
1356 for (len1 = 1; substr(v1, len1 + 1) ~ /^[0-9]/; len1++) continue
1357 for (len2 = 1; substr(v2, len2 + 1) ~ /^[0-9]/; len2++) continue
1358 d1 = substr(v1, 1, len1); v1 = substr(v1, len1 + 1)
1359 d2 = substr(v2, 1, len2); v2 = substr(v2, len2 + 1)
1362 # Compare two fractions.
1363 while (d1 ~ /^0/ && d2 ~ /^0/) {
1364 d1 = substr(d1, 2); len1--
1365 d2 = substr(d2, 2); len2--
1367 if (len1 != len2 && ! (len1 && len2 && substr(d1, 1, 1) == substr(d2, 1, 1))) {
1368 # The two components differ in length, and the common prefix
1369 # contains only leading zeros. Consider the longer to be less.
1373 # Otherwise, compare as strings.
1378 # A fraction is less than an integer.
1383 # An integer is greater than a fraction.
1386 # Compare two integers.
1392 # The normal case, without worrying about digits.
1393 d1 = substr(v1, 1, 1); v1 = substr(v1, 2)
1394 d2 = substr(v2, 1, 1); v2 = substr(v2, 2)
1399 # Beware Solaris /usr/xgp4/bin/awk (at least through Solaris 10),
1400 # which mishandles some comparisons of empty strings to integers.
1401 if (length(v2)) exit 1
1402 if (length(v1)) exit 2
1404 ']])# _AS_VERSION_COMPARE_PREPARE
1407 # AS_VERSION_COMPARE(VERSION-1, VERSION-2,
1408 # [ACTION-IF-LESS], [ACTION-IF-EQUAL], [ACTION-IF-GREATER])
1409 # -----------------------------------------------------------------------------
1410 # Compare two strings possibly containing shell variables as version strings.
1411 m4_defun([AS_VERSION_COMPARE],
1412 [AS_REQUIRE([_$0_PREPARE])dnl
1415 dnl This usage is portable even to ancient awk,
1416 dnl so don't worry about finding a "nice" awk version.
1417 awk "$as_awk_strverscmp" v1="$as_arg_v1" v2="$as_arg_v2" /dev/null
1423 ])# _AS_VERSION_COMPARE
1427 ## ------------------------------------ ##
1428 ## Common m4/sh character translation. ##
1429 ## ------------------------------------ ##
1431 # The point of this section is to provide high level macros comparable
1432 # to m4's `translit' primitive, but m4/sh polymorphic.
1433 # Transliteration of literal strings should be handled by m4, while
1434 # shell variables' content will be translated at runtime (tr or sed).
1439 # Output variables defining common character ranges.
1440 # See m4_cr_letters etc.
1441 m4_defun([_AS_CR_PREPARE],
1442 [# Avoid depending upon Character Ranges.
1443 as_cr_letters='abcdefghijklmnopqrstuvwxyz'
1444 as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
1445 as_cr_Letters=$as_cr_letters$as_cr_LETTERS
1446 as_cr_digits='0123456789'
1447 as_cr_alnum=$as_cr_Letters$as_cr_digits
1453 m4_defun([_AS_TR_SH_PREPARE],
1454 [AS_REQUIRE([_AS_CR_PREPARE])dnl
1455 # Sed expression to map a string onto a valid variable name.
1456 as_tr_sh="eval sed 'y%*+%pp%;s%[[^_$as_cr_alnum]]%_%g'"
1460 # AS_TR_SH(EXPRESSION)
1461 # --------------------
1462 # Transform EXPRESSION into a valid shell variable name.
1463 # sh/m4 polymorphic.
1464 # Be sure to update the definition of `$as_tr_sh' if you change this.
1466 # AS_LITERAL_IF guarantees that a literal does not have any nested quotes,
1467 # once $1 is expanded. m4_translit silently uses only the first occurrence
1468 # of a character that appears multiple times in argument 2, since we know
1469 # that m4_cr_not_symbols2 also contains [ and ]. m4_translit also silently
1470 # ignores characters in argument 3 that do not match argument 2; we use this
1471 # fact to skip worrying about the length of m4_cr_not_symbols2.
1473 # For speed, we inline the literal definitions that can be computed up front.
1474 m4_defun([AS_TR_SH],
1475 [AS_REQUIRE([_$0_PREPARE])dnl
1477 [m4_translit([$1], [*+[]]]]dnl
1478 m4_dquote(m4_dquote(m4_defn([m4_cr_not_symbols2])))[[,
1480 m4_dquote(m4_dquote(m4_for(,1,255,,[[_]])))[[)],
1481 [`AS_ECHO(["$1"]) | $as_tr_sh`])])
1484 # _AS_TR_CPP_PREPARE
1485 # ------------------
1486 m4_defun([_AS_TR_CPP_PREPARE],
1487 [AS_REQUIRE([_AS_CR_PREPARE])dnl
1488 # Sed expression to map a string onto a valid CPP name.
1489 as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[[^_$as_cr_alnum]]%_%g'"
1493 # AS_TR_CPP(EXPRESSION)
1494 # ---------------------
1495 # Map EXPRESSION to an upper case string which is valid as rhs for a
1496 # `#define'. sh/m4 polymorphic. Be sure to update the definition
1497 # of `$as_tr_cpp' if you change this.
1499 # See implementation comments in AS_TR_SH.
1500 m4_defun([AS_TR_CPP],
1501 [AS_REQUIRE([_$0_PREPARE])dnl
1503 [m4_translit([$1], [*[]]]]dnl
1504 m4_dquote(m4_dquote(m4_defn([m4_cr_letters])m4_defn([m4_cr_not_symbols2])))[[,
1506 m4_dquote(m4_dquote(m4_defn([m4_cr_LETTERS])m4_for(,1,255,,[[_]])))[[)],
1507 [`AS_ECHO(["$1"]) | $as_tr_cpp`])])
1512 m4_defun([_AS_TR_PREPARE],
1513 [AS_REQUIRE([_AS_TR_SH_PREPARE])dnl
1514 AS_REQUIRE([_AS_TR_CPP_PREPARE])dnl
1520 ## --------------------------------------------------- ##
1521 ## Common m4/sh handling of variables (indirections). ##
1522 ## --------------------------------------------------- ##
1525 # The purpose of this section is to provide a uniform API for
1526 # reading/setting sh variables with or without indirection.
1527 # Typically, one can write
1528 # AS_VAR_SET(var, val)
1530 # AS_VAR_SET(as_$var, val)
1531 # and expect the right thing to happen.
1534 # AS_VAR_SET(VARIABLE, VALUE)
1535 # ---------------------------
1536 # Set the VALUE of the shell VARIABLE.
1537 # If the variable contains indirections (e.g. `ac_cv_func_$ac_func')
1538 # perform whenever possible at m4 level, otherwise sh level.
1539 m4_define([AS_VAR_SET],
1540 [AS_LITERAL_IF([$1],
1542 [eval "$1=AS_ESCAPE([$2])"])])
1545 # AS_VAR_GET(VARIABLE)
1546 # --------------------
1547 # Get the value of the shell VARIABLE.
1548 # Evaluates to $VARIABLE if there are no indirection in VARIABLE,
1549 # else into the appropriate `eval' sequence.
1550 # FIXME: This mishandles values that end in newlines.
1551 # Fixing this will require changing the API.
1552 m4_define([AS_VAR_GET],
1553 [AS_LITERAL_IF([$1],
1555 [`eval 'as_val=${'m4_bpatsubst([$1], [[\\`]], [\\\&])'}
1556 AS_ECHO(["$as_val"])'`])])
1559 # AS_VAR_TEST_SET(VARIABLE)
1560 # -------------------------
1561 # Expands into the `test' expression which is true if VARIABLE
1562 # is set. Polymorphic. Should be dnl'ed.
1563 m4_define([AS_VAR_TEST_SET],
1564 [AS_LITERAL_IF([$1],
1565 [test "${$1+set}" = set],
1566 [{ as_var=$1; eval "test \"\${$as_var+set}\" = set"; }])])
1569 # AS_VAR_SET_IF(VARIABLE, IF-TRUE, IF-FALSE)
1570 # ------------------------------------------
1571 # Implement a shell `if-then-else' depending whether VARIABLE is set
1572 # or not. Polymorphic.
1573 m4_define([AS_VAR_SET_IF],
1574 [AS_IF([AS_VAR_TEST_SET([$1])], [$2], [$3])])
1577 # AS_VAR_PUSHDEF and AS_VAR_POPDEF
1578 # --------------------------------
1581 # Sometimes we may have to handle literals (e.g. `stdlib.h'), while at
1582 # other moments, the same code may have to get the value from a
1583 # variable (e.g., `ac_header'). To have a uniform handling of both
1584 # cases, when a new value is about to be processed, declare a local
1587 # AS_VAR_PUSHDEF([header], [ac_cv_header_$1])
1589 # and then in the body of the macro, use `header' as is. It is of
1590 # first importance to use `AS_VAR_*' to access this variable. Don't
1591 # quote its name: it must be used right away by m4.
1593 # If the value `$1' was a literal (e.g. `stdlib.h'), then `header' is
1594 # in fact the value `ac_cv_header_stdlib_h'. If `$1' was indirect,
1595 # then `header's value in m4 is in fact `$as_header', the shell
1596 # variable that holds all of the magic to get the expansion right.
1598 # At the end of the block, free the variable with
1600 # AS_VAR_POPDEF([header])
1603 # AS_VAR_PUSHDEF(VARNAME, VALUE)
1604 # ------------------------------
1605 # Define the m4 macro VARNAME to an accessor to the shell variable
1606 # named VALUE. VALUE does not need to be a valid shell variable name:
1607 # the transliteration is handled here. To be dnl'ed.
1608 m4_define([AS_VAR_PUSHDEF],
1609 [AS_LITERAL_IF([$2],
1610 [m4_pushdef([$1], [AS_TR_SH($2)])],
1612 m4_pushdef([$1], [$as_[$1]])])])
1615 # AS_VAR_POPDEF(VARNAME)
1616 # ----------------------
1617 # Free the shell variable accessor VARNAME. To be dnl'ed.
1618 m4_define([AS_VAR_POPDEF],
1622 ## ----------------- ##
1623 ## Setting M4sh up. ##
1624 ## ----------------- ##
1629 # This temporary macro checks "in the wild" for shells that do
1630 # not support shell functions.
1631 m4_define([_AS_SHELL_FN_SPY],
1632 [_AS_DETECT_SUGGESTED([_AS_SHELL_FN_WORK])
1633 _AS_RUN([_AS_SHELL_FN_WORK]) || {
1634 echo No shell found that supports shell functions.
1635 echo Please tell bug-autoconf@gnu.org about your system,
1636 echo including any error possibly output before this message.
1637 echo This can help us improve future autoconf versions.
1638 echo Configuration will now proceed without shell functions.
1646 m4_define([AS_INIT],
1649 # Forbidden tokens and exceptions.
1650 m4_pattern_forbid([^_?AS_])
1652 # Bangshe and minimal initialization.
1653 m4_divert_text([BINSH], [@%:@! /bin/sh])
1654 m4_divert_text([HEADER-COMMENT],
1655 [@%:@ Generated from __file__ by m4_PACKAGE_STRING.])
1656 m4_divert_text([M4SH-SANITIZE], [AS_SHELL_SANITIZE])
1657 AS_REQUIRE([_AS_SHELL_FN_SPY])
1660 m4_divert_pop([KILL])[]dnl
1661 m4_divert_push([BODY])[]dnl