Opened 8 years ago
Last modified 8 years ago
#156 closed defect
autoconf: Make options with spaces supported in LDFLAGS etc. — at Version 1
Reported by: | dmik | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | |
Component: | automake/autoconf | Version: | |
Severity: | medium | Keywords: | |
Cc: |
Description (last modified by )
autoconf has a problem that prevents from using options with spaces in LDFLAGS and other similar variables (e.g. a typical "-Zlinker 'DISABLE 1121'
to kill the infamous and highly annoying "symbol is already exported" WLINK warning). This problem is illustrated by the following code:
#!/bin/sh ac_link='python.exe -c "import sys; print sys.argv" $LDFLAGS' LDFLAGS="-lcx -Zlinker 'DISABLE 1121'" eval "$ac_link"
You will get this output:
['-c', '-lcx', '-Zlinker', "'DISABLE", "1121'"]
Where you can clearly see that the value for the -Zlinker option was split instead of being passed as a whole. In case of a compiler, this makes it think that 1121"
is a file and fail with "file not found" error.
Note that the problem only shows up in autoconf when LDFLAGS appears in eval and such. And this happens in many places, e.g. in AC_CHECK_LIB functions which simply start always failing in such a case.
A solution to this problem is the second expansion, something like this:
This script gives a correct result:
Now it's necessary to built it into autoconf making sure we don't break anything.