-
-
Notifications
You must be signed in to change notification settings - Fork 60
Description
Arguments to "configure" which go into variables in mconfig (such as CXX) are used inconsistently in the configure script. In most cases this doesn't matter, but it is sloppy and really should be fixed.
Eg. if CXX contains a compiler
, then try_cxx_argument
function does:
if $CXX $CXXFLAGS [etc]
Which will run a
, with compiler
as an argument followed by whatever is in CXXFLAGS (with value subject to word splitting by the shell).
If CXX contains "a compiler"
, it will run "a
(with compiler"
as argument), rather than having the shell interpret the quotes.
However, in this latter case, the mconfig value is written as:
CXX=$CXX
... which is a Makefile variable, which will be expanded via $(CXX)
in the Makefile (not via the shell), and will then be subject to shell quoting, so that it will run a compiler
.
I.e. the Makefile build will use a different compiler than what was tested in the configure script.
Currently the configure --help
output says:
Note: paths specified via --prefix/--exec-prefix/--sbindir/--mandir, and build variable values,
must be escaped for use in a makefile and in shell commands. If there are spaces in paths it is
recommended to prepend a backslash (\) to them.
For example: ./configure --prefix="/home/my\ home"
This is already problematic, how do you escape a value for use in a makefile and in shell commands? The script should accept one or the other and modify the value as necessary in different contexts.
But also, as pointed out above, the example doesn't work for variables that are actually used in the configure script (such as CXX, CXXFLAGS, etc) because the script doesn't use them in a way that causes the shell to re-interpret the values after expansion (as it would if done eg via eval
).