summaryrefslogtreecommitdiff
path: root/meson.build
blob: eaebcfbdfb0db08a3bcc7604566af2cf2d0eee2f (plain)
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
project('at-spi2-core', 'c',
        version: '2.40.2',
        license: 'LGPLv2.1+',
        default_options: [
          'buildtype=debugoptimized',
          'warning_level=1',
          'c_std=c99',
        ],
        meson_version: '>= 0.46.0')

add_project_arguments([ '-D_POSIX_C_SOURCE=200809L', '-D_DEFAULT_SOURCE' ], language: 'c')

atspi_gir_ns = 'Atspi'

cc = meson.get_compiler('c')
host_system = host_machine.system()

soversion = '0.0.1'

at_spi_conf = configuration_data()
at_spi_conf.set('GETTEXT_PACKAGE', meson.project_name())

root_inc = include_directories('.')
registryd_inc = include_directories('registryd')

atspi_prefix = get_option('prefix')
atspi_datadir = join_paths(atspi_prefix, get_option('datadir'))
atspi_libexecdir = join_paths(atspi_prefix, get_option('libexecdir'))
atspi_sysconfdir = join_paths(atspi_prefix, get_option('sysconfdir'))
atspi_libdir = join_paths(atspi_prefix, get_option('libdir'))
atspi_includedir = join_paths(atspi_prefix, get_option('includedir'))

if get_option('dbus_services_dir') != 'default'
  dbus_services_dir = get_option('dbus_services_dir')
else
  dbus_services_dir = join_paths(get_option('datadir'), 'dbus-1/services')
endif

if get_option('systemd_user_dir') != 'default'
  systemd_user_dir = get_option('systemd_user_dir')
else
  systemd_user_dir = join_paths(get_option('prefix'), 'lib/systemd/user')
endif

# Dependencies
libdbus_req_version = '>= 1.5'
glib_req_version = '>= 2.62.0'
gobject_req_version = '>= 2.0.0'
gio_req_version = '>= 2.28.0'

libdbus_dep = dependency('dbus-1', version: libdbus_req_version)
glib_dep = dependency('glib-2.0', version: glib_req_version)
gobject_dep = dependency('gobject-2.0', version: gobject_req_version)
gio_dep = dependency('gio-2.0', version: gio_req_version)
if cc.has_function('dlopen')
  dl_dep = []
elif cc.has_function('dlopen', args: '-ldl')
  dl_dep = cc.find_library('dl')
else
  error('Could not find a library with the dlopen function')
endif

x11_deps = []
x11_option = get_option('x11')
if x11_option != 'no'
  x11_dep = dependency('x11', required: false)

  if x11_dep.found()
    x11_deps += x11_dep
    at_spi_conf.set('HAVE_X11', 1)
    xtest_dep = dependency('xtst')
    x11_deps += xtest_dep

    if cc.has_function('XkbGetMap', dependencies: x11_deps)
      at_spi_conf.set('HAVE_XKB', 1)
    endif

    xinput_dep = dependency('xi')
    x11_deps += xinput_dep
  endif
endif

# Alignments
at_spi_conf.set('ALIGNOF_CHAR', cc.alignment('char'))
at_spi_conf.set('ALIGNOF_DOUBLE', cc.alignment('double'))

dbus_alignments = [
  'dbus_bool_t',
  'dbus_int16_t',
  'dbus_int32_t',
  'dbus_int64_t',
]

foreach a: dbus_alignments
  at_spi_conf.set('ALIGNOF_' + a.underscorify().to_upper(),
                  cc.alignment(a, prefix: '#include <dbus/dbus.h>', dependencies: libdbus_dep))
endforeach

at_spi_conf.set('ALIGNOF_DBIND_POINTER', cc.alignment('dbind_pointer', prefix: 'typedef void *dbind_pointer;'))
at_spi_conf.set('ALIGNOF_DBIND_STRUCT', cc.alignment('dbind_struct', prefix: 'typedef struct { char s1; } dbind_struct;'))

# introspection support
have_gir = false

introspection_option = get_option('introspection')
if introspection_option != 'no'
  gir_dep = dependency('gobject-introspection-1.0', version: '>= 0.6.7', required: false)

  if gir_dep.found()
    have_gir = true
  endif
endif

xgettext = find_program('xgettext', required : false)

configure_file(output: 'config.h', configuration: at_spi_conf)

gnome = import('gnome')

subdir('dbind')
subdir('atspi')
subdir('bus')
subdir('registryd')
subdir('test')

if get_option('docs')
  subdir('doc/libatspi')
endif

if xgettext.found()
  subdir('po')
endif