The nvidia legacy drivers don't build because some of the kernel's headers have changed since 2.6.18, so the solution is to simply create the header that the nvidia installer is trying to find.
Create a file in /usr/src/linux-2.6.21/include/linux
and put this text in it:
/* This file is no longer in use and kept only for backward compatibility.
* autoconf.h is now included via -imacros on the commandline
That should solve it (at least it did for me with the legacy drivers