Finding supported GLSL version
There's a specific mapping between OpenGL version and supported GLSL version:
GLSL Version OpenGL Version
1.10 2.0
1.20 2.1
1.30 3.0
1.40 3.1
1.50 3.2
3.30 3.3
4.00 4.0
4.10 4.1
4.20 4.2
4.30 4.3
4.40 4.4
4.50 4.5
There's a well defined API for querying the OpenGL version. Use the table above for mapping to GLSL versions (after OpenGL-3.3 it's very logical).
Furthermore the specification defines the format of the GL_VERSION and GL_SHADING_LANGUAGE_VERSION to
begin with a version number. The version number uses one of these forms:
major_number.minor_number | major_number.minor_number.release_number