Rather than basing the list of supported languages on how gcc was configured,
instead try to compile a mini program for each language.  The problem with
looking at the configure line is that:
  - It can contain logical expressions like "all";
  - Default languages (C) might not be listed;
  - Distributions generally configure gcc with all languages, but the actual
    front-end is not installed by default (you have to install an extra package
    to get it).  For example on Debian based systems gcc will always have been
    configured for Fortran yet you can't compile Fortran programs unless you
    install the gfortran package.