Autoconf脚本在使用空格的文件名或路径名时遇到问题.例如,
./configure CPPFLAGS="-I\"/path with space\""
结果(config.log):
configure:3012: gcc -I"/path with space" conftest.c >&5 gcc: with: No such file or directory gcc: space": No such file or directory
来自./configure的编译命令是ac_compile =’$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext>& 5′,我无法修改这个(我也许可以,但是以这种方式处理autoconf不是一般的解决方案).
我认为它得到一个shell变量,其中包含要解析为单个命令行变量而不是在空格处拆分的空格.我可以想出的最简单的shell示例是创建一个带有空格的文件,并尝试列出一个带有一个shell变量的ls作为ls的参数:
$touch "a b" $file="a b" $ls $file ls: a: No such file or directory ls: b: No such file or directory
这个工作,但是是非法的,因为在autoconf中我无法修改shell代码:
$ls "$file" a b
以下尝试引用的事情都不行:
$file="\"a \"b"; ls $file ls: "a: No such file or directory ls: b": No such file or directory $file="a\ b" $file="a\\ b" $file="`echo \\"a b\\"`"
等等.