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