Hello, self-specs setup with configure --with-specs are allowed to contain %:getenv environment variable references. We are using this capability in a few cases for cross ports.
In such configurations, gcc --help or gcc --version fail if the variables aren't defined, like so: gcc --version Using built-in specs. gcc: fatal error: environment variable ‘<VARIABLE_NAME_HERE>’ not defined compilation terminated. It is a bit annoying to have to define environment variables just to be able to retrieve version info. We have been using a close variant of the attached patch to address this on gcc-4.7 and 4.9 for a while now. The patch was adjusted for mainline, I tested that it still operates as intended and performed a regular bootstrap + testsuite cycle showing no regression on x86_64-linux. OK to commit ? Thanks much in advance for your feedback, With Kind Regards, Olivier 2016-01-08 Olivier Hainque <hain...@adacore.com> * gcc.c (spec_undefvar_allowed): New global. (process_command): Set to true when running for --version or --help alone, or together. (getenv_spec_function): When the variable is not defined, use the variable name as the variable value if we're allowed not to issue a fatal error.
spec-undefvar.diff
Description: Binary data