Class for implementing several serial ports

As you want to use it on a non-standard Arduino, you will either have to modify an Arduino core for that processor ( many people have posted mods for many chips ), or use the AVR functionality directly, skipping the Arduino libraries. If you use an arduino core, this should work with any avr that supports up to 4 serial ports.

The technique used is template specialisations.

//SerialSelector declaration
template< int i_Number > class SerialSelector;

//SerialSelector specialisations.
#if defined(UBRRH) || defined(UBRR0H)
  template<> struct SerialSelector< 0 >{ static inline HardwareSerial &Get( void ){ return Serial; } };
#endif
#if defined(UBRR1H)
  template<> struct SerialSelector< 1 >{ static inline HardwareSerial &Get( void ){ return Serial1; } };
#endif
#if defined(UBRR2H)
  template<> struct SerialSelector< 2 >{ static inline HardwareSerial &Get( void ){ return Serial2; } };
#endif
#if defined(UBRR3H)
  template<> struct SerialSelector< 3 >{ static inline HardwareSerial &Get( void ){ return Serial3; } };
#endif

You could eventually extend it to return a SoftwareSerial interface when no hardware USART is available ( or need more than available )