Is non vegetarian food allowed to be consumed in case of survival? Is there any reference in the ancient scriptures?
Yes one can eat such foods to survive when the life is endangered.
First, we have the following verse from Manu Smriti:
5.27. One may eat meat when it has been sprinkled with water, while Mantras were recited, when Brahmanas desire (one’s doing it), when one is engaged (in the performance of a rite) according to the law, and when one’s life is in danger.
And, in the 10th chapter of the same text, we find examples of some Rishis like Viswamitra, Vamadeva etc, who ate even forbidden meat, when it was a question of survival for them.
These verses emphasize the fact that during emergencies, when life itself is in distress, one may not require to follow the rules of Dharma which one is required to do in normal circumstances.
10.105. Agigarta, who suffered hunger, approached in order to slay (his own) son, and was not tainted by sin, since he (only) sought a remedy against famishing
10.106. Vamadeva, who well knew right and wrong, did not sully himself when, tormented (by hunger), he desired to eat the flesh of a dog in order to save his life.
10.107. Bharadvaga, a performer of great austerities, accepted many cows from the carpenter Bribu, when he was starving together with his sons in a lonely forest.
10.108. Visvamitra, who well knew what is right or wrong, approached, when he was tormented by hunger, (to eat) the haunch of a dog, receiving it the hands of a Kandala.
So, one is allowed to do so as per scriptures.