(Solved) Best way in code to determine what libraries are available

My goal is to be able to put RPC or HTTP handler code into my C application for debugging and not have to manually comment out code when I remove the RPC and HTTP server from my mos.yml for production.

I have hunted around in the generated code, and it appears a good way to determine if libraries are included is to look for their configuration items (which are compiled into mgos_config.h). For example, to determine if RPC is available, I can

#ifdef MGOS_CONFIG_HAVE_RPC
// set up RPC handlers
#endif

#ifdef MGOS_CONFIG_HAVE_HTTP
// set up HTTP handlers
#endif

Is this the best/recommended way to do this, or is there a better mechanism?

MGOS_HAVE_* is what you need.

cat build/gen/vars.mk |grep ^MGOS_HAVE
MGOS_HAVE_ATCA=1
MGOS_HAVE_CA_BUNDLE=1
MGOS_HAVE_CORE=1
MGOS_HAVE_CRON=1
MGOS_HAVE_FREERTOS=1
MGOS_HAVE_HTTP_SERVER=1
MGOS_HAVE_I2C=1
MGOS_HAVE_LOCATION=1
MGOS_HAVE_MBEDTLS=1
MGOS_HAVE_MONGOOSE=1
MGOS_HAVE_OTA_COMMON=1
MGOS_HAVE_OTA_HTTP_CLIENT=1
MGOS_HAVE_OTA_HTTP_SERVER=1
MGOS_HAVE_RPC_COMMON=1
MGOS_HAVE_RPC_SERVICE_CONFIG=1
MGOS_HAVE_RPC_SERVICE_FS=1
MGOS_HAVE_RPC_UART=1
MGOS_HAVE_RPC_WS=1
MGOS_HAVE_SNTP=1
MGOS_HAVE_VFS_COMMON=1
MGOS_HAVE_VFS_FS_LFS=1
MGOS_HAVE_VFS_FS_SPIFFS=1
MGOS_HAVE_WIFI=1
MGOS_HAVE_ZZ_BOARDS=1

thanks. I thought I saw some weirdness in that MGOS_HAVE_RPC_WS seemed to be stuck at 1, but I blew away /build and /deps and all seems ok.