开发者

Passing variables verbatim from autoconf.ac to automake.am

开发者 https://www.devze.com 2023-04-05 11:55 出处:网络
How can I pass a string 开发者_Go百科verbatim from autoconf.ac to automake.am. Example, in autoconf.ac, I\'d like to give MYPATH = \"-I$MYENVPATH -I$SOMEOTHERPATH\" and subsequently, get MYPATH exac

How can I pass a string 开发者_Go百科verbatim from autoconf.ac to automake.am.

Example, in autoconf.ac, I'd like to give MYPATH = "-I$MYENVPATH -I$SOMEOTHERPATH" and subsequently, get MYPATH exactly as I gave, inside automake.am

AC_SUBST is trying to deference and cause issues.


To prevent the shell from evaluating variables inside strings (if that is whay you meant by "AC_SUBST is trying to dereference"), use simple quotes:

AC_SUBST([MYPATH], ['-I$MYENVPATH -I$SOMEOTHERPATH'])

This should output the following line in Makefile:

MYPATH = -I$MYENVPATH -I$SOMEOTHERPATH

However this does not make a lot of sense to me: make needs variable names to be enclosed in braces or parentheses (when their name has more than one letter). Probably what you really want is something like:

AC_SUBST([MYPATH], ['-I${MYENVPATH} -I${SOMEOTHERPATH}'])
0

精彩评论

暂无评论...
验证码 换一张
取 消