Allow compilation with external SDL2.
Ensure that libpthread is linked where needed.