Linux Step By Steps


From: jordan <>

> Mike Andrew wrote:
> Do you know a shorthand way for ALL instances of ./configure, make,
> make install
that will compile for a specific cpu?

In most cases ./configure does pick the proper cpu, but it gets this from uname values I believe, to force certain switched to be used every time you configure and compile source all you have to do is set up a couple environment variables.

For example you wish to have ./configure and thus subsequently make compile a given piece of softwarefor a p3 with certain optimizations then we could on the command line do a quick export to set up the variables we wish to use, though as you all know this will only remain as long as the term or console window remains open. To permenatly set them just add them to your .bashrc file either globally, or privately. Now for the example above, you would add this to your .bashrc:

export "CFLAGS=-O3 -mpentiumpro -fexpensive-optimizations -malign-jumps=2 -malign-functions=2 -malign-loops=2"
export "CXXFLAGS=-O3 -mpentiumpro -fexpensive-optimizations -malign-jumps=2 -malign-loops=2 -malign-functions=2"

(no line break or add a \ if you want the break)

Notice I use some silly optimizations that are'nt all that necessary, in fact most people will tell you -02 is about the best optimization to use as -03 simply adds the inline stuff. The pther four opts I use are not included in the -03 switch so I added them it increases compile time but produces somewhat slimer binaries.
There now everytime you run ./configure you will have these optimizations.