configure.ac: move gmp detection to a separate file