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, or (at your option)
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
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.
62 # AC_REQUIRE'd #! /bin/sh line
66 # Purpose of the script etc.
74 # The body of the script.
77 # _m4_divert(DIVERSION-NAME)
78 # --------------------------
79 # Convert a diversion name into its number. Otherwise, return
80 # DIVERSION-NAME which is supposed to be an actual diversion number.
81 # Of course it would be nicer to use m4_case here, instead of zillions
82 # of little macros, but it then takes twice longer to run `autoconf'!
83 m4_define([_m4_divert(BINSH)], 0)
84 m4_define([_m4_divert(HEADER-REVISION)], 1)
85 m4_define([_m4_divert(HEADER-COMMENT)], 2)
86 m4_define([_m4_divert(HEADER-COPYRIGHT)], 3)
87 m4_define([_m4_divert(M4SH-SANITIZE)], 4)
88 m4_define([_m4_divert(M4SH-INIT)], 5)
89 m4_define([_m4_divert(BODY)], 1000)
91 # Aaarg. Yet it starts with compatibility issues... Libtool wants to
92 # use NOTICE to insert its own LIBTOOL-INIT stuff. People should ask
93 # before diving into our internals :(
94 m4_copy([_m4_divert(M4SH-INIT)], [_m4_divert(NOTICE)])
98 ## ------------------------- ##
99 ## 1. Sanitizing the shell. ##
100 ## ------------------------- ##
103 # AS_REQUIRE(NAME-TO-CHECK, [BODY-TO-EXPAND = NAME-TO-CHECK])
104 # -----------------------------------------------------------
105 # BODY-TO-EXPAND is some initialization which must be expanded in the
106 # M4SH-INIT section when expanded (required or not). This is very
107 # different from m4_require. For instance:
109 # m4_defun([_FOO_PREPARE], [foo=foo])
111 # [m4_require([_FOO_PREPARE])dnl
114 # m4_defun([_BAR_PREPARE], [bar=bar])
116 # [AS_REQUIRE([_BAR_PREPARE])dnl
136 # Due to the simple implementation, all the AS_REQUIRE calls have to be at
137 # the very beginning of the macro body, or the AS_REQUIREs may not be nested.
138 # More exactly, if a macro doesn't have all AS_REQUIREs at its beginning,
139 # it may not be AS_REQUIREd.
141 m4_define([AS_REQUIRE],
142 [m4_provide_if([$1], [],
143 [m4_divert_text([M4SH-INIT], [m4_default([$2], [$1])])])])
146 # AS_REQUIRE_SHELL_FN(NAME-TO-CHECK, BODY-TO-EXPAND)
147 # --------------------------------------------------
148 # BODY-TO-EXPAND is the body of a shell function to be emitted in the
149 # M4SH-INIT section when expanded (required or not). Unlike other
150 # xx_REQUIRE macros, BODY-TO-EXPAND is mandatory.
152 m4_define([AS_REQUIRE_SHELL_FN],
153 [_AS_DETECT_REQUIRED([_AS_SHELL_FN_WORK])dnl
154 m4_provide_if([AS_SHELL_FN_$1], [],
155 [m4_provide([AS_SHELL_FN_$1])m4_divert_text([M4SH-INIT], [$1() {
160 # AS_BOURNE_COMPATIBLE
161 # --------------------
162 # Try to be as Bourne and/or POSIX as possible.
164 # This does not set BIN_SH, due to the problems described in
165 # <http://lists.gnu.org/archive/html/autoconf-patches/2006-03/msg00081.html>.
166 # People who need BIN_SH should set it in their environment before invoking
167 # configure; apparently this would include UnixWare, as described in
168 # <http://lists.gnu.org/archive/html/bug-autoconf/2006-06/msg00025.html>.
169 m4_define([AS_BOURNE_COMPATIBLE],
170 [# Be more Bourne compatible
171 DUALCASE=1; export DUALCASE # for MKS sh
175 # _AS_BOURNE_COMPATIBLE
176 # ---------------------
177 # This is the part of AS_BOURNE_COMPATIBLE which has to be repeated inside
179 m4_define([_AS_BOURNE_COMPATIBLE],
180 [AS_IF([test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1],
183 [#] Pre-4.2 versions of Zsh do word splitting on ${1+"$[@]"}, which
184 # is contrary to our usage. Disable this feature.
185 alias -g '${1+"$[@]"}'='"$[@]"'
186 setopt NO_GLOB_SUBST],
187 [AS_CASE([`(set -o) 2>/dev/null`], [*posix*], [set -o posix])])
191 # _AS_RUN(TEST, [SHELL])
192 # ----------------------
193 # Run TEST under the current shell (if one parameter is used)
194 # or under the given SHELL, protecting it from syntax errors.
198 _AS_BOURNE_COMPATIBLE
202 [(eval "AS_ESCAPE(m4_quote($1))")])])
205 # _AS_DETECT_REQUIRED(TEST)
206 # -------------------------
207 # Refuse to execute under a shell that does not pass the given TEST.
208 m4_define([_AS_DETECT_REQUIRED_BODY], [:])
209 m4_defun([_AS_DETECT_REQUIRED],
210 [m4_require([_AS_DETECT_BETTER_SHELL])dnl
211 m4_expand_once([m4_append([_AS_DETECT_REQUIRED_BODY], [
213 ])], [_AS_DETECT_REQUIRED_provide($1)])])
216 # _AS_DETECT_SUGGESTED(TEST)
217 # --------------------------
218 # Prefer to execute under a shell that passes the given TEST.
219 m4_define([_AS_DETECT_SUGGESTED_BODY], [:])
220 m4_defun([_AS_DETECT_SUGGESTED],
221 [m4_require([_AS_DETECT_BETTER_SHELL])dnl
222 m4_expand_once([m4_append([_AS_DETECT_SUGGESTED_BODY], [
224 ])], [_AS_DETECT_SUGGESTED_provide($1)])])
227 # _AS_DETECT_BETTER_SHELL
228 # -----------------------
229 # The real workhorse for detecting a shell with the correct
232 # In previous versions, we prepended /usr/posix/bin to the path, but that
233 # caused a regression on OpenServer 6.0.0
234 # <http://lists.gnu.org/archive/html/bug-autoconf/2006-06/msg00017.html>
235 # and on HP-UX 11.11, see the failure of test 120 in
236 # <http://lists.gnu.org/archive/html/bug-autoconf/2006-10/msg00003.html>
238 # FIXME: The code should test for the OSF bug described in
239 # <http://lists.gnu.org/archive/html/autoconf-patches/2006-03/msg00081.html>.
241 m4_defun_once([_AS_DETECT_BETTER_SHELL],
242 [m4_wrap([m4_divert_text([M4SH-SANITIZE], [
243 AS_REQUIRE([_AS_UNSET_PREPARE])dnl
244 if test "x$CONFIG_SHELL" = x; then
245 AS_IF([_AS_RUN([_AS_DETECT_REQUIRED_BODY]) 2>/dev/null],
246 [as_have_required=yes],
247 [as_have_required=no])
248 AS_IF([test $as_have_required = yes && dnl
249 _AS_RUN([_AS_DETECT_SUGGESTED_BODY]) 2> /dev/null],
251 [as_candidate_shells=
252 _AS_PATH_WALK([/bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH],
255 for as_base in sh bash ksh sh5; do
256 as_candidate_shells="$as_candidate_shells $as_dir/$as_base"
260 for as_shell in $as_candidate_shells $SHELL; do
261 # Try only shells that exist, to save several forks.
262 AS_IF([{ test -f "$as_shell" || test -f "$as_shell.exe"; } &&
263 _AS_RUN([_AS_DETECT_REQUIRED_BODY],
264 [("$as_shell") 2> /dev/null])],
265 [CONFIG_SHELL=$as_shell
267 AS_IF([_AS_RUN([_AS_DETECT_SUGGESTED_BODY], ["$as_shell" 2> /dev/null])],
271 AS_IF([test "x$CONFIG_SHELL" != x],
272 [for as_var in BASH_ENV ENV
273 do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
276 exec "$CONFIG_SHELL" "$as_myself" ${1+"$[@]"}])
278 AS_IF([test $as_have_required = no],
279 [echo This script requires a shell more modern than all the
280 echo shells that I found on your system. Please install a
281 echo modern shell, or manually run the script under such a
282 echo shell if you do have one.
286 ])])])# _AS_DETECT_BETTER_SHELL
291 # This is a spy to detect "in the wild" shells that do not support shell
292 # functions correctly. It is based on the m4sh.at Autotest testcases.
293 m4_define([_AS_SHELL_FN_WORK],
303 as_func_ret_success () {
306 as_func_ret_failure () {
311 AS_IF([as_func_success], [],
313 echo as_func_success failed.])
314 AS_IF([as_func_failure],
316 echo as_func_failure succeeded.])
317 AS_IF([as_func_ret_success], [],
319 echo as_func_ret_success failed.])
320 AS_IF([as_func_ret_failure],
322 echo as_func_ret_failure succeeded.])
323 AS_IF([( set x; as_func_ret_success y && test x = "[$]1" )], [],
325 echo positional parameters were not saved.])
326 test $exitcode = 0[]dnl
327 ])# _AS_SHELL_FN_WORK
332 # Emit TEXT, a copyright notice, as a shell comment near the top of the
333 # script. TEXT is evaluated once; to accomplish that, we do not prepend
335 m4_define([AS_COPYRIGHT],
336 [m4_divert_text([HEADER-COPYRIGHT],
338 $1], [^], [@%:@ ])])])
343 m4_defun([AS_SHELL_SANITIZE],
344 [## --------------------- ##
345 ## M4sh Initialization. ##
346 ## --------------------- ##
353 _AS_PATH_SEPARATOR_PREPARE
357 # We need space, tab and new line, in precisely that order. Quoting is
358 # there to prevent editors from complaining about space-tab.
359 # (If _AS_PATH_WALK were called with IFS unset, it would disable word
360 # splitting by setting IFS to empty value.)
363 # Find who we are. Look in the path if we contain no directory separator.
365 *[[\\/]]* ) as_myself=$[0] ;;
367 [test -r "$as_dir/$[0]" && as_myself=$as_dir/$[0] && break])
370 # We did not find ourselves, most probably we were run as `sh COMMAND'
371 # in which case we are not to be found in the path.
372 if test "x$as_myself" = x; then
375 if test ! -f "$as_myself"; then
376 AS_ECHO(["$as_myself: error: cannot find myself; rerun with an absolute file name"]) >&2
380 # Work around bugs in pre-3.0 UWIN ksh.
381 for as_var in ENV MAIL MAILPATH
382 do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
390 LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
391 LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
394 if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
395 eval $as_var=C; export $as_var
397 ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
401 # Required to use basename.
405 # Name of the executable.
406 as_me=`AS_BASENAME("$[0]")`
410 ])# AS_SHELL_SANITIZE
415 # This macro has a very special status. Normal use of M4sh relies
416 # heavily on AS_REQUIRE, so that needed initializations (such as
417 # _AS_TEST_PREPARE) are performed on need, not on demand. But
418 # Autoconf is the first client of M4sh, and for two reasons: configure
419 # and config.status. Relying on AS_REQUIRE is of course fine for
420 # configure, but fails for config.status (which is created by
421 # configure). So we need a means to force the inclusion of the
422 # various _AS_PREPARE_* on top of config.status. That's basically why
423 # there are so many _AS_PREPARE_* below, and that's also why it is
424 # important not to forget some: config.status needs them.
425 m4_defun([_AS_PREPARE],
429 _AS_ECHO_N_PREPARE[]dnl We do not need this ourselves but user code might.
441 # Output all the M4sh possible initialization into the initialization
443 m4_defun([AS_PREPARE],
444 [m4_divert_text([M4SH-INIT], [_AS_PREPARE])])
447 ## ----------------------------- ##
448 ## 2. Wrappers around builtins. ##
449 ## ----------------------------- ##
451 # This section is lexicographically sorted.
454 # AS_CASE(WORD, [PATTERN1], [IF-MATCHED1]...[DEFAULT])
455 # ----------------------------------------------------
458 # | PATTERN1) IF-MATCHED1 ;;
462 m4_define([_AS_CASE],
463 [m4_if([$#], 0, [m4_fatal([$0: too few arguments: $#])],
464 [$#], 1, [ *) $1 ;;],
465 [$#], 2, [ $1) m4_default([$2], [:]) ;;],
466 [ $1) m4_default([$2], [:]) ;;
467 $0(m4_shiftn(2, $@))])dnl
472 _AS_CASE(m4_shift($@))
478 # AS_EXIT([EXIT-CODE = 1])
479 # ------------------------
480 # Exit and set exit code to EXIT-CODE in the way that it's seen
483 # We cannot simply use "exit N" because some shells (zsh and Solaris sh)
484 # will not set $? to N while running the code set by "trap 0"
485 # So we set $? by executing "exit N" in the subshell and then exit.
486 # Other shells don't use `$?' as default for `exit', hence just repeating
487 # the exit value can only help improving portability.
489 [{ (exit m4_default([$1], 1)); exit m4_default([$1], 1); }])
492 # AS_IF(TEST1, [IF-TRUE1]...[IF-FALSE])
493 # -------------------------------------
503 # with simplifications if IF-TRUE1 and/or IF-FALSE is empty.
508 m4_default([$2], [:])
509 m4_ifval([$3], [$0(m4_shiftn(2, $@))])],
518 m4_default([$2], [:])
519 m4_ifval([$3], [_$0(m4_shiftn(2, $@))])[]dnl
527 # AS_UNSET depends upon $as_unset: compute it.
528 # Use MAIL to trigger a bug in Bash 2.01;
529 # the "|| exit" suppresses the resulting "Segmentation fault" message.
530 # Avoid 'if ((', as that triggers a bug in pdksh 5.2.14.
531 m4_defun([_AS_UNSET_PREPARE],
532 [# Support unset when possible.
533 if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
541 # AS_UNSET(VAR, [VALUE-IF-UNSET-NOT-SUPPORTED = `'])
542 # --------------------------------------------------
543 # Try to unset the env VAR, otherwise set it to
544 # VALUE-IF-UNSET-NOT-SUPPORTED. `as_unset' must have been computed.
546 [AS_REQUIRE([_AS_UNSET_PREPARE])dnl
547 $as_unset $1 || test "${$1+set}" != set || { $1=$2; export $1; }])
554 ## ------------------------------------------ ##
555 ## 3. Error and warnings at the shell level. ##
556 ## ------------------------------------------ ##
558 # If AS_MESSAGE_LOG_FD is defined, shell messages are duplicated there
562 # AS_ESCAPE(STRING, [CHARS = $"`\])
563 # ---------------------------------
564 # Escape the CHARS in STRING.
565 m4_define([AS_ESCAPE],
567 m4_dquote(m4_default([$2], [\"$`])),
571 # _AS_QUOTE_IFELSE(STRING, IF-MODERN-QUOTATION, IF-OLD-QUOTATION)
572 # ---------------------------------------------------------------
573 # Compatibility glue between the old AS_MSG suite which did not
574 # quote anything, and the modern suite which quotes the quotes.
575 # If STRING contains `\\' or `\$', it's modern.
576 # If STRING contains `\"' or `\`', it's old.
577 # Otherwise it's modern.
578 # We use two quotes in the pattern to keep highlighting tools at peace.
579 m4_define([_AS_QUOTE_IFELSE],
586 # _AS_QUOTE(STRING, [CHARS = `"])
587 # -------------------------------
588 # If there are quoted (via backslash) backquotes do nothing, else
589 # backslash all the quotes.
590 m4_define([_AS_QUOTE],
591 [_AS_QUOTE_IFELSE([$1],
592 [AS_ESCAPE([$1], m4_default([$2], [`""]))],
594 [back quotes and double quotes must not be escaped in: $1])dnl
598 # _AS_ECHO_UNQUOTED(STRING, [FD = AS_MESSAGE_FD])
599 # -----------------------------------------------
600 # Perform shell expansions on STRING and echo the string to FD.
601 m4_define([_AS_ECHO_UNQUOTED],
602 [AS_ECHO(["$1"]) >&m4_default([$2], [AS_MESSAGE_FD])])
605 # _AS_ECHO(STRING, [FD = AS_MESSAGE_FD])
606 # --------------------------------------
607 # Protect STRING from backquote expansion, echo the result to FD.
608 m4_define([_AS_ECHO],
609 [_AS_ECHO_UNQUOTED([_AS_QUOTE([$1])], [$2])])
612 # _AS_ECHO_LOG(STRING)
613 # --------------------
614 # Log the string to AS_MESSAGE_LOG_FD.
615 m4_define([_AS_ECHO_LOG],
616 [_AS_ECHO([$as_me:$LINENO: $1], [AS_MESSAGE_LOG_FD])])
621 # Check whether to use -n, \c, or newline-tab to separate
622 # checking messages from result messages.
623 # Don't try to cache, since the results of this macro are needed to
624 # display the checking message. In addition, caching something used once
625 # has little interest.
626 # Idea borrowed from dist 3.0. Use `*c*,', not `*c,' because if `\c'
627 # failed there is also a newline to match.
628 m4_defun([_AS_ECHO_N_PREPARE],
629 [ECHO_C= ECHO_N= ECHO_T=
633 *c*) ECHO_T=' ';; # ECHO_T is single tab character.
639 ])# _AS_ECHO_N_PREPARE
642 # _AS_ECHO_N(STRING, [FD = AS_MESSAGE_FD])
643 # ----------------------------------------
644 # Same as _AS_ECHO, but echo doesn't return to a new line.
645 m4_define([_AS_ECHO_N],
646 [AS_ECHO_N(["_AS_QUOTE([$1])"]) >&m4_default([$2], [AS_MESSAGE_FD])])
649 # AS_MESSAGE(STRING, [FD = AS_MESSAGE_FD])
650 # ----------------------------------------
651 m4_define([AS_MESSAGE],
652 [m4_ifset([AS_MESSAGE_LOG_FD],
653 [{ _AS_ECHO_LOG([$1])
654 _AS_ECHO([$as_me: $1], [$2]);}],
655 [_AS_ECHO([$as_me: $1], [$2])])[]dnl
662 [AS_MESSAGE([WARNING: $1], [2])])# AS_WARN
665 # AS_ERROR(ERROR, [EXIT-STATUS = 1])
666 # ----------------------------------
667 m4_define([AS_ERROR],
668 [{ AS_MESSAGE([error: $1], [2])
669 AS_EXIT([$2]); }[]dnl
674 ## -------------------------------------- ##
675 ## 4. Portable versions of common tools. ##
676 ## -------------------------------------- ##
678 # This section is lexicographically sorted.
681 # AS_BASENAME(FILE-NAME)
682 # ----------------------
683 # Simulate the command 'basename FILE-NAME'. Not all systems have basename.
684 # Also see the comments for AS_DIRNAME.
686 m4_defun([_AS_BASENAME_EXPR],
687 [AS_REQUIRE([_AS_EXPR_PREPARE])dnl
688 $as_expr X/[]$1 : '.*/\([[^/][^/]*]\)/*$' \| \
689 X[]$1 : 'X\(//\)$' \| \
690 X[]$1 : 'X\(/\)' \| .])
692 m4_defun([_AS_BASENAME_SED],
694 sed ['/^.*\/\([^/][^/]*\)\/*$/{
708 m4_defun([AS_BASENAME],
709 [AS_REQUIRE([_$0_PREPARE])dnl
710 $as_basename -- $1 ||
711 _AS_BASENAME_EXPR([$1]) 2>/dev/null ||
712 _AS_BASENAME_SED([$1])])
715 # _AS_BASENAME_PREPARE
716 # --------------------
717 # Avoid Solaris 9 /usr/ucb/basename, as `basename /' outputs an empty line.
718 # Also, traditional basename mishandles --.
719 m4_defun([_AS_BASENAME_PREPARE],
720 [if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
725 ])# _AS_BASENAME_PREPARE
728 # AS_DIRNAME(FILE-NAME)
729 # ---------------------
730 # Simulate the command 'dirname FILE-NAME'. Not all systems have dirname.
731 # This macro must be usable from inside ` `.
733 # Prefer expr to echo|sed, since expr is usually faster and it handles
734 # backslashes and newlines correctly. However, older expr
735 # implementations (e.g. SunOS 4 expr and Solaris 8 /usr/ucb/expr) have
736 # a silly length limit that causes expr to fail if the matched
737 # substring is longer than 120 bytes. So fall back on echo|sed if
739 m4_defun([_AS_DIRNAME_EXPR],
740 [AS_REQUIRE([_AS_EXPR_PREPARE])dnl
741 $as_expr X[]$1 : 'X\(.*[[^/]]\)//*[[^/][^/]]*/*$' \| \
742 X[]$1 : 'X\(//\)[[^/]]' \| \
743 X[]$1 : 'X\(//\)$' \| \
744 X[]$1 : 'X\(/\)' \| .])
746 m4_defun([_AS_DIRNAME_SED],
748 sed ['/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
766 m4_defun([AS_DIRNAME],
767 [AS_REQUIRE([_$0_PREPARE])dnl
769 _AS_DIRNAME_EXPR([$1]) 2>/dev/null ||
770 _AS_DIRNAME_SED([$1])])
773 # _AS_DIRNAME_PREPARE
774 # --------------------
775 m4_defun([_AS_DIRNAME_PREPARE],
776 [if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
781 ])# _AS_DIRNAME_PREPARE
786 # Output WORD followed by a newline. WORD must be a single shell word
787 # (typically a quoted string). The bytes of WORD are output as-is, even
788 # if it starts with "-" or contains "\".
790 [AS_REQUIRE([_$0_PREPARE])dnl
796 # Like AS_ECHO(WORD), except do not output the trailing newline.
797 m4_defun([AS_ECHO_N],
798 [AS_REQUIRE([_AS_ECHO_PREPARE])dnl
804 # Arrange for $as_echo 'FOO' to echo FOO without escape-interpretation;
805 # and similarly for $as_echo_foo, which omits the trailing newline.
806 # 'FOO' is an optional single argument; a missing FOO is treated as empty.
807 m4_defun([_AS_ECHO_PREPARE],
811 # Printing a long string crashes Solaris 7 /usr/bin/printf.
812 as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
813 as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
814 as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
815 if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
816 as_echo='printf %s\n'
817 as_echo_n='printf %s'
819 if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
820 as_echo_body='eval /usr/ucb/echo -n "$][1$as_nl"'
821 as_echo_n='/usr/ucb/echo -n'
823 as_echo_body='eval expr "X$][1" : "X\\(.*\\)"'
828 expr "X$arg" : "X\\(.*\\)$as_nl";
829 arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
831 expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
833 export as_echo_n_body
834 as_echo_n='sh -c $as_echo_n_body as_echo'
837 as_echo='sh -c $as_echo_body as_echo'
839 ]])# _AS_ECHO_PREPARE
844 # Check whether a file has executable or search permissions.
845 m4_defun([AS_TEST_X],
846 [AS_REQUIRE([_AS_TEST_PREPARE])dnl
853 # Check whether a file is a regular file that has executable permissions.
854 m4_defun([AS_EXECUTABLE_P],
855 [AS_REQUIRE([_AS_TEST_PREPARE])dnl
856 { test -f $1 && AS_TEST_X([$1]); }dnl
862 # QNX 4.25 expr computes and issue the right result but exits with failure.
863 # Tru64 expr mishandles leading zeros in numeric strings.
864 # Detect these flaws.
865 m4_defun([_AS_EXPR_PREPARE],
866 [if expr a : '\(a\)' >/dev/null 2>&1 &&
867 test "X`expr 00001 : '.*\(...\)'`" = X001; then
877 # Succeed if the currently executing shell supports LINENO.
878 # This macro does not expand to a single shell command, so be careful
879 # when using it. Surrounding the body of this macro with {} would
880 # cause "bash -c '_ASLINENO_WORKS'" to fail (with Bash 2.05, anyway),
881 # but that bug is irrelevant to our use of LINENO.
882 m4_define([_AS_LINENO_WORKS],
886 test "x$as_lineno_1" != "x$as_lineno_2" &&
887 test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2"])
892 # If LINENO is not supported by the shell, produce a version of this
893 # script where LINENO is hard coded.
894 # Comparing LINENO against _oline_ is not a good solution, since in
895 # the case of embedded executables (such as config.status within
896 # configure) you'd compare LINENO wrt config.status vs. _oline_ wrt
898 m4_define([_AS_LINENO_PREPARE],
899 [AS_REQUIRE([_AS_CR_PREPARE])dnl
900 _AS_DETECT_SUGGESTED([_AS_LINENO_WORKS])
901 _AS_LINENO_WORKS || {
903 # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
904 # uniformly replaced by the line number. The first 'sed' inserts a
905 # line-number line after each line using $LINENO; the second 'sed'
906 # does the real work. The second script uses 'N' to pair each
907 # line-number line with the line containing $LINENO, and appends
908 # trailing '-' during substitution so that $LINENO is not a special
910 # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
911 # scripts with optimization help from Paolo Bonzini. Blame Lee
912 # E. McMahon (1931-1989) for sed's syntax. :-)
924 s/[[$]]LINENO\([[^'$as_cr_alnum'_]].*\n\)\(.*\)/\2\1\2/
928 chmod +x "$as_me.lineno" ||
929 AS_ERROR([cannot create $as_me.lineno; rerun with a POSIX shell])
931 # Don't try to exec as it changes $[0], causing all sort of problems
932 # (the dirname of $[0] is not the place where we might find the
933 # original and so on. Autoconf is especially sensitive to this).
935 # Exit status is that of the last command.
938 ])# _AS_LINENO_PREPARE
943 # Don't use conftest.sym to avoid file name issues on DJGPP, where this
944 # would yield conftest.sym.exe for DJGPP < 2.04. And don't use `conftest'
945 # as base name to avoid prohibiting concurrency (e.g., concurrent
947 m4_defun([_AS_LN_S_PREPARE],
948 [rm -f conf$$ conf$$.exe conf$$.file
949 if test -d conf$$.dir; then
950 rm -f conf$$.dir/conf$$.file
956 if ln -s conf$$.file conf$$ 2>/dev/null; then
958 # ... but there are two gotchas:
959 # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
960 # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
961 # In both cases, we have to default to `cp -p'.
962 ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
964 elif ln conf$$.file conf$$ 2>/dev/null; then
969 rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
970 rmdir conf$$.dir 2>/dev/null
974 # AS_LN_S(FILE, LINK)
975 # -------------------
976 # FIXME: Should we add the glue code to handle properly relative symlinks
977 # simulated with `ln' or `cp'?
979 [AS_REQUIRE([_AS_LN_S_PREPARE])dnl
986 # Emulate `mkdir -p' with plain `mkdir'.
987 m4_define([AS_MKDIR_P],
988 [AS_REQUIRE([_$0_PREPARE])dnl
991 -*) as_dir=./$as_dir;;
993 test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
997 *\'*) as_qdir=`AS_ECHO(["$as_dir"]) | sed "s/'/'\\\\\\\\''/g"`;; #(
1000 as_dirs="'$as_qdir' $as_dirs"
1001 as_dir=`AS_DIRNAME("$as_dir")`
1002 test -d "$as_dir" && break
1004 test -z "$as_dirs" || eval "mkdir $as_dirs"
1005 } || test -d "$as_dir" || AS_ERROR([cannot create directory $as_dir]); }dnl
1009 # _AS_MKDIR_P_PREPARE
1010 # -------------------
1011 m4_defun([_AS_MKDIR_P_PREPARE],
1012 [if mkdir -p . 2>/dev/null; then
1015 test -d ./-p && rmdir ./-p
1018 ])# _AS_MKDIR_P_PREPARE
1021 # _AS_PATH_SEPARATOR_PREPARE
1022 # --------------------------
1023 # Compute the path separator.
1024 m4_defun([_AS_PATH_SEPARATOR_PREPARE],
1025 [# The user is always right.
1026 if test "${PATH_SEPARATOR+set}" != set; then
1027 echo "#! /bin/sh" >conf$$.sh
1028 echo "exit 0" >>conf$$.sh
1030 if (PATH="/nonexistent;."; FPATH=$PATH; conf$$.sh) >/dev/null 2>&1; then
1037 ])# _AS_PATH_SEPARATOR_PREPARE
1040 # _AS_PATH_WALK([PATH = $PATH], BODY)
1041 # -----------------------------------
1042 # Walk through PATH running BODY for each `as_dir'.
1044 # Still very private as its interface looks quite bad.
1046 # `$as_dummy' forces splitting on constant user-supplied paths.
1047 # POSIX.2 field splitting is done only on the result of word
1048 # expansions, not on literal text. This closes a longstanding sh security
1049 # hole. Optimize it away when not needed, i.e., if there are no literal
1051 m4_define([_AS_PATH_WALK],
1052 [AS_REQUIRE([_AS_PATH_SEPARATOR_PREPARE])dnl
1053 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
1054 m4_bmatch([$1], [[:;]],
1056 for as_dir in $as_dummy],
1057 [for as_dir in m4_default([$1], [$PATH])])
1060 test -z "$as_dir" && as_dir=.
1067 # AS_SET_CATFILE(VAR, DIR-NAME, FILE-NAME)
1068 # ----------------------------------------
1069 # Set VAR to DIR-NAME/FILE-NAME.
1070 # Optimize the common case where $2 or $3 is '.'.
1071 m4_define([AS_SET_CATFILE],
1077 [[\\/]]* | ?:[[\\/]]* ) $1=$3;;
1086 # Find out whether `test -x' works. If not, prepare a substitute
1087 # that should work well enough for most scripts.
1089 # Here are some of the problems with the substitute.
1090 # The 'ls' tests whether the owner, not the current user, can execute/search.
1091 # The eval means '*', '?', and '[' cause inadvertent file name globbing
1092 # after the 'eval', so jam together as many tokens as we can to minimize
1093 # the likelihood that the inadvertent globbing will actually do anything.
1094 # Luckily, this gorp is needed only on really ancient hosts.
1096 m4_defun([_AS_TEST_PREPARE],
1097 [if test -x / >/dev/null 2>&1; then
1100 if ls -dL / >/dev/null 2>&1; then
1107 if test -d "$[]1"; then
1113 case `ls -ld'$as_ls_L_option' "$[]1" 2>/dev/null` in
1114 ???[[sx]]*):;;*)false;;esac;fi
1118 dnl as_executable_p is present for backward compatibility with Libtool
1119 dnl 1.5.22, but it should go away at some point.
1120 as_executable_p=$as_test_x
1121 ])# _AS_TEST_PREPARE
1126 ## ------------------ ##
1127 ## 5. Common idioms. ##
1128 ## ------------------ ##
1130 # This section is lexicographically sorted.
1133 # AS_BOX(MESSAGE, [FRAME-CHARACTER = `-'])
1134 # ----------------------------------------
1135 # Output MESSAGE, a single line text, framed with FRAME-CHARACTER (which
1138 [AS_LITERAL_IF([$1],
1139 [_AS_BOX_LITERAL($@)],
1140 [_AS_BOX_INDIR($@)])])
1143 # _AS_BOX_LITERAL(MESSAGE, [FRAME-CHARACTER = `-'])
1144 # -------------------------------------------------
1145 m4_define([_AS_BOX_LITERAL],
1151 # _AS_BOX_INDIR(MESSAGE, [FRAME-CHARACTER = `-'])
1152 # -----------------------------------------------
1153 m4_define([_AS_BOX_INDIR],
1154 [sed 'h;s/./m4_default([$2], [-])/g;s/^.../@%:@@%:@ /;s/...$/ @%:@@%:@/;p;x;p;x' <<_ASBOX
1155 @%:@@%:@ $1 @%:@@%:@
1159 # AS_HELP_STRING(LHS, RHS, [COLUMN])
1160 # ----------------------------------
1162 # Format a help string so that it looks pretty when
1163 # the user executes "script --help". This macro takes three
1164 # arguments, a "left hand side" (LHS), a "right hand side" (RHS), and
1165 # the COLUMN which is a string of white spaces which leads to the
1166 # the RHS column (default: 26 white spaces).
1168 # The resulting string is suitable for use in other macros that require
1169 # a help string (e.g. AC_ARG_WITH).
1171 # Here is the sample string from the Autoconf manual (Node: External
1172 # Software) which shows the proper spacing for help strings.
1174 # --with-readline support fancy command line editing
1177 # | column 2 column 26
1181 # A help string is made up of a "left hand side" (LHS) and a "right
1182 # hand side" (RHS). In the example above, the LHS is
1183 # "--with-readline", while the RHS is "support fancy command line
1186 # If the LHS contains more than (COLUMN - 3) characters, then the LHS is
1187 # terminated with a newline so that the RHS starts on a line of its own
1188 # beginning with COLUMN. In the default case, this corresponds to an
1189 # LHS with more than 23 characters.
1191 # Therefore, in the example, if the LHS were instead
1192 # "--with-readline-blah-blah-blah", then the AS_HELP_STRING macro would
1196 # --with-readline-blah-blah-blah
1197 # ^ ^ support fancy command line editing
1200 # column 0 column 26
1203 # m4_text_wrap hacks^Wworks around the fact that m4_format does not
1204 # know quadrigraphs.
1206 m4_define([AS_HELP_STRING],
1207 [m4_pushdef([AS_Prefix], m4_default([$3], [ ]))dnl
1208 m4_pushdef([AS_Prefix_Format],
1209 [ %-]m4_eval(m4_len(AS_Prefix) - 3)[s ])dnl [ %-23s ]
1210 m4_text_wrap([$2], AS_Prefix, m4_format(AS_Prefix_Format, [$1]))dnl
1211 m4_popdef([AS_Prefix_Format])dnl
1212 m4_popdef([AS_Prefix])dnl
1216 # AS_LITERAL_IF(EXPRESSION, IF-LITERAL, IF-NOT-LITERAL)
1217 # -----------------------------------------------------
1218 # If EXPRESSION has shell indirections ($var or `expr`), expand
1219 # IF-INDIR, else IF-NOT-INDIR.
1220 # This is an *approximation*: for instance EXPRESSION = `\$' is
1221 # definitely a literal, but will not be recognized as such.
1222 m4_define([AS_LITERAL_IF],
1223 [m4_bmatch(m4_quote($1), [[`$]],
1227 # AS_TMPDIR(PREFIX, [DIRECTORY = $TMPDIR [= /tmp]])
1228 # -------------------------------------------------
1229 # Create as safely as possible a temporary directory in DIRECTORY
1230 # which name is inspired by PREFIX (should be 2-4 chars max).
1231 m4_define([AS_TMPDIR],
1232 [# Create a (secure) tmp directory for tmp files.
1233 m4_if([$2], [], [: ${TMPDIR=/tmp}])
1235 tmp=`(umask 077 && mktemp -d "m4_default([$2], [$TMPDIR])/$1XXXXXX") 2>/dev/null` &&
1236 test -n "$tmp" && test -d "$tmp"
1239 tmp=m4_default([$2], [$TMPDIR])/$1$$-$RANDOM
1240 (umask 077 && mkdir "$tmp")
1243 AS_ECHO(["$me: cannot create a temporary directory in m4_default([$2], [$TMPDIR])"]) >&2
1251 # Try to describe this machine. Meant for logs.
1252 m4_define([AS_UNAME],
1255 m4_text_box([Platform.])
1257 hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
1258 uname -m = `(uname -m) 2>/dev/null || echo unknown`
1259 uname -r = `(uname -r) 2>/dev/null || echo unknown`
1260 uname -s = `(uname -s) 2>/dev/null || echo unknown`
1261 uname -v = `(uname -v) 2>/dev/null || echo unknown`
1263 /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
1264 /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
1266 /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
1267 /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
1268 /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
1269 /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown`
1270 /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
1271 /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
1272 /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
1276 _AS_PATH_WALK([$PATH], [AS_ECHO(["PATH: $as_dir"])])
1280 # _AS_VERSION_COMPARE_PREPARE
1281 # ---------------------------
1282 # Output variables for comparing version numbers.
1283 m4_defun([_AS_VERSION_COMPARE_PREPARE],
1284 [[as_awk_strverscmp='
1285 # Use only awk features that work with 7th edition Unix awk (1978).
1286 # My, what an old awk you have, Mr. Solaris!
1288 while (length(v1) && length(v2)) {
1289 # Set d1 to be the next thing to compare from v1, and likewise for d2.
1290 # Normally this is a single character, but if v1 and v2 contain digits,
1291 # compare them as integers and fractions as strverscmp does.
1292 if (v1 ~ /^[0-9]/ && v2 ~ /^[0-9]/) {
1293 # Split v1 and v2 into their leading digit string components d1 and d2,
1294 # and advance v1 and v2 past the leading digit strings.
1295 for (len1 = 1; substr(v1, len1 + 1) ~ /^[0-9]/; len1++) continue
1296 for (len2 = 1; substr(v2, len2 + 1) ~ /^[0-9]/; len2++) continue
1297 d1 = substr(v1, 1, len1); v1 = substr(v1, len1 + 1)
1298 d2 = substr(v2, 1, len2); v2 = substr(v2, len2 + 1)
1301 # Compare two fractions.
1302 while (d1 ~ /^0/ && d2 ~ /^0/) {
1303 d1 = substr(d1, 2); len1--
1304 d2 = substr(d2, 2); len2--
1306 if (len1 != len2 && ! (len1 && len2 && substr(d1, 1, 1) == substr(d2, 1, 1))) {
1307 # The two components differ in length, and the common prefix
1308 # contains only leading zeros. Consider the longer to be less.
1312 # Otherwise, compare as strings.
1317 # A fraction is less than an integer.
1322 # An integer is greater than a fraction.
1325 # Compare two integers.
1331 # The normal case, without worrying about digits.
1332 d1 = substr(v1, 1, 1); v1 = substr(v1, 2)
1333 d2 = substr(v2, 1, 1); v2 = substr(v2, 2)
1338 # Beware Solaris /usr/xgp4/bin/awk (at least through Solaris 10),
1339 # which mishandles some comparisons of empty strings to integers.
1340 if (length(v2)) exit 1
1341 if (length(v1)) exit 2
1343 ']])# _AS_VERSION_COMPARE_PREPARE
1346 # AS_VERSION_COMPARE(VERSION-1, VERSION-2,
1347 # [ACTION-IF-LESS], [ACTION-IF-EQUAL], [ACTION-IF-GREATER])
1348 # -----------------------------------------------------------------------------
1349 # Compare two strings possibly containing shell variables as version strings.
1350 m4_defun([AS_VERSION_COMPARE],
1351 [AS_REQUIRE([_$0_PREPARE])dnl
1354 dnl This usage is portable even to ancient awk,
1355 dnl so don't worry about finding a "nice" awk version.
1356 awk "$as_awk_strverscmp" v1="$as_arg_v1" v2="$as_arg_v2" /dev/null
1362 ])# _AS_VERSION_COMPARE
1366 ## ------------------------------------ ##
1367 ## Common m4/sh character translation. ##
1368 ## ------------------------------------ ##
1370 # The point of this section is to provide high level macros comparable
1371 # to m4's `translit' primitive, but m4/sh polymorphic.
1372 # Transliteration of literal strings should be handled by m4, while
1373 # shell variables' content will be translated at runtime (tr or sed).
1378 # Output variables defining common character ranges.
1379 # See m4_cr_letters etc.
1380 m4_defun([_AS_CR_PREPARE],
1381 [# Avoid depending upon Character Ranges.
1382 as_cr_letters='abcdefghijklmnopqrstuvwxyz'
1383 as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
1384 as_cr_Letters=$as_cr_letters$as_cr_LETTERS
1385 as_cr_digits='0123456789'
1386 as_cr_alnum=$as_cr_Letters$as_cr_digits
1392 m4_defun([_AS_TR_SH_PREPARE],
1393 [AS_REQUIRE([_AS_CR_PREPARE])dnl
1394 # Sed expression to map a string onto a valid variable name.
1395 as_tr_sh="eval sed 'y%*+%pp%;s%[[^_$as_cr_alnum]]%_%g'"
1399 # AS_TR_SH(EXPRESSION)
1400 # --------------------
1401 # Transform EXPRESSION into a valid shell variable name.
1402 # sh/m4 polymorphic.
1403 # Be sure to update the definition of `$as_tr_sh' if you change this.
1404 m4_defun([AS_TR_SH],
1405 [AS_REQUIRE([_$0_PREPARE])dnl
1407 [m4_bpatsubst(m4_translit([[$1]], [*+], [pp]),
1408 [[^a-zA-Z0-9_]], [_])],
1409 [`AS_ECHO(["$1"]) | $as_tr_sh`])])
1412 # _AS_TR_CPP_PREPARE
1413 # ------------------
1414 m4_defun([_AS_TR_CPP_PREPARE],
1415 [AS_REQUIRE([_AS_CR_PREPARE])dnl
1416 # Sed expression to map a string onto a valid CPP name.
1417 as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[[^_$as_cr_alnum]]%_%g'"
1421 # AS_TR_CPP(EXPRESSION)
1422 # ---------------------
1423 # Map EXPRESSION to an upper case string which is valid as rhs for a
1424 # `#define'. sh/m4 polymorphic. Be sure to update the definition
1425 # of `$as_tr_cpp' if you change this.
1426 m4_defun([AS_TR_CPP],
1427 [AS_REQUIRE([_$0_PREPARE])dnl
1429 [m4_bpatsubst(m4_translit([[$1]],
1430 [*abcdefghijklmnopqrstuvwxyz],
1431 [PABCDEFGHIJKLMNOPQRSTUVWXYZ]),
1432 [[^A-Z0-9_]], [_])],
1433 [`AS_ECHO(["$1"]) | $as_tr_cpp`])])
1438 m4_defun([_AS_TR_PREPARE],
1439 [AS_REQUIRE([_AS_TR_SH_PREPARE])dnl
1440 AS_REQUIRE([_AS_TR_CPP_PREPARE])dnl
1446 ## --------------------------------------------------- ##
1447 ## Common m4/sh handling of variables (indirections). ##
1448 ## --------------------------------------------------- ##
1451 # The purpose of this section is to provide a uniform API for
1452 # reading/setting sh variables with or without indirection.
1453 # Typically, one can write
1454 # AS_VAR_SET(var, val)
1456 # AS_VAR_SET(as_$var, val)
1457 # and expect the right thing to happen.
1460 # AS_VAR_SET(VARIABLE, VALUE)
1461 # ---------------------------
1462 # Set the VALUE of the shell VARIABLE.
1463 # If the variable contains indirections (e.g. `ac_cv_func_$ac_func')
1464 # perform whenever possible at m4 level, otherwise sh level.
1465 m4_define([AS_VAR_SET],
1466 [AS_LITERAL_IF([$1],
1468 [eval "$1=AS_ESCAPE([$2])"])])
1471 # AS_VAR_GET(VARIABLE)
1472 # --------------------
1473 # Get the value of the shell VARIABLE.
1474 # Evaluates to $VARIABLE if there are no indirection in VARIABLE,
1475 # else into the appropriate `eval' sequence.
1476 # FIXME: This mishandles values that end in newlines.
1477 # Fixing this will require changing the API.
1478 m4_define([AS_VAR_GET],
1479 [AS_LITERAL_IF([$1],
1481 [`eval 'as_val=${'m4_bpatsubst([$1], [[\\`]], [\\\&])'}
1482 AS_ECHO(["$as_val"])'`])])
1485 # AS_VAR_TEST_SET(VARIABLE)
1486 # -------------------------
1487 # Expands into the `test' expression which is true if VARIABLE
1488 # is set. Polymorphic. Should be dnl'ed.
1489 m4_define([AS_VAR_TEST_SET],
1490 [AS_LITERAL_IF([$1],
1491 [test "${$1+set}" = set],
1492 [{ as_var=$1; eval "test \"\${$as_var+set}\" = set"; }])])
1495 # AS_VAR_SET_IF(VARIABLE, IF-TRUE, IF-FALSE)
1496 # ------------------------------------------
1497 # Implement a shell `if-then-else' depending whether VARIABLE is set
1498 # or not. Polymorphic.
1499 m4_define([AS_VAR_SET_IF],
1500 [AS_IF([AS_VAR_TEST_SET([$1])], [$2], [$3])])
1503 # AS_VAR_PUSHDEF and AS_VAR_POPDEF
1504 # --------------------------------
1507 # Sometimes we may have to handle literals (e.g. `stdlib.h'), while at
1508 # other moments, the same code may have to get the value from a
1509 # variable (e.g., `ac_header'). To have a uniform handling of both
1510 # cases, when a new value is about to be processed, declare a local
1513 # AS_VAR_PUSHDEF([header], [ac_cv_header_$1])
1515 # and then in the body of the macro, use `header' as is. It is of
1516 # first importance to use `AS_VAR_*' to access this variable. Don't
1517 # quote its name: it must be used right away by m4.
1519 # If the value `$1' was a literal (e.g. `stdlib.h'), then `header' is
1520 # in fact the value `ac_cv_header_stdlib_h'. If `$1' was indirect,
1521 # then `header's value in m4 is in fact `$ac_header', the shell
1522 # variable that holds all of the magic to get the expansion right.
1524 # At the end of the block, free the variable with
1526 # AS_VAR_POPDEF([header])
1529 # AS_VAR_PUSHDEF(VARNAME, VALUE)
1530 # ------------------------------
1531 # Define the m4 macro VARNAME to an accessor to the shell variable
1532 # named VALUE. VALUE does not need to be a valid shell variable name:
1533 # the transliteration is handled here. To be dnl'ed.
1534 m4_define([AS_VAR_PUSHDEF],
1535 [AS_LITERAL_IF([$2],
1536 [m4_pushdef([$1], [AS_TR_SH($2)])],
1538 m4_pushdef([$1], [$as_[$1]])])])
1541 # AS_VAR_POPDEF(VARNAME)
1542 # ----------------------
1543 # Free the shell variable accessor VARNAME. To be dnl'ed.
1544 m4_define([AS_VAR_POPDEF],
1548 ## ----------------- ##
1549 ## Setting M4sh up. ##
1550 ## ----------------- ##
1555 # This temporary macro checks "in the wild" for shells that do
1556 # not support shell functions.
1557 m4_define([_AS_SHELL_FN_SPY],
1558 [_AS_DETECT_SUGGESTED([_AS_SHELL_FN_WORK])
1559 _AS_RUN([_AS_SHELL_FN_WORK]) || {
1560 echo No shell found that supports shell functions.
1561 echo Please tell bug-autoconf@gnu.org about your system,
1562 echo including any error possibly output before this message.
1563 echo This can help us improve future autoconf versions.
1564 echo Configuration will now proceed without shell functions.
1572 m4_define([AS_INIT],
1575 # Forbidden tokens and exceptions.
1576 m4_pattern_forbid([^_?AS_])
1578 # Bangshe and minimal initialization.
1579 m4_divert_text([BINSH], [@%:@! /bin/sh])
1580 m4_divert_text([M4SH-SANITIZE], [AS_SHELL_SANITIZE])
1581 AS_REQUIRE([_AS_SHELL_FN_SPY])
1584 m4_divert_pop([KILL])[]dnl
1585 m4_divert_push([BODY])[]dnl