m4sugar似乎不在autotools之外工作

时间:2017-01-26 19:41:01

标签: bash macros autotools preprocessor m4

问题

所以我一直在尝试集成m4sugar.m4,一个m4宏库,用于在m4中简化通用编程,进入我正在为我的bash库构建的宏系统但是,当我尝试在m4中使用m4sugar.m4时,我会得到一个大量的错误列表和垃圾:

错误代码段

# m4_assert(EXPRESSION, [EXIT-STATUS = 1])
# ----------------------------------------
# This macro ensures that EXPRESSION evaluates to true, and exits if
# EXPRESSION evaluates to false.
m4:m4sugar.m4:223: bad expression in eval: [$1]

## ------------------- ##
## 4. File inclusion.  ##
## ------------------- ##


# We also want to neutralize include (and sinclude for symmetry),
# but we want to extend them slightly: warn when a file is included
# several times.  This is, in general, a dangerous operation, because
# too many people forget to quote the first argument of m4_define.
#
# For instance in the following case:
#   m4_define(foo, [bar])
# then a second reading will turn into
#   m4_define(bar, [bar])
# which is certainly not what was meant.

# m4_include_unique(FILE)
# -----------------------
# Declare that the FILE was loading; and warn if it has already
# been included.
m4:m4sugar.m4:275: cannot open `$1': No such file or directory
m4:m4sugar.m4:277: cannot open `$1': No such file or directory



# m4_include(FILE)
# ----------------
# Like the builtin include, but warns against multiple inclusions.
m4:m4sugar.m4:285: undefined builtin `[include]'



# m4_sinclude(FILE)
# -----------------
# Like the builtin sinclude, but warns against multiple inclusions.
m4:m4sugar.m4:293: undefined builtin `[sinclude]'

# m4_argn(N, ARGS...)
# -------------------
# Extract argument N (greater than 0) from ARGS.  Example:
#   m4_define([b], [B])
#   m4_argn([2], [a], [b], [c]) => b
#
# Rather than using m4_car(m4_shiftn([$1], $@)), we exploit the fact that
# GNU m4 can directly reference any argument, through an indirect macro.
m4:m4sugar.m4:444: non-numeric argument to builtin `m4_incr'

# m4_cond(TEST1, VAL1, IF-VAL1, TEST2, VAL2, IF-VAL2, ..., [DEFAULT])
# -------------------------------------------------------------------
# Similar to m4_if, except that each TEST is expanded when encountered.
# If the expansion of TESTn matches the string VALn, the result is IF-VALn.
# The result is DEFAULT if no tests passed.  This macro allows
# short-circuiting of expensive tests, where it pays to arrange quick
# filter tests to run first.
#
# For an example, consider a previous implementation of _AS_QUOTE_IFELSE:
#
#    m4_if(m4_index([$1], [\]), [-1], [$2],
#          m4_eval(m4_index([$1], [\\]) >= 0), [1], [$2],
#          m4_eval(m4_index([$1], [\$]) >= 0), [1], [$2],
#          m4_eval(m4_index([$1], [\`]) >= 0), [1], [$3],
#          m4_eval(m4_index([$1], [\"]) >= 0), [1], [$3],
#          [$2])
#
# Here, m4_index is computed 5 times, and m4_eval 4, even if $1 contains
# no backslash.  It is more efficient to do:
#
#    m4_cond([m4_index([$1], [\])], [-1], [$2],
#            [m4_eval(m4_index([$1], [\\]) >= 0)], [1], [$2],
#            [m4_eval(m4_index([$1], [\$]) >= 0)], [1], [$2],
#            [m4_eval(m4_index([$1], [\`]) >= 0)], [1], [$3],
#            [m4_eval(m4_index([$1], [\"]) >= 0)], [1], [$3],
#            [$2])
#
# In the common case of $1 with no backslash, only one m4_index expansion
# occurs, and m4_eval is avoided altogether.
#
# Please keep foreach.m4 in sync with any adjustments made here.
m4:m4sugar.m4:507: bad expression in eval: [$# % 3]), [2], [m4_fatal([$0: missing an argument])],
       [_$0($@)]
m4:m4sugar.m4:549: undefined builtin `[patsubst]'
m4:m4sugar.m4:566: Warning: excess arguments to builtin `m4_pushdef' ignored
m4:m4sugar.m4:641: Warning: excess arguments to builtin `m4_define' ignored
m4:m4sugar.m4:546: bad expression in eval: $# & 1), 0, [,]))])])

m4:m4sugar.m4:664: Warning: excess arguments to builtin `m4_define' ignored
m4:m4sugar.m4:673: undefined builtin `[dumpdef]'
sh: []: command not found
m4:m4sugar.m4:706: Warning: excess arguments to builtin `m4_define' ignored
m4:m4sugar.m4:735: non-numeric argument to builtin `m4_decr'
m4:m4sugar.m4:767: Warning: excess arguments to builtin `m4_define' ignored
m4:m4sugar.m4:780: undefined builtin `[m4wrap]'
m4:m4sugar.m4:925: Warning: excess arguments to builtin `m4_define' ignored
m4:m4sugar.m4:2204: bad expression in eval: m4_default_quoted(,
              1)
m4:m4sugar.m4:2204: bad expression in eval: ((255) - (1)) /  *  + (1)
m4:m4sugar.m4:2204: bad expression in eval: m4_default_quoted(,
              -1)
m4:m4sugar.m4:2204: bad expression in eval: ((1) - (255)) / -() *  + (1)
m4:m4sugar.m4:2204: Warning: excess arguments to builtin `m4_define' ignored
m4:m4sugar.m4:2204: bad expression in eval: _m4_defn() + 0
m4:m4sugar.m4:2204: Warning: too few arguments to builtin `m4_translit'
m4:m4sugar.m4:2204: bad expression in eval: _m4_defn() +
m4:m4sugar.m4:2203: ERROR: end of file in argument list

我的问题

我正在使用m4m4sugar.m4的最新版本,并且正在使用m4运行m4 -P,以便内置版以m4_为前缀;有什么东西我只是缺少像autoconf使用一个特殊的工具或东西忽略语法错误或我只需要咬住子弹并通过每个宏并修复它们?

0 个答案:

没有答案