There are on-chip RC oscillators (4,8,12 MHz). I didn't try out yet to switch from the Main 12 MHz oscillator to the 8 MHz on-chip RC oscillator, but this could (theoritecally) give a 80 Mhz frequency, and therefore you could output 5 MHz. Note that the 8 and 12 MHz on-chip RC oscillators are calibrated in factory (see page 546, Sam3x datasheet).
If I have some time this WE, I will try out to find a code for that.
Anyway, since 4.94MHz is acceptable, you can use a Timer Counter to output a square wave with this frequency, and trigger an interrupt at each end of a period to decide whether you set(1)or clear(0) a particuliar pin (see your drawing).
For the 5 MHz clock, do you need a nice square wave (PWM with a 50%duty cycle), or another constant duty cycle would fit too ?