加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

bash – 如何在autoconf / m4中转义文本?

发布时间:2020-12-15 18:29:17 所属栏目:安全 来源:网络整理
导读:我的configuration.ac文件中的以下代码不起作用(请注意嵌套方括号[default = no]): AC_ARG_ENABLE(debug,[ --enable-debug build with debugging support [default=no].],[DEBUG="$enableval"],[DEBUG="no"]) 我怎么能逃脱这些括号? 找到了!从 this教程:
我的configuration.ac文件中的以下代码不起作用(请注意嵌套方括号[default = no]):
AC_ARG_ENABLE(debug,[  --enable-debug          build with debugging support [default=no].],[DEBUG="$enableval"],[DEBUG="no"]
)

我怎么能逃脱这些括号?

找到了!从 this教程:

M4 arguments are quoted with [ and ]. There is NO WAY to escape these,however,you have several options if you wish to insert [‘s or ]’s:

  1. Use a `Quadrigaph’. @<:@ gives you [ and @:>@ gives you ].
  2. Balance your quotes. M4 will turn [[]] in to []. Beware of using this in arguments to macros. Sometimes,you need to double quote as well ([[[]]]).
  3. Change the quoting using: changequote(<<,>>) to change the quoting to << and >>. The autoconf documentation (rightly,in my opinion) warns against the (over) use of this,since it can lead to unexpected results.
  4. Avoid [ and ] where ever possible. This is my personal choice.

因此,我的新代码是:

AC_ARG_ENABLE(debug,AS_HELP_STRING(
        [--enable-debug],[build with debugging symbols @<:@default=no@:>@]),[enable_debug="$enableval"],[enable_debug="no"]
)

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读