No, there is not a library for that, it depends on what battery you use.
You can use one of the analog inputs of Arduino to measure the voltage of the battery, but be careful, the maximum value of the analog input is 5V
, if your battery has more than 5V (e.g. 9V) you have to adapt that vale to the 0-5V range. You can adapt it using a resistor divider http://en.wikipedia.org/wiki/Voltage_divider
. Once you have the adapted voltage in Arduino you can "calculate" the actual voltage of the battery.
Use resistors about 1-10 megaohms!