From what I read, it will work with D40, as long as the user don't mind adjusting the focus manually. And the camera will tell the user when the focus is correctly set by the beep sound as well as the red light in the viewfinder. So... it is workable.
Mine was a green light on my D60, and it didn't make a *Beep* sound as far as I know.
The only time the 50mm is a pain in the butt to manually focus is if you're trying to catch action shots with it. Which is what I was trying for, so being able to autofocus that lens on my D300 is heavenly.