Automake stops with “non-POSIX variable name”

本文介绍了一种在Makefile.am中正确读取文件内容的方法,通过使用AC_SUBST来解决非POSIX变量名问题,确保了Makefile.in能够自动生成。

I created a Makefile.in where I read the content out of a file and pass it to CFLAGS. Calling ./configure ... the Makefile will be generated an all works well.

Makefile.in: 
... 
MY_REVISION_FILE=my-revision.txt 
MY_REVISION=$(shell cat $(top_srcdir)/$(MY_REVISION_FILE)) 
AM_CFLAGS = -I$(EXTRAS_INCLUDE_DIR) -I$(top_srcdir) -DMY_REVISION=$(MY_REVISION) 
... 

The problem arises once I moved the Makefile.in code into Makefile.am to allow the auto generation of Makefile.in. There calling autoreconf -i --force stops with the following error:

server/Makefile.am:9: cat $(top_srcdir: non-POSIX variable name 
server/Makefile.am:9: (probably a GNU make extension) 
autoreconf: automake failed with exit status: 1 

This problem hunts me now since quite some time. I searched everywhere but did not find anything that could help me finding a solution for that. In short, the only thing I need is a way to get an uninterpreted text such as "$(shell cat $(top_srcdir)/$(MY_REVISION_FILE))" copied from Makefile.am to Makefile.in

Any idea?

Thanks, Oliver





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.


user@debian:~/ModSecurity$ ./build.sh libtoolize: putting auxiliary files in '.'. libtoolize: copying file './ltmain.sh' libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'build'. libtoolize: copying file 'build/libtool.m4' libtoolize: copying file 'build/ltoptions.m4' libtoolize: copying file 'build/ltsugar.m4' libtoolize: copying file 'build/ltversion.m4' libtoolize: copying file 'build/lt~obsolete.m4' configure.ac:50: installing './compile' configure.ac:45: installing './missing' examples/multiprocess_c/Makefile.am: installing './depcomp' src/Makefile.am:70: warning: wildcard actions/*.h: non-POSIX variable name src/Makefile.am:70: (probably a GNU make extension) src/Makefile.am:70: warning: wildcard actions/ctl/*.h: non-POSIX variable name src/Makefile.am:70: (probably a GNU make extension) src/Makefile.am:70: warning: wildcard actions/data/*.h: non-POSIX variable name src/Makefile.am:70: (probably a GNU make extension) src/Makefile.am:70: warning: wildcard actions/disruptive/*.h: non-POSIX variable name src/Makefile.am:70: (probably a GNU make extension) src/Makefile.am:70: warning: wildcard actions/transformations/*.h: non-POSIX variable name src/Makefile.am:70: (probably a GNU make extension) src/Makefile.am:70: warning: wildcard debug_log/*.h: non-POSIX variable name src/Makefile.am:70: (probably a GNU make extension) src/Makefile.am:70: warning: wildcard audit_log/writer/*.h: non-POSIX variable name src/Makefile.am:70: (probably a GNU make extension) src/Makefile.am:70: warning: wildcard collection/backend/*.h: non-POSIX variable name src/Makefile.am:70: (probably a GNU make extension) src/Makefile.am:70: warning: wildcard operators/*.h: non-POSIX variable name src/Makefile.am:70: (probably a GNU make extension) src/Makefile.am:70: warning: wildcard parser/*.h: non-POSIX variable name src/Makefile.am:70: (probably a GNU make extension) src/Makefile.am:70: warning: wildcard request_body_processor/*.h: non-POSIX variable name src/Makefile.am:70: (probably a GNU make extension) src/Makefile.am:70: warning: wildcard utils/*.h: non-POSIX variable name src/Makefile.am:70: (probably a GNU make extension) src/Makefile.am:70: warning: wildcard variables/*.h: non-POSIX variable name src/Makefile.am:70: (probably a GNU make extension) src/Makefile.am:70: warning: wildcard engine/*.h: non-POSIX variable name src/Makefile.am:70: (probably a GNU make extension) src/Makefile.am:70: warning: wildcard *.h: non-POSIX variable name src/Makefile.am:70: (probably a GNU make extension) src/Makefile.am:70: warning: wildcard actions/*.h: non-POSIX variable name src/Makefile.am:70: (probably a GNU make extension) src/Makefile.am:70: warning: wildcard actions/ctl/*.h: non-POSIX variable name src/Makefile.am:70: (probably a GNU make extension) src/Makefile.am:70: warning: wildcard actions/data/*.h: non-POSIX variable name src/Makefile.am:70: (probably a GNU make extension) src/Makefile.am:70: warning: wildcard actions/disruptive/*.h: non-POSIX variable name src/Makefile.am:70: (probably a GNU make extension) src/Makefile.am:70: warning: wildcard actions/transformations/*.h: non-POSIX variable name src/Makefile.am:70: (probably a GNU make extension) src/Makefile.am:70: warning: wildcard debug_log/*.h: non-POSIX variable name src/Makefile.am:70: (probably a GNU make extension) src/Makefile.am:70: warning: wildcard audit_log/writer/*.h: non-POSIX variable name src/Makefile.am:70: (probably a GNU make extension) src/Makefile.am:70: warning: wildcard collection/backend/*.h: non-POSIX variable name src/Makefile.am:70: (probably a GNU make extension) src/Makefile.am:70: warning: wildcard operators/*.h: non-POSIX variable name src/Makefile.am:70: (probably a GNU make extension) src/Makefile.am:70: warning: wildcard parser/*.h: non-POSIX variable name src/Makefile.am:70: (probably a GNU make extension) src/Makefile.am:70: warning: wildcard request_body_processor/*.h: non-POSIX variable name src/Makefile.am:70: (probably a GNU make extension) src/Makefile.am:70: warning: wildcard utils/*.h: non-POSIX variable name src/Makefile.am:70: (probably a GNU make extension) src/Makefile.am:70: warning: wildcard variables/*.h: non-POSIX variable name src/Makefile.am:70: (probably a GNU make extension) src/Makefile.am:70: warning: wildcard engine/*.h: non-POSIX variable name src/Makefile.am:70: (probably a GNU make extension) src/Makefile.am:70: warning: wildcard *.h: non-POSIX variable name src/Makefile.am:70: (probably a GNU make extension) user@debian:~/ModSecurity$
最新发布
06-29
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值