Autoconf:打破字符串中的长行

时间:2014-10-24 12:00:20

标签: autoconf

在我的configure.ac文件中,我有类似这样的警告和错误:

AC_MSG_ERROR([无法找到Boost Math头文件,您是否正确指定了--with-boost-include-path选项?]

我老式,喜欢保持线宽不超过80个字符。但是,当我像这样拆分线时(我也喜欢一些适当的缩进)

AC_MSG_ERROR([Could not find the Boost Math header files, did you
 specify the --with-boost-include-path option correctly?])

错误消息通过./configure在屏幕上打印时保留换行符和缩进。

在Autoconf中打破字符串的正确方法是什么?

3 个答案:

答案 0 :(得分:2)

嗯,在阅读了一些内容并尝试了一些事情后,似乎我可以通过用\打破字符串来摆脱输出中的换行符,但看起来我不会能够在源中保留缩进:

AC_MSG_ERROR([Could not find the Boost Math header files, did you \
specify the --with-boost-include-path option correctly?])

产生

configure: error: Could not find the Boost Math header files, did you specify the --with-boost-include-path option correctly?

AC_MSG_ERROR([Could not find the Boost Math header files, did you \
              specify the --with-boost-include-path option correctly?])

给出:

configure: error: Could not find the Boost Math header files, did you        specify the --with-boost-include-path option correctly?

答案 1 :(得分:2)

对于这样的事情,定义M4宏可能会有所帮助:

m4_define([bst_e1], [Could not find the Boost Math header files[,] did you])
m4_define([bst_e2], [specify the --with-boost-include-path option correctly?])
AC_MSG_ERROR(bst_e1 bst_e2)

您也可以在运行configure脚本时执行此操作,因为AC_MSG_ERROR将采用变量:

variable=$(cat | tr '\012' ' ' <<ΕΟF
Could not find the Boost Math header files, did you
specify the --with-boost-include-path option correctly?
ΕΟF
)
AC_MSG_ERROR($variable)

答案 2 :(得分:2)

这是一个老问题,但我找到了另一个解决方案,您可以像这样使用M.Invoke(MainObj.ClassType,

m4_normalize

甚至:

AC_MSG_ERROR(m4_normalize([Could not find the Boost Math header files, did you 
             specify the --with-boost-include-path option correctly?]))