You're out of luck, there is no 40MHz setting for this part.

As far as I am aware, the 16F876 only goes to 20MHz (and then you need a 20MHz xtal).

Some 18F parts have an internal x4 PLL which will allow you to run at 40MHz with a 10MHz xtal, but the 16F876 does not have that feature.

Always check the PIC's Datasheet which you can download from the Microchip website.