Move kernel compat logic from hal_lib.c to rtapi_compat.c

FIXME: code in rtapi_main.c looks almost identical, but with incorrect
logic (we want to know if (flavor_id == RTAPI_XENOMAI_ID &&
!kernel_is_xenomai())).
sim_rtapi_app.cc:  silence a compiler warning
Makefile.inc.in:  Compute MODULE_EXT dynamically