A way to identify Leonardo or Teensy in a program?

fat16lib:
There needs to be a way to identify a board in a program.

Absolutely. Any multiple-hardware environment I've worked with has this. There is a really easy solution to this, and you could submit it as a patch to github today.

Add a "#define VARIANT_xxxx" to every pins_arduino.h file, with xxxx being the directory in which its found, e.g. "#define VARIANT_STANDARD" in variants/standard/pins_arduino.h, VARIANT_LEONARDO in variants/leonardo/pins_arduino.h.

This way the IDE doesn't need to do any special processing, and people who compile outside the IDE could take advantage of it also.