Fixes #2541, build failure with Wayland enabled, OpenGL ES disabled

Also includes an attempt at fixing building SDL on Ubuntu 13.10, which hopefully
won't break 14.04