Configure mishandling quotes in compiler and flags settings
As noted indirectly in pull request 370 comments, the following configure command is not handled correctly:
$ [path_to]/configure CXX='g++ -Dfoo=bar' CC='gcc -Dhi="thereyou"' --without-mpicc
The issue is that in the subsequent make
step, GASNet is configured as show below, where one can see that the double-quote marks have been lost from the constructed --with-cc
.
$ make
Configuring debug-mode build of GASNet
/Users/phargrov/upcxx/V/bld/GASNet-stable/configure "--without-mpicc" --with-cflags="" --with-cxxflags="" --enable-smp --disable-parsync --enable-seq --enable-par --enable-pthreads --disable-segment-everything --enable-debug --with-cc='/usr/bin/gcc -Dhi=thereyou' --with-cxx='/usr/bin/g++ -Dfoo=bar'
Use of --with-cc=...
in place of CC=...
shows the same problem.
However, --with-option='gcc -Dhi="thereyou"'
appears to be passed to GASNet's configure without loss of the double-quotes. So, this narrows the problem to the special handling of CC
and CXX
(and probably CFLAGS
and CXXFLAGS
).
Comments (5)
-
reporter -
reporter - changed status to open
I am going to work on this.
Current goal is to accept the following contrived command:
GASNET_CONFIGURE_ARGS=--with-foo='"a horse walks into a bar"' \ ../configure \ --without-mpicc \ CXX='g++ -Dpart1="Twinkle, twinkle,"' \ CFLAGS='-Dpart2="little star."' \ --with-cc='gcc -Dpart3="How I wonder"' \ --with-cxxflags='-Dpart4="what you are."'
Presently, several missing applications of
eval
inutils/system-checks.sh
are leading to failures due to the spaces in values. Even without the whitespace complications, the passing of CC and CXX to GASNet's configure has the original issue with double-quotes. -
reporter A proposed solution to this issue will be added to pull request 370, where it has direct bearing on the work being conducted there.
-
reporter - changed title to Configure mishandling quotes in compiler and flags settings
Updated Description to better match the findings
-
reporter - changed status to resolved
Improve configure processing of CC, CXX and flags
This commit resolves issue 496 by making two groups of changes to the handling of
CC
,CXX
,CFLAGS
andCXXFLAGS
.The first set of changes is to add missing
eval
to several compiler invocations inutils/system-checks.sh
. These are necessary to deal properly with quotation marks appearing in these variables' values, especially when used to preserve white space.The second change is to modify the mechanism by which the compiler settings are passed to GASNet's
configure
to match that already in use for the flags.The result is that the following contrived example command runs to completion and the subsequent
make
passes the correctly quoted arguments to GASNet'sconfigure
(which will choke on white space inCC
and/orCFLAGS
, but that is an autoconf problem, not in-scope for support in UPC++ or GASNet).$ GASNET_CONFIGURE_ARGS='--with-foo="a horse walks into a bar"' \ ../configure \ --without-mpicc \ CXX='g++ -Dpart1="Twinkle, twinkle,"' \ CFLAGS='-Dpart2="little star."' \ --with-cc='gcc -Dpart3="How I wonder"' \ --with-cxxflags='-Dpart4="what you are."'
→ <<cset ce1ce7cd8d91>>
- Log in to comment
Adding spaces between the embedded double-quotes makes UPC++ configure die as well!