Roam on certain countries, not in others Android version 4.1.2.

More and more mobile network providers seem to be offering "free" roaming, i.e. not having to pay additional charges when abroad. This is true only for some countries. My network provider will not charge me extra for using voice or data in a range of EU countries, but will indeed charge me a zillion bucks if not in one of those countries. So I have to take care. Some of these countries are rather small. I travel a lot and often I'm close to a border where the handset may inadvertently connect to a provider in a neighboring country. 

I would like to configure my phone to permanently allow data roaming when I'm connected to a network provider in one of those countries on the "whitelist". I would have to configure the "whitelist" myself, I guess.

I cannot figure out how to do this. Android doesn't seem to have the concept of allowing roaming for certain network provider countries and not for others. It's an all-or-nothing setting. Secondly I'm not sure a handset even has such data available. Does Android know that when connected to a network provider named "Vodafone Spain" that it is connected to a provider in country "Spain" ? If it is then it would be possible to create a more intelligent roaming application.

Please help. Is there something I can do with out-of-the-box Android or is there an intelligent app already made for this?

UPDATE

Based on Izzy's answer below I've tried out an app named "Roaming Control". It should be noted that I'm not affiliated with that company in any way.

The application doesn't allow to me to setup a new group of countries besides those already defined in the application. It does - however - allow me to configure a new additional single-country rule via the context menu button. If I configure a new rule for country "Spain" then that rule will show up on the Izzy's left-hand side screenshot of the app. If I'm actually in Spain (or more precisely: connected to a Spanish network provider) then that row will be highlighted in green. (The green highlighting seems to indicate the rule the application is currently using.)

Now, the nice thing here is that the application seems to be clever enough to understand that single-country rules should take precedence over group-country rules. So my newly defined rule for "Spain" will actually be the one used, rather than the pre-existing rule for "EU countries". Bingo. Exactly what I wanted to see.

I would have liked for the app to allow me to be able to define a new country group but I can live without it, meaning define each country on my network provider's whitelist individually.
An app named Roaming Control (maybe even its free trial) might help you out here. From the app's description:


  Roaming Control automatically enables or disables mobile data connection, airplane mode or auto sync based on the currently active network operator.
  [...]
  Besides manually defined network operators, Roaming Control also supports special rules for your home network, for national roaming and for unknown networks. For certain networks, free roaming partner networks are also supported.


To me that sounds like an exact match to your requirements. To give you a better idea, here are some screenshots:

  
Roaming Control Screenshots (source: Google Play; click images for larger variants)