2009-12-17

GCC no longer use external specs file.

GCC since v4.0 no longer use external specs file. From info gcc (section "Specifying subprocesses and the switches to pass to them"):
`gcc' is a driver program. It performs its job by invoking a sequence of other programs to do the work of compiling, assembling and linking. GCC interprets its command-line parameters and uses these to deduce which programs it should invoke, and which command-line options it ought to place on their command lines. This behavior is controlled by "spec strings".
You can use specs file to avoid continually adds library dirs through -L or include dirs through -I. For example to line:
*lib: %{pg:-lgmon} %{mwindows:-lgdi32 -lcomdlg32} -luser32 -lkernel32 -ladvapi32 -lshell32
add such code:
-L/usr/local/lib
to tell gcc adds /usr/local/lib to linker options automatically.

In previous code you can see that when -pg option (to profile program) passed gcc adds libgmon to linker, when -mwindows passed gcc adds another libraries.

The specs file is no longer installed on most platforms because it buildin info gcc binary.

But you can still use it when specify it to gcc:

$ gcc -specs=specs-file ...
To get buildin into gcc spec strings invoke gcc like this:
$ gcc -dumpspecs <specs-file

See