Identifying a processor within a sketch

I have a number of sketches that are sometimes used with a Duemilanove, and sometimes on a Mega2560.

When I switch the code between the two arduinos I often have to change a few lines where I use different pins on different shields. Is there someway of programatically identifying which processor I'm running on so I can do this switch automatically.

The following pseudo-code illustrates what I'm after...

if 'duemilanove' then
pinA=1
pinB=2 etc...
elseif 'Mega' then
PinA =53
pinB =54

Thanks

#if defined( AVR_ATmega168 )
// Duemilanove stuff goes here
#endif

#if defined( AVR_ATmega2560 )
// Mega 2560 stuff goes here
#endif

Thanks - just what I was looking for.

Are there any other system variables like this? if so are they documented anywhere?

Yes. Yes.

The GCC compiler is used so...
http://www.google.com/search?q=gcc+compiler+defined+macros