Fix a corruption when you remove first joystick on Linux.

Fixes a bug where the joystick subsystem would get corrupted if you unplug the
first of multiple joysticks. Fixes bug 1714.


CR: saml
Don't clobber refcounting in SDL_Init.

       - Fixes bug 1712 by not overwriting SDL_SubsystemRefCount in SDL_Init.
       - Removes the SDL_initialized variable, and makes SDL_SubsystemRefCount
         the canonical source of truth for whether or not a subsystem has been
         initialized.
       - Refactors SDL_InitSubSystem and SDL_QuitSubSystem to use helper
         functions to manage refcount.
       - Adds automated tests for SDL_Init/Quit*.
       - Adds SDL_bits.h which contains SDL_MostSignificantBitIndex.