I am trying to configure some software packages with a script thereby I got the following problem. Assume that the environment variable PREFIX
is set to the location where I plan to install the software. Inside my script I have
CONFOPTS="--enable-shared --with-blas=\"-L${PREFIX}/lib/ -lblas\" --with-lapack=\"-L${PREFIX}/lib -llapack\""
echo CONFOPTS=$CONFOPTS
which prints
CONFOPTS=--enable-shared --with-blas="-L/scratch/test/lib/ -lblas" --with-lapack="-L/scratch/test/lib -llapack"
If a want to run configure afterwards in the script
set -x
./configure --prefix=${PREFIX} ${CONFOPTS}
set +x
it gets expanded to
./configure --prefix=/scratch/test --enable-shared '--with-blas="-L/scratch/test/lib/' '-lblas"' '--with-lapack="-L/scratch/test/lib' '-llapack"'
which is rubbish and misinterpreted by the configure script and the shell. The correct one would be
./configure --prefix=/scratch/test --enable-shared --with-blas="-L/scratch/test/lib/ -lblas" --with-lapack="-L/scratch/test/lib -llapack"
How can I change the behavior such that I obtain a proper command line in the configure call?