I'm using autotools to build my project and I'd like to globally set AM_CPPFLAGS to -I$(top_srcdir)/include.
https://stackoverflow.com/a/325436/2592351 this answer helped me and I'm doing the "include $(top_srcdir)/include" hack and it works.
However I'd like to do the "AC_SUBST" way described there as it looks cleaner. The problem is when I add this to my configure.ac:
AC_SUBST([AM_CPPFLAGS], [-I$(top_srcdir)/include])
then $(top_srcdir) is expanded too soon and I get AM_CPPFLAGS = -I/include in subdir/Makefile{,.in}.
And I don't get how to escape it.
-I@top_srcdir@/include
-I\$(top_srcdir)/include
-I$$(top_srcdir)/include
all these failed for various reasons.
Please help. How should I write the AC_SUBST so $(top_srcdir) is not escaped before it gets to Makefile{,.in}? Or maybe I should use something other than AC_SUBST?
[-I@S|@@{:@top_srcdir@:}@/include]
. gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/… – zwolgrep AM_CPPFLAGS config.status configure
, please (after running configure, of course)? – zwol