mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-08-22 18:08:16 +00:00
[#3732] Detect postgres under macos
This commit is contained in:
parent
2c8882ae18
commit
d378ab3635
@ -1,21 +1,40 @@
|
|||||||
project('postgresql')
|
project('postgresql')
|
||||||
postgresql = disabler()
|
postgresql = disabler()
|
||||||
|
|
||||||
|
cpp = meson.get_compiler('cpp')
|
||||||
|
libpq = cpp.find_library('pq', required: false)
|
||||||
|
|
||||||
pg_config = find_program('pg_config', required: false)
|
pg_config = find_program('pg_config', required: false)
|
||||||
if pg_config.found()
|
if pg_config.found()
|
||||||
cppflags = run_command([pg_config, '--cppflags'], check: false)
|
cppflags = run_command([pg_config, '--cppflags'], check: false)
|
||||||
includedir = run_command([pg_config, '--includedir'], check: false)
|
includedir = run_command([pg_config, '--includedir'], check: false)
|
||||||
|
ldflags = run_command([pg_config, '--ldflags'], check: false)
|
||||||
|
libdir = run_command([pg_config, '--libdir'], check: false)
|
||||||
libs = run_command([pg_config, '--libs'], check: false)
|
libs = run_command([pg_config, '--libs'], check: false)
|
||||||
version = run_command([pg_config, '--version'], check: false)
|
version = run_command([pg_config, '--version'], check: false)
|
||||||
if cppflags.returncode() == 0 and includedir.returncode() == 0 and libs.returncode() == 0 and version.returncode() == 0
|
if cppflags.returncode() == 0 and includedir.returncode() == 0 and libdir.returncode() == 0 and ldflags.returncode() == 0 and libs.returncode() == 0 and version.returncode() == 0
|
||||||
pgsql_compile_args = cppflags.stdout().split()
|
pgsql_compile_args = cppflags.stdout().split()
|
||||||
pgsql_includedir_args = includedir.stdout().split()
|
pgsql_includedir_args = includedir.stdout().split()
|
||||||
|
pgsql_ldflags = ldflags.stdout().split()
|
||||||
|
pgsql_libdir = libdir.stdout().strip()
|
||||||
pgsql_link_args = libs.stdout().split()
|
pgsql_link_args = libs.stdout().split()
|
||||||
pgsql_version = version.stdout().strip()
|
pgsql_version = version.stdout().strip()
|
||||||
|
|
||||||
|
link_args = [pgsql_libdir] + pgsql_ldflags + pgsql_link_args
|
||||||
|
if libpq.found()
|
||||||
|
link_args += ['-lpq']
|
||||||
|
endif
|
||||||
|
|
||||||
postgresql = declare_dependency(
|
postgresql = declare_dependency(
|
||||||
compile_args: pgsql_compile_args,
|
compile_args: pgsql_compile_args,
|
||||||
include_directories: pgsql_includedir_args,
|
include_directories: pgsql_includedir_args,
|
||||||
link_args: pgsql_link_args,
|
link_args: link_args,
|
||||||
version: pgsql_version,
|
version: pgsql_version,
|
||||||
)
|
)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# Last resort
|
||||||
|
if not postgresql.found()
|
||||||
|
postgresql = libpq
|
||||||
|
endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user