Need to determine which Arduino processor your code is running on? Simply access the signature bytes.
Why not add the 644/644P/1284P and the other P variants also, just for completeness sake?
Er, yes. But that is just accessing the define in the .h file. It isn't reading in the signature bytes from the actual chip. You may as well say:
#if defined (__AVR_ATmega164P__) // blah blah #endif