configure: run libgl1-mesa-dri workaround test after libGL has been tested for

the workaround test could give a confusing error message if libGL isnt
installed. Move the test past the point where libGL has been tested for.

This isnt 100% - libGL is only tested for if --disable-python is not
given, but it's an improvement for the common case.