Resolve the possible use of negative value (detected by coverity tool)
[platform/upstream/at-spi2-core.git] / meson.build
1 project('at-spi2-core', 'c',
2         version: '2.31.1',
3         license: 'LGPLv2.1+',
4         default_options: [
5           'buildtype=debugoptimized',
6           'warning_level=1',
7           'c_std=c99',
8         ],
9         meson_version: '>= 0.40.1')
10
11 add_project_arguments([ '-D_POSIX_C_SOURCE=200809L', '-D_DEFAULT_SOURCE' ], language: 'c')
12
13 atspi_gir_ns = 'Atspi'
14
15 cc = meson.get_compiler('c')
16 host_system = host_machine.system()
17
18 soversion = '0.0.1'
19
20 at_spi_conf = configuration_data()
21 at_spi_conf.set('GETTEXT_PACKAGE', meson.project_name())
22
23 root_inc = include_directories('.')
24 registryd_inc = include_directories('registryd')
25
26 atspi_prefix = get_option('prefix')
27 atspi_datadir = join_paths(atspi_prefix, get_option('datadir'))
28 atspi_libexecdir = join_paths(atspi_prefix, get_option('libexecdir'))
29 atspi_sysconfdir = join_paths(atspi_prefix, get_option('sysconfdir'))
30 atspi_libdir = join_paths(atspi_prefix, get_option('libdir'))
31 atspi_bindir = join_paths(atspi_prefix, get_option('bindir'))
32 atspi_includedir = join_paths(atspi_prefix, get_option('includedir'))
33
34 if get_option('dbus_services_dir') != 'default'
35   dbus_services_dir = get_option('dbus_services_dir')
36 else
37   dbus_services_dir = join_paths(get_option('datadir'), 'dbus-1/services')
38 endif
39
40 if get_option('systemd_user_dir') != 'default'
41   systemd_user_dir = get_option('systemd_user_dir')
42 else
43   systemd_user_dir = join_paths(get_option('prefix'), 'lib/systemd/user')
44 endif
45
46 # Dependencies
47 libdbus_req_version = '>= 1.5'
48 glib_req_version = '>= 2.32.0'
49 gobject_req_version = '>= 2.0.0'
50 gio_req_version = '>= 2.28.0'
51 app_svc_req_version = '>= 0.0.0'
52
53 libdbus_dep = dependency('dbus-1', version: libdbus_req_version)
54 glib_dep = dependency('glib-2.0', version: glib_req_version)
55 gobject_dep = dependency('gobject-2.0', version: gobject_req_version)
56 gio_dep = dependency('gio-2.0', version: gio_req_version)
57 app_svc_dep = dependency('appsvc', version: app_svc_req_version)
58 dl_dep = cc.find_library('dl', required: false)
59
60 x11_deps = []
61 x11_option = get_option('enable-x11')
62 if x11_option != 'no'
63   x11_dep = dependency('x11', required: false)
64
65   if x11_dep.found()
66     x11_deps += x11_dep
67     at_spi_conf.set('HAVE_X11', 1)
68     xtest_dep = dependency('xtst')
69     x11_deps += xtest_dep
70
71     if cc.has_function('XkbGetMap', dependencies: x11_deps)
72       at_spi_conf.set('HAVE_XKB', 1)
73     endif
74
75     xinput_dep = dependency('xi')
76     x11_deps += xinput_dep
77   endif
78 endif
79
80 # Alignments
81 at_spi_conf.set('ALIGNOF_CHAR', cc.alignment('char'))
82 at_spi_conf.set('ALIGNOF_DOUBLE', cc.alignment('double'))
83
84 dbus_alignments = [
85   'dbus_bool_t',
86   'dbus_int16_t',
87   'dbus_int32_t',
88   'dbus_int64_t',
89 ]
90
91 foreach a: dbus_alignments
92   at_spi_conf.set('ALIGNOF_' + a.underscorify().to_upper(),
93                   cc.alignment(a, prefix: '#include <dbus/dbus.h>', dependencies: libdbus_dep))
94 endforeach
95
96 at_spi_conf.set('ALIGNOF_DBIND_POINTER', cc.alignment('dbind_pointer', prefix: 'typedef void *dbind_pointer;'))
97 at_spi_conf.set('ALIGNOF_DBIND_STRUCT', cc.alignment('dbind_struct', prefix: 'typedef struct { char s1; } dbind_struct;'))
98
99 # introspection support
100 have_gir = false
101
102 introspection_option = get_option('enable-introspection')
103 if introspection_option != 'no'
104   gir_dep = dependency('gobject-introspection-1.0', version: '>= 0.6.7', required: false)
105
106   if gir_dep.found()
107     have_gir = true
108   endif
109 endif
110
111 xgettext = find_program('xgettext', required : false)
112
113 configure_file(output: 'config.h', configuration: at_spi_conf)
114
115 gnome = import('gnome')
116
117 subdir('dbind')
118 subdir('atspi')
119 subdir('bus')
120 subdir('registryd')
121 subdir('test')
122
123 if get_option('enable_docs')
124   subdir('doc/libatspi')
125 endif
126
127 if xgettext.found()
128   subdir('po')
129 endif