The Nikon D40 and D40X will mount a lot of Nikon lenses.
Autofocus is only available with AF-S and AF-I lenses (the ones with internal motors).
Metering is available with AF and Ai-P lenses (“CPU lenses”).
Ai-S and Ai lenses will mount, but won’t meter.
See this page for a good overview of the alphabet soup that is Nikon lenses.
The following lenses will bust your camera and/or lens, according to my D40 manual:
- TC-16A AF teleconverter
- non-AI lenses
- lenses that need the AU-1 focusing unit (400mm ƒ/4.5, 600mm ƒ/5.6, 800mm ƒ/8, 1200mm ƒ/11)
- fisheye lenses (6mm ƒ/5.6, 7.5mm ƒ/5.6, 8mm ƒ/8, OP 10mm ƒ/5.6)
- Old-model 21mm ƒ/4
- K2 rings
- ED 180-600mm ƒ/8 (serial numbers 174041-174180)
- ED 360-1200mm ƒ/11 (serial numbers 174031-174127)
- 200-600mm ƒ/9.5 (serial numbers 120001-300490)
- lenses for F3AF (80mm ƒ/2.8, 200mm ƒ/3.5, TC-16 teleconverter)
- PC 28mm ƒ/4 (serial numbers 180900 or lower)
- PC 35mm ƒ/2.8 (serial numbers 851001-906200)
- Old-model PC 35mm ƒ/3.5
- Old-model 1000mm ƒ/6.3 Reflex
- 1000mm ƒ/11 Reflex (serial numbers 142361-143000)
- 2000mm ƒ/11 Reflex (serial numbers 200111-200310)
If you want more autofocus functionality, get the Nikon D80. If you want more metering, get the D200.