Code:
gcc: error: unrecognized command line option '-V'
gcc: fatal error: no input files
compilation terminated.
configure:4189: $? = 1
configure:4178: gcc -qversion >&5
gcc: error: unrecognized command line option '-qversion'
gcc: fatal error: no input files
It looks like it's doing a check for gcc < 5.x, (Line 4178) and running 'gcc -V' when it wants 'gcc --version.' (Line 4189)
I would try a gentle hack of the script around there. Presume that every line you write will be wrong, and retain the original commented out. You may need it.