Em primeiro lugar, observe que o prefixo padrão a menos que um seja explicitamente especificado é mais frequentemente / usr / local. Portanto, sobrescrever a instalação em / usr pode nem ser um problema no seu caso, embora certamente possa causar confusão no futuro tendo um GCC em / usr e outro em / usr / local.
Embora eu não tenha certeza se ele funciona especificamente com o gcc-4.9.1 (embora eu veja poucos motivos para isso não funcionar), o autoconf (que gera o script configure
) fornece recursos para sobrescrever o prefixo em tempo de instalação.
Citando a documentação do autoconf, seção "nomes de instalação ":
The most portable way to affect installation locations is to pass the correct locations to configure; however, many packages provide one or both of the following shortcuts of passing variable assignments to the ‘make install’ command line to change installation locations without having to reconfigure or recompile.
The first method involves providing an override variable for each affected directory. For example, ‘make install prefix=/path/to/alternate’ will choose an alternate location, as well as influencing all other directory configuration variables that were expressed in terms of ‘${prefix}’ (or, put another way, all directories specified during configure but not in terms of the common prefix must each be overridden at install time for the entire installation to be relocated). The approach of makefile variable overrides for each directory variable is required by the GNU Coding Standards, and ideally causes no recompilation. However, some platforms have known limitations with the semantics of shared libraries that end up requiring recompilation when using this method, particularly noticeable in packages that use GNU Libtool.
The second method involves providing the ‘DESTDIR’ variable. For example, ‘make install DESTDIR=/path/to/alternate’ will prepend ‘/path/to/alternate’ before all installation paths. The approach of ‘DESTDIR’ overrides is not required by the GNU Coding Standards, and does not work on platforms that have drive letters. On the other hand, it does better at avoiding recompilation issues, and works well even when some directory options were not specified in terms of ‘${prefix}’ at configure time. For packages which support ‘DESTDIR’, the variable should remain undefined during configure and ‘make all’, and only be specified during ‘make install’.
Portanto, make install DESTDIR=/opt/gcc-4.8.2
deve fazer praticamente o que você procura. Talvez seja necessário mover os arquivos um pouco depois, dependendo da estrutura de diretórios exata desejada, mas ela deve ser boa o suficiente para começar.
Note que eu não testei isso; você corre por seu próprio risco.