Autoreconf stops with “non-POSIX variable name”

有些话、适合烂在心里 提交于 2019-12-04 13:58:16

As it says, the problem is you're using a GNUism in your Makefile.am, when it's only meant to contain portable Makefile code.

Either rewrite your code so it's portable (you should use AM_CPPFLAGS because you're passing flags to the preprocessor, not the compiler):

AM_CPPFLAGS = -I$(EXTRAS_INCLUDE_DIR) -I$(top_srcdir) -DMY_REVISION=`cat $(top_srcdir)/$(MY_REVISION_FILE)`

If you don't want to invoke cat on every compile, you could find the value in configure.ac and either AC_SUBST it into Makefile or AC_DEFINE it so it goes into config.h.

Or if you want to be non-portable (ಠ_ಠ), you can take -Werror out of your AM_INIT_AUTOMAKE or AUTOMAKE_OPTIONS, or add -Wno-portability.

After long testing back and forth I decided to use AC_SUBST. My solution might not be the cleanest but it works for me.

In configure.ac I added the following line AC_SUBST([DOLLAR_SIGN],[$])

In the Makefile.am I changed my previous line into MY_REVISION=@DOLLAR_SIGN@(shell cat $(SRC_DIR)/$(MY_REVISION_FILE))

And it works. Again, thanks for your help.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!