The French had the same rule when they were ruled by kings--the descent had to be entirely in the male line. When Charles X was forced to abdicate in 1830, and they didn't want to hand the throne to his young grandson, they went to the nearest cousin who went back entirely in the male line, and he became King Louis Philippe. (He was descended from the brother of Louis XIV.)
Shakespeare has a passage in Henry the Fifth, Act I, Scene II, where this rule is discussed:
"In terram Salicam mulieres ne succedant,"
"No woman shall succeed in Salique land"
I think they have to go back about 1200 years unless somebody has a boy real soon.
Whole big bunches of the royal lines ran out in the 1800s. I've looked through the primary genealogies, and it looks like they were all hit particularly hard by tuberculosis.