Have your home inspected annually for pests such as termites, etc. Most insurance companies will not pay for damage to your home caused by pests so it is worth the money to have an inspection done so you can find a problem and fix it before it's too late and major damage is done to your home.
Termites will not only eat your wooden bookshelf, they will eat your books as well. Just like wood, paper contains the nutrients that termites need. This is a page about getting rid of book eating termites.
If you are buying a house and the inspection reveals the home has termites, you will want to make sure you are protected before finalizing the sale. This page has advice about buying a house with termites.
These white ants are most likely termites and it is important to deal with termite problems quickly. This is a page about getting rid of white ants.