scons: improved error handling for sql client lib and added support for mariadb_config

This commit is contained in:
loonycyborg 2019-01-15 14:23:47 +03:00
parent f6aea1a44b
commit d1ed0dccd1

View file

@ -420,10 +420,21 @@ if env["prereqs"]:
client_env.Append(CPPDEFINES = ["HAVE_HISTORY"])
if env["forum_user_handler"]:
mysql_config = check_output(["mysql_config", "--libs", "--cflags"]).replace("\n", " ").replace("-DNDEBUG", "")
mysql_flags = env.ParseFlags(mysql_config)
env.Append(CPPDEFINES = ["HAVE_MYSQLPP"])
env.MergeFlags(mysql_flags)
found_connector = False
for sql_config in ["mariadb_config", "mysql_config"]:
try:
mysql_config = check_output([sql_config, "--libs", "--cflags"]).replace("\n", " ").replace("-DNDEBUG", "")
mysql_flags = env.ParseFlags(mysql_config)
env.Append(CPPDEFINES = ["HAVE_MYSQLPP"])
env.MergeFlags(mysql_flags)
found_connector = True
break
except OSError:
print("Failed to run script '%s'" % sql_config)
if not found_connector:
Exit("Failed to find sql connector library but forum user handler support is requested.")
have_server_prereqs = False
client_env = conf.Finish()