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 called
config.h and put this text in it:
#ifndef _LINUX_CONFIG_H
#define _LINUX_CONFIG_H
/* This file is no longer in use and kept only for backward compatibility.
* autoconf.h is now included via -imacros on the commandline
*/
#include <linux/autoconf.h>
#endif
That should solve it (at least it did for me with the legacy drivers

)