Most programs and libraries by default are compiled with debugging symbols and optimizing level 2(options -g and -o2) and compiled for the 386, at least on intel platforms. Chances are you don't need debugging symbols and want to optimize programs and libraries for your athlon box. There are a few ways to optimize the programs and libraries for your athlon, but they are all fairly simple.
The first way to is to edit every MakeFile in a package and edit the CFLAGS and CXXFLAGS to match the CFLAGS used for Athlon Optimization(a well designed package uses the CFLAGS variable to define gcc compiler options and CXXFLAGS to define g++ compiler options). Packages like binutils, gcc, glibc and others have a lot of Makefile files in a lot of subdirectories so this would take a lot of time to do. Instead there's an easier way to do things: create the CFLAGS and CXXFLAGS environment variables. Most configure scripts read the CFLAGS and CXXFLAGS variables and use them in the Makefile files. A few packages don't follow this convention and those package require manual editing.
To set the enviromental variables you should enter a command similar to the following in the
terminal that you are going to use to compile the software in. If you leave the
terminal to pause compilation and continue later or do anything else, make sure you execute the following commands again when you start compiling again (you only need to execute it once when you open a new virtual console, xterm, Eterm or some other terminal emulation program).
root:~# export CFLAGS="-O3 -mcpu=xxx -march=yyy"
root:~# export CXXFLAGS="-O3 -mcpu=xxx -march=yyy"
Note: These flags are here for example only, for the actual flags you should use when setting the enviromental variables head over to the
Occasionally you may find that a package may not compile and give errors like "segmentation fault, core dumped". If it is a stable package then it probably has to do with the compiler optimizations, try lowering the optimizing level by changes '-o3' to '-o2' or '-o1'. If that doesn't work try removing '-o' completly. If you still have problems try compiling for the pentiumpro or pentium instead of the athlon by changing the '-march', '-mcpu' and '-m' options accordingly.
Compilers are very sensitive to certain hardware too. Bad memory can cause compilation problems when a high level of optimization is used, like the -O3 setting.
Constantly exporting these enviromental variables can be a pain, so it would be smart to instert these commands into your /etc/profile, $HOME/.bashrc or similar files. I prefer to make several shell scripts that export the variables automatically, a different shell script for different optimization settings.
This allows me to easily adjust the compiler options when a package doesn't compile. Or you can make a giant shell script that exports the variables automatically depending on what you want at the time you run the script. An Example script will be up shortly.