m4sh.m4
来自「autoconf是一个产生可以自动配置源代码包」· M4 代码 · 共 1,499 行 · 第 1/3 页
M4
1,499 行
#m4_define([_AS_IF],[m4_ifval([$2$3],[elif $1; then m4_default([$2], [:])m4_ifval([$3], [$0(m4_shiftn(2, $@))])],[m4_ifvaln([$1],[else $1])dnl])dnl])# _AS_IFm4_defun([AS_IF],[m4_ifval([$2$3],[if $1; then m4_default([$2], [:])m4_ifval([$3], [_$0(m4_shiftn(2, $@))])[]dnlfi])dnl])# AS_IF# _AS_UNSET_PREPARE# -----------------# AS_UNSET depends upon $as_unset: compute it.# Use MAIL to trigger a bug in Bash 2.01;# the "|| exit" suppresses the resulting "Segmentation fault" message.# Avoid 'if ((', as that triggers a bug in pdksh 5.2.14.m4_defun([_AS_UNSET_PREPARE],[# Support unset when possible.if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unsetelse as_unset=falsefi])# AS_UNSET(VAR, [VALUE-IF-UNSET-NOT-SUPPORTED = `'])# --------------------------------------------------# Try to unset the env VAR, otherwise set it to# VALUE-IF-UNSET-NOT-SUPPORTED. `as_unset' must have been computed.m4_defun([AS_UNSET],[AS_REQUIRE([_AS_UNSET_PREPARE])dnl$as_unset $1 || test "${$1+set}" != set || { $1=$2; export $1; }])## ------------------------------------------ #### 3. Error and warnings at the shell level. #### ------------------------------------------ ### If AS_MESSAGE_LOG_FD is defined, shell messages are duplicated there# too.# AS_ESCAPE(STRING, [CHARS = $"`\])# ---------------------------------# Escape the CHARS in STRING.m4_define([AS_ESCAPE],[m4_bpatsubst([$1], m4_dquote(m4_default([$2], [\"$`])), [\\\&])])# _AS_QUOTE_IFELSE(STRING, IF-MODERN-QUOTATION, IF-OLD-QUOTATION)# ---------------------------------------------------------------# Compatibility glue between the old AS_MSG suite which did not# quote anything, and the modern suite which quotes the quotes.# If STRING contains `\\' or `\$', it's modern.# If STRING contains `\"' or `\`', it's old.# Otherwise it's modern.# We use two quotes in the pattern to keep highlighting tools at peace.m4_define([_AS_QUOTE_IFELSE],[m4_bmatch([$1], [\\[\\$]], [$2], [\\[`""]], [$3], [$2])])# _AS_QUOTE(STRING, [CHARS = `"])# -------------------------------# If there are quoted (via backslash) backquotes do nothing, else# backslash all the quotes.m4_define([_AS_QUOTE],[_AS_QUOTE_IFELSE([$1], [AS_ESCAPE([$1], m4_default([$2], [`""]))], [m4_warn([obsolete], [back quotes and double quotes must not be escaped in: $1])dnl$1])])# _AS_ECHO_UNQUOTED(STRING, [FD = AS_MESSAGE_FD])# -----------------------------------------------# Perform shell expansions on STRING and echo the string to FD.m4_define([_AS_ECHO_UNQUOTED],[echo "$1" >&m4_default([$2], [AS_MESSAGE_FD])])# _AS_ECHO(STRING, [FD = AS_MESSAGE_FD])# --------------------------------------# Protect STRING from backquote expansion, echo the result to FD.m4_define([_AS_ECHO],[_AS_ECHO_UNQUOTED([_AS_QUOTE([$1])], [$2])])# _AS_ECHO_LOG(STRING)# --------------------# Log the string to AS_MESSAGE_LOG_FD.m4_define([_AS_ECHO_LOG],[_AS_ECHO([$as_me:$LINENO: $1], [AS_MESSAGE_LOG_FD])])# _AS_ECHO_N_PREPARE# ------------------# Check whether to use -n, \c, or newline-tab to separate# checking messages from result messages.# Don't try to cache, since the results of this macro are needed to# display the checking message. In addition, caching something used once# has little interest.# Idea borrowed from dist 3.0. Use `*c*,', not `*c,' because if `\c'# failed there is also a newline to match.m4_defun([_AS_ECHO_N_PREPARE],[ECHO_C= ECHO_N= ECHO_T=case `echo -n x` in-n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;;*) ECHO_N='-n';;esac])# _AS_ECHO_N_PREPARE# _AS_ECHO_N(STRING, [FD = AS_MESSAGE_FD])# ----------------------------------------# Same as _AS_ECHO, but echo doesn't return to a new line.m4_define([_AS_ECHO_N],[AS_REQUIRE([_AS_ECHO_N_PREPARE])dnlecho $ECHO_N "_AS_QUOTE([$1])$ECHO_C" >&m4_default([$2], [AS_MESSAGE_FD])])# AS_MESSAGE(STRING, [FD = AS_MESSAGE_FD])# ----------------------------------------m4_define([AS_MESSAGE],[m4_ifset([AS_MESSAGE_LOG_FD], [{ _AS_ECHO_LOG([$1])_AS_ECHO([$as_me: $1], [$2]);}], [_AS_ECHO([$as_me: $1], [$2])])[]dnl])# AS_WARN(PROBLEM)# ----------------m4_define([AS_WARN],[AS_MESSAGE([WARNING: $1], [2])])# AS_WARN# AS_ERROR(ERROR, [EXIT-STATUS = 1])# ----------------------------------m4_define([AS_ERROR],[{ AS_MESSAGE([error: $1], [2]) AS_EXIT([$2]); }[]dnl])# AS_ERROR## -------------------------------------- #### 4. Portable versions of common tools. #### -------------------------------------- ### This section is lexicographically sorted.# AS_BASENAME(FILE-NAME)# ----------------------# Simulate the command 'basename FILE-NAME'. Not all systems have basename.# Also see the comments for AS_DIRNAME.m4_defun([_AS_BASENAME_EXPR],[AS_REQUIRE([_AS_EXPR_PREPARE])dnl$as_expr X/[]$1 : '.*/\([[^/][^/]*]\)/*$' \| \ X[]$1 : 'X\(//\)$' \| \ X[]$1 : 'X\(/\)' \| .])m4_defun([_AS_BASENAME_SED],[echo X/[]$1 | sed ['/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q']])m4_defun([AS_BASENAME],[AS_REQUIRE([_$0_PREPARE])dnl$as_basename -- $1 ||_AS_BASENAME_EXPR([$1]) 2>/dev/null ||_AS_BASENAME_SED([$1])])# _AS_BASENAME_PREPARE# --------------------# Avoid Solaris 9 /usr/ucb/basename, as `basename /' outputs an empty line.# Also, traditional basename mishandles --.m4_defun([_AS_BASENAME_PREPARE],[if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basenameelse as_basename=falsefi])# _AS_BASENAME_PREPARE# AS_DIRNAME(FILE-NAME)# ---------------------# Simulate the command 'dirname FILE-NAME'. Not all systems have dirname.# This macro must be usable from inside ` `.## Prefer expr to echo|sed, since expr is usually faster and it handles# backslashes and newlines correctly. However, older expr# implementations (e.g. SunOS 4 expr and Solaris 8 /usr/ucb/expr) have# a silly length limit that causes expr to fail if the matched# substring is longer than 120 bytes. So fall back on echo|sed if# expr fails.m4_defun([_AS_DIRNAME_EXPR],[AS_REQUIRE([_AS_EXPR_PREPARE])dnl$as_expr X[]$1 : 'X\(.*[[^/]]\)//*[[^/][^/]]*/*$' \| \ X[]$1 : 'X\(//\)[[^/]]' \| \ X[]$1 : 'X\(//\)$' \| \ X[]$1 : 'X\(/\)' \| .])m4_defun([_AS_DIRNAME_SED],[echo X[]$1 | sed ['/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q']])m4_defun([AS_DIRNAME],[AS_REQUIRE([_$0_PREPARE])dnl$as_dirname -- $1 ||_AS_DIRNAME_EXPR([$1]) 2>/dev/null ||_AS_DIRNAME_SED([$1])])# _AS_DIRNAME_PREPARE# --------------------m4_defun([_AS_DIRNAME_PREPARE],[if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirnameelse as_dirname=falsefi])# _AS_DIRNAME_PREPARE# AS_EXECUTABLE_P# ---------------# Check whether a file is executable.m4_defun([AS_EXECUTABLE_P],[AS_REQUIRE([_AS_TEST_PREPARE])dnl{ test -f $1 && $as_executable_p $1; }dnl])# AS_EXECUTABLE_P# _AS_EXPR_PREPARE# ----------------# QNX 4.25 expr computes and issue the right result but exits with failure.# Tru64 expr mishandles leading zeros in numeric strings.# Detect these flaws.m4_defun([_AS_EXPR_PREPARE],[if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=exprelse as_expr=falsefi])# _AS_EXPR_PREPARE# _AS_LINENO_WORKS# ---------------# Succeed if the currently executing shell supports LINENO.# This macro does not expand to a single shell command, so be careful# when using it. Surrounding the body of this macro with {} would# cause "bash -c '_ASLINENO_WORKS'" to fail (with Bash 2.05, anyway),# but that bug is irrelevant to our use of LINENO.m4_define([_AS_LINENO_WORKS],[ as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2"])# _AS_LINENO_PREPARE# ------------------# If LINENO is not supported by the shell, produce a version of this# script where LINENO is hard coded.# Comparing LINENO against _oline_ is not a good solution, since in# the case of embedded executables (such as config.status within# configure) you'd compare LINENO wrt config.status vs. _oline_ wrt# configure.m4_define([_AS_LINENO_PREPARE],[AS_REQUIRE([_AS_CR_PREPARE])dnl_AS_DETECT_SUGGESTED([_AS_LINENO_WORKS])_AS_LINENO_WORKS || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, and appends # trailing '-' during substitution so that $LINENO is not a special # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # scripts with optimization help from Paolo Bonzini. Blame Lee # E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[[$]]LINENO/= ' <$as_myself | sed ' s/[[$]]LINENO.*/&-/ t lineno b :lineno N :loop s/[[$]]LINENO\([[^'$as_cr_alnum'_]].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || AS_ERROR([cannot create $as_me.lineno; rerun with a POSIX shell]) # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit}])# _AS_LINENO_PREPARE# _AS_LN_S_PREPARE# ----------------# Don't use conftest.sym to avoid file name issues on DJGPP, where this# would yield conftest.sym.exe for DJGPP < 2.04. And don't use `conftest'# as base name to avoid prohibiting concurrency (e.g., concurrent# config.statuses).m4_defun([_AS_LN_S_PREPARE],[rm -f conf$$ conf$$.exe conf$$.fileif test -d conf$$.dir; then rm -f conf$$.dir/conf$$.fileelse rm -f conf$$.dir mkdir conf$$.dirfiecho >conf$$.fileif ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p'elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=lnelse as_ln_s='cp -p'firm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.filermdir conf$$.dir 2>/dev/null])# _AS_LN_S_PREPARE# AS_LN_S(FILE, LINK)# -------------------# FIXME: Should we add the glue code to handle properly relative symlinks# simulated with `ln' or `cp'?m4_defun([AS_LN_S],[AS_REQUIRE([_AS_LN_S_PREPARE])dnl$as_ln_s $1 $2])# AS_MKDIR_P(DIR)# ---------------# Emulate `mkdir -p' with plain `mkdir'.m4_define([AS_MKDIR_P],[AS_REQUIRE([_$0_PREPARE])dnl{ as_dir=$1 case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`AS_DIRNAME("$as_dir")` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || AS_ERROR([cannot create directory $as_dir]); }dnl])# AS_MKDIR_P# _AS_MKDIR_P_PREPARE# -------------------m4_defun([_AS_MKDIR_P_PREPARE],[if mkdir -p . 2>/dev/null; then as_mkdir_p=:else test -d ./-p && rmdir ./-p as_mkdir_p=falsefi])# _AS_MKDIR_P_PREPARE# _AS_PATH_SEPARATOR_PREPARE# --------------------------# Compute the path separator.m4_defun([_AS_PATH_SEPARATOR_PREPARE],[# The user is always right.if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.shfi])# _AS_PATH_SEPARATOR_PREPARE# _AS_PATH_WALK([PATH = $PATH], BODY)# -----------------------------------# Walk through PATH running BODY for each `as_dir'.## Still very private as its interface looks quite bad.## `$as_dummy' forces splitting on constant user-supplied paths.# POSIX.2 field splitting is done only on the result of word# expansions, not on literal text. This closes a longstanding sh security# hole. Optimize it away when not needed, i.e., if there are no literal# path separators.m4_define([_AS_PATH_WALK],[AS_REQUIRE([_AS_PATH_SEPARATOR_PREPARE])dnlas_save_IFS=$IFS; IFS=$PATH_SEPARATORm4_bmatch([$1], [[:;]],[as_dummy="$1"for as_dir in $as_dummy],[for as_dir in m4_default([$1], [$PATH])])do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $2doneIFS=$as_save_IFS])# AS_SET_CATFILE(VAR, DIR-NAME, FILE-NAME)# ----------------------------------------
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?