configure.ac: Simplify version comparisons

Use AS_VERSION_COMPARE to properly compare gcc and libtool versions
in configure.ac.