meson.build revision ed6184df
1srcs_os = [
2    'WaitFor.c',
3    'access.c',
4    'auth.c',
5    'backtrace.c',
6    'client.c',
7    'connection.c',
8    'inputthread.c',
9    'io.c',
10    'mitauth.c',
11    'oscolor.c',
12    'osinit.c',
13    'ospoll.c',
14    'utils.c',
15    'xdmauth.c',
16    'xsha1.c',
17    'xstrans.c',
18    'xprintf.c',
19    'log.c',
20]
21
22# Wrapper code for missing C library functions. Note that conf_data contains either '1' or false.
23srcs_libc = []
24if conf_data.get('HAVE_REALLOCARRAY').to_int() == 0
25    srcs_libc += 'reallocarray.c'
26endif
27if conf_data.get('HAVE_STRCASECMP').to_int() == 0
28    srcs_libc += 'strcasecmp.c'
29endif
30if conf_data.get('HAVE_STRCASESTR').to_int() == 0
31    srcs_libc += 'strcasestr.c'
32endif
33if conf_data.get('HAVE_STRLCAT').to_int() == 0
34    srcs_libc += 'strlcat.c'
35endif
36if conf_data.get('HAVE_STRLCPY').to_int() == 0
37    srcs_libc += 'strlcpy.c'
38endif
39if conf_data.get('HAVE_STRNDUP').to_int() == 0
40    srcs_libc += 'strndup.c'
41endif
42if conf_data.get('HAVE_TIMINGSAFE_MEMCMP').to_int() == 0
43    srcs_libc += 'timingsafe_memcmp.c'
44endif
45if conf_data.get('HAVE_POLL').to_int() == 0
46    srcs_os += 'xserver_poll.c'
47endif
48
49if conf_data.get('BUSFAULT').to_int() != 0
50    srcs_os += 'busfault.c'
51endif
52
53if get_option('xdmcp')
54    srcs_os += 'xdmcp.c'
55endif
56
57rpc_dep = []
58if get_option('secure-rpc')
59    # prefer libtirpc (if available), otherwise ensure RPC functions are
60    # provided by libc.
61    rpc_dep = dependency('libtirpc', required: false)
62    if not (rpc_dep.found() or cc.has_header('rpc/rpc.h'))
63        error('secure-rpc requested, but neither libtirpc or libc RPC support were found')
64    endif
65    # XXX: also check if RPC library provides xdr_opaque_auth, authdes_(sec)create ???
66    srcs_os += 'rpcauth.c'
67endif
68
69os_dep = []
70os_c_args = []
71if get_option('xres')
72    # Only the XRes extension cares about the client ID.
73    os_c_args += '-DCLIENTIDS'
74    if host_machine.system() == 'openbsd'
75        os_dep += cc.find_library('kvm')
76    endif
77endif
78
79libxlibc = []
80if srcs_libc.length() > 0
81    libxlibc = static_library('libxlibc',
82        srcs_libc,
83        include_directories: inc,
84        dependencies: [
85            xproto_dep,
86        ],
87    )
88endif
89
90if enable_input_thread
91    os_dep += cc.find_library('pthread')
92endif
93
94libxserver_os = static_library('libxserver_os',
95    srcs_os,
96    include_directories: inc,
97    dependencies: [
98        dtrace_dep,
99        common_dep,
100        dl_dep,
101        sha1_dep,
102        rpc_dep,
103        os_dep,
104        dependency('xau')
105    ],
106    c_args: os_c_args,
107    link_with: libxlibc,
108)
109