#elif defined(__AVR_ATmega644P__)

I am trying to get the SD card library to work with a Sanguino variant, and the pin mappins are contained within define directives like the one above.

The problem is, I don't know where in hundreds of source files AVR_ATmega644P would be defined, if anywhere.

Where is the specific chipset used defined?

The problem is, I don't know where in hundreds of source files AVR_ATmega644P would be defined, if anywhere.

It is not defined in the source files. It is defined by the IDE, as an argument to the preprocessor/compiler, when you select a particular board.

Thanks. I just found this explanation as well: http://www.avrfreaks.net/index.php?name=PNphpBB2&file=printview&t=114875&start=0