File: meson.build

package info (click to toggle)
isc-kea 3.0.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 62,036 kB
  • sloc: cpp: 594,791; sh: 26,896; lex: 8,540; yacc: 8,424; python: 1,065; xml: 149; makefile: 39
file content (40 lines) | stat: -rw-r--r-- 1,551 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
project('postgresql')
postgresql = disabler()

cpp = meson.get_compiler('cpp')
libpq = cpp.find_library('pq', required: false)

pg_config = find_program('pg_config', required: false)
if pg_config.found()
    cppflags = run_command([pg_config, '--cppflags'], 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)
    version = run_command([pg_config, '--version'], check: false)
    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_includedir_args = includedir.stdout().split()
        pgsql_ldflags = ldflags.stdout().split()
        pgsql_libdir = libdir.stdout().strip()
        pgsql_link_args = libs.stdout().split()
        pgsql_version = version.stdout().strip()

        link_args = [f'-L@pgsql_libdir@'] + pgsql_ldflags + pgsql_link_args
        if libpq.found()
            link_args += ['-lpq']
        endif

        postgresql = declare_dependency(
            compile_args: pgsql_compile_args,
            include_directories: pgsql_includedir_args,
            link_args: link_args,
            version: pgsql_version,
        )
    endif
endif

# Last resort
if not postgresql.found()
    postgresql = libpq
endif