use gmake functions and mysql_config tool to auto-detect settings

* ROOT_PATH can be determined from build_gateway.inc path in MAKEFILE_LIST
* MariaDB include and library paths can be taken from mysql_config output

this way there should be no need to edit build_gateway.inc at all in most
cases if mysql_config is in $PATH