Changing the SS pin in the Ethernet Library

I'm working on a project that requires all 12 PWM pins to operate 4 RGB LEDs and I want to use the Ethernet shield. The problem is that the Ethernet shield uses pin 10 (PWM) on the Arduino Mega.
So I thought I could change the CS pin in the Ethernet library to another pin I don't use and rewire it to the shield later.

The changes I made to the s5100.h file:

#if defined(__AVR_ATmega1280_DFR__)
  inline static void initSS()    { DDRL  |=  _BV(0); };
  inline static void setSS()     { PORTL &= ~_BV(0); };
  inline static void resetSS()   { PORTl |=  _BV(0); };
  #define WORKED
#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
  inline static void initSS()    { DDRB  |=  _BV(4); };
  inline static void setSS()     { PORTB &= ~_BV(4); };
  inline static void resetSS()   { PORTB |=  _BV(4); };
  #define N_WORKED 
#elif defined(__AVR_ATmega32U4__)
  inline static void initSS()    { DDRB  |=  _BV(6); };
  inline static void setSS()     { PORTB &= ~_BV(6); };
  inline static void resetSS()   { PORTB |=  _BV(6); }; 
#elif defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB162__)
  inline static void initSS()    { DDRB  |=  _BV(0); };
  inline static void setSS()     { PORTB &= ~_BV(0); };
  inline static void resetSS()   { PORTB |=  _BV(0); }; 
#else
  inline static void initSS()    { DDRB  |=  _BV(2); };
  inline static void setSS()     { PORTB &= ~_BV(2); };
  inline static void resetSS()   { PORTB |=  _BV(2); };
#endif

I use the WORKED en N_WORKED defines to verify that my changes work.
PORTL0 is pin 49 if I understand this schematic correctly (http://arduino.cc/en/uploads/Main/arduino-mega-schematic.pdf).

This is the sketch I used to check if it works:

/*
  DHCP-based IP printer
 
 This sketch uses the DHCP extensions to the Ethernet library
 to get an IP address via DHCP and print the address obtained.
 using an Arduino Wiznet Ethernet shield. 
 
 Circuit:
 * Ethernet shield attached to pins 10, 11, 12, 13
 
 created 12 April 2011
 modified 9 Apr 2012
 by Tom Igoe
 
 */
 
 /*
   By defining __AVR_ATmega1280_DFR__ a other pin then Digital pin 10 is used for Ethenet CS.
   Instead Digital pin 49 is used.
 */
#define __AVR_ATmega1280_DFR__
 

#include <SPI.h>
#include <Ethernet.h>

// Enter a MAC address for your controller below.
// Newer Ethernet shields have a MAC address printed on a sticker on the shield
byte mac[] = {  
  0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02 };

// Initialize the Ethernet client library
// with the IP address and port of the server 
// that you want to connect to (port 80 is default for HTTP):
EthernetClient client;

void setup() {
 // Open serial communications and wait for port to open:
  Serial.begin(19200);
  // this check is only needed on the Leonardo:
   while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }
  #if defined(WORKED)
    Serial.println("worked0");
  #endif
  #if defined(N_WORKED)
    Serial.println("didn't work0");
  #endif
  
  Serial.println("Connecting...");
  // start the Ethernet connection:
  if (Ethernet.begin(mac) == 0) {
    #if defined(WORKED)
      Serial.println("worked1");
    #endif
    #if defined(N_WORKED)
      Serial.println("didn't work1");
    #endif
    Serial.println("Failed to configure Ethernet using DHCP");
    // no point in carrying on, so do nothing forevermore:
    for(;;)
      ;
  }
  // print your local IP address:
  Serial.print("My IP address: ");
  for (byte thisByte = 0; thisByte < 4; thisByte++) {
    // print the value of each byte of the IP address:
    Serial.print(Ethernet.localIP()[thisByte], DEC);
    Serial.print("."); 
  }
  Serial.println();
}

void loop() {
}

The problem is that neither WORKED or N_WORKED seems to be defined and the Ethernet shield still only works if I connect pin 10 of the Arduino to the shields CS.

I thought I wasn't that bad in programming C/C++ but I can't see what I'm doing wrong here, can someone help me with this?
Thanks in advanced!

Hardware used:
-Arduino Ethernet shield R3
-DFRobot Arduino Mega1280 compatible
Software used:
-Arduino SDK 1.0.1
-Default Ethernet library

[kick]

It didn't hit either #define. Perhaps it fell into another case?

First thing I would do is #define another canary in the #else case at the end. Maybe all the cases.

-br

You modified a file that your sketch does not include, and you wonder why you don't see the changes. Did I understand that correctly?

@PaulS: Sorry, I should have explained. I include the Ethernet library and that includes the w5100.h file.

@billroy: So I did what you proposed and non of the values are defined. See code below
w5100.h

#if defined(__AVR_ATmega1280_DFR__)
  inline static void initSS()    { DDRL  |=  _BV(0); };
  inline static void setSS()     { PORTL &= ~_BV(0); };
  inline static void resetSS()   { PORTl |=  _BV(0); };
  #define WORKED
#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
  inline static void initSS()    { DDRB  |=  _BV(4); };
  inline static void setSS()     { PORTB &= ~_BV(4); };
  inline static void resetSS()   { PORTB |=  _BV(4); };
  #define N_WORKED0 
#elif defined(__AVR_ATmega32U4__)
  inline static void initSS()    { DDRB  |=  _BV(6); };
  inline static void setSS()     { PORTB &= ~_BV(6); };
  inline static void resetSS()   { PORTB |=  _BV(6); }; 
  #define N_WORKED1 
#elif defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB162__)
  inline static void initSS()    { DDRB  |=  _BV(0); };
  inline static void setSS()     { PORTB &= ~_BV(0); };
  inline static void resetSS()   { PORTB |=  _BV(0); }; 
  #define N_WORKED2 
#else
  inline static void initSS()    { DDRB  |=  _BV(2); };
  inline static void setSS()     { PORTB &= ~_BV(2); };
  inline static void resetSS()   { PORTB |=  _BV(2); };
  #define N_WORKED3 
#endif

sketch (just the changes):

#if defined(WORKED)
    Serial.println("worked0");
  #endif
  #if defined(N_WORKED0)
    Serial.println("didn't work0");
  #endif
  #if defined(N_WORKED1)
    Serial.println("didn't work1");
  #endif
  #if defined(N_WORKED2)
    Serial.println("didn't work2");
  #endif
  #if defined(N_WORKED3)
    Serial.println("didn't work3");
  #endif
  
  Serial.println("Connecting...");
  // start the Ethernet connection:
  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // no point in carrying on, so do nothing forevermore:
    for(;;)
      ;
  }
  
  #if defined(WORKED)
    Serial.println("worked0");
  #endif
  #if defined(N_WORKED0)
    Serial.println("didn't work0");
  #endif
  #if defined(N_WORKED1)
    Serial.println("didn't work1");
  #endif
  #if defined(N_WORKED2)
    Serial.println("didn't work2");
  #endif
  #if defined(N_WORKED3)
    Serial.println("didn't work3");
  #endif

Am I misinterpreting the code and is the Ethernet SS pin defined somewhere else?

And thank you both for your reply's!

Sure looks like the file isn't being included.

Here's a little party trick: put "choke me here" right after the last #endif to force the compile to fail. If it doesn't fail, perhaps the file is not being compiled after all.

-br

@PaulS: Sorry, I should have explained. I include the Ethernet library and that includes the w5100.h file.

Yes, I saw that. The #defines are active, in the ethernet library. But, you didn't include the header file in your sketch, so they are not active there. Compilation units matter. Your sketch is one. The ethernet library is another.

@billRoy:
Ah, now we are getting somewhere!
It chokes on line 337 just after #define N_WORKED0, the part that starts with #elif defined(AVR_ATmega1280) || defined(AVR_ATmega2560).
So it is still skipping my added #if defined(AVR_ATmega1280_DFR).

The question is why?

Are libraries pre-compiled before the sketch?

And if so is there a way for me make an opt-in alteration that I can enable in the sketch?

@PaulS:
So I included the w5100.h and it makes no difference. Is the order bellow correct?

#define __AVR_ATmega1280_DFR__
#include <SPI.h>
#include <w5100.h>
#include <Ethernet.h>