How to define root version in autoconf/automake environment?

I have project under autoconf/automake. What is the simplest&robust way to check ROOT version in configure.ac?
I need to distinguish ROOT5 vs. ROOT6 in order to setup different dictionary processing (rootcint vs rootcling) in Makefile.am

root-config --version
root-config --help