【发布时间】:2014-06-10 17:56:55
【问题描述】:
我正在使用自动工具来构建我的项目,并且我想将 AM_CPPFLAGS 全局设置为 -I$(top_srcdir)/include。
https://stackoverflow.com/a/325436/2592351 这个答案对我有帮助,我正在执行“include $(top_srcdir)/include” hack,它可以工作。
但是,我想做那里描述的“AC_SUBST”方式,因为它看起来更干净。问题是当我将它添加到我的 configure.ac 时:
AC_SUBST([AM_CPPFLAGS], [-I$(top_srcdir)/include])
然后 $(top_srcdir) 扩展得太快,我得到 AM_CPPFLAGS = -I/include in subdir/Makefile{,.in}。
而且我不知道如何逃脱它。
-I@top_srcdir@/include
-I\$(top_srcdir)/include
-I$$(top_srcdir)/include
所有这些都因各种原因而失败。
请帮忙。我应该如何编写 AC_SUBST 以便 $(top_srcdir) 在到达 Makefile{,.in} 之前不会被转义?或者我应该使用 AC_SUBST 以外的东西?
【问题讨论】:
-
根本没有测试,但试试
[-I@S|@@{:@top_srcdir@:}@/include]。 gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/… -
谢谢@Zack,但它也被过早地取代了。
-
德拉特。您能否发布
grep AM_CPPFLAGS config.status configure的输出(当然是在运行configure 之后)?
标签: c++ autotools autoconf automake m4