2025-03-10 14:08:51 +02:00
|
|
|
project('mysql')
|
2025-03-11 12:58:02 +02:00
|
|
|
mysql = dependency('mysql', required: false)
|
2025-03-10 14:08:51 +02:00
|
|
|
foreach mysql_config_file : ['mariadb_config', 'mysql_config']
|
2025-03-11 12:58:02 +02:00
|
|
|
if mysql.found()
|
2025-03-10 14:08:51 +02:00
|
|
|
continue
|
|
|
|
endif
|
|
|
|
mysql_config = find_program(mysql_config_file, required: false)
|
|
|
|
if not mysql_config.found()
|
|
|
|
continue
|
|
|
|
endif
|
2025-03-14 14:17:17 +02:00
|
|
|
cflags = run_command([mysql_config, '--cflags'], check: false)
|
2025-03-10 14:08:51 +02:00
|
|
|
libs = run_command([mysql_config, '--libs'], check: false)
|
|
|
|
version = run_command([mysql_config, '--version'], check: false)
|
|
|
|
|
2025-03-14 14:17:17 +02:00
|
|
|
if cflags.returncode() == 0 and libs.returncode() == 0 and version.returncode() == 0
|
|
|
|
mysql_compile_args = cflags.stdout().split()
|
2025-03-10 14:08:51 +02:00
|
|
|
mysql_link_args = libs.stdout().split()
|
|
|
|
mysql_version = version.stdout().strip()
|
|
|
|
mysql = declare_dependency(
|
|
|
|
compile_args: mysql_compile_args,
|
|
|
|
link_args: mysql_link_args,
|
|
|
|
version: mysql_version,
|
|
|
|
)
|
|
|
|
break
|
|
|
|
endif
|
|
|
|
endforeach
|
|
|
|
|