that's what i thought so too, like in windows, SDL uses win32 api, etc. i asked coz i thought they are using another way..
It's not just a compile-time option. For example, on Linux, libSDL2 autodetects whether the system renderer is X11, Mir, or Wayland automatically, then instantiates the appropriate back end (by loading a DSO) to handle the required operations. On top of that, there's an EGL layer for handling OpenGL vs. OpenGL|ES and EGL itself needs to know the native renderer and window manager for context creation. That gives you nine possible combinations of dynamically determined back ends on Linux alone. None of that is compile-time, although the order in which back ends are autodetected is set at compile time (and at Ubuntu we switch the order so X11 is tried last instead of first).
Other supported platforms are simpler because they have a choice of one system renderer.