cc ' -DXXX=long long'
807578Jul 28 2010 — edited Aug 5 2010So I need to pass a -D macro containing a space to my Sun Studio 12 C compiler running on Solaris 10 x86 using a korn shell.
I run:
cc -Xc ' -DXXX=long long' define.c
And all works well.
But I want to put the compiler options in an environmental variable so I try:
export ZZZ="-Xc ' -DXXX=long long'"
cc $ZZZ define.c
And it fails. XXX is not set. In fact the entire -D string ends up getting passed through to the linker phase.
I can do an alias:
alias cc="/opt/sunstudio12.1/bin/cc '-DXXX=long long'"
cc -Xc define.c
Which works. But I really want to use an env variable if possible. I tried different methods of escaping the string but no luck.