link to libmath when checking for LUA_COMPAT