Commit 4e3ea4b8 authored by myfreeweb's avatar myfreeweb

Autodetect and use libepoll-shim on FreeBSD

parent 61f3e385
......@@ -173,6 +173,34 @@ litest_groups_rules_file = configure_file(input : 'udev/80-libinput-device-group
install : false,
configuration : litest_udev_rules_config)
############ libepoll-shim (BSD) ############
if cc.has_header_symbol('sys/epoll.h', 'epoll_create1', prefix : prefix)
# epoll is built-in (Linux, illumos)
dep_libepoll = declare_dependency()
else
# epoll is implemented in userspace by libepoll-shim (FreeBSD)
dir_libepoll = get_option('epoll-dir')
if dir_libepoll == ''
dir_libepoll = get_option('prefix')
endif
includes_epoll = include_directories(join_paths(dir_libepoll, 'include/libepoll-shim'))
dep_libepoll = cc.find_library('epoll-shim', dirs : join_paths(dir_libepoll, 'lib'))
code = '''
#include <sys/epoll.h>
int main(void) { epoll_create1(0); }
'''
if not cc.links(code,
name : 'libepoll-shim check',
dependencies : [dep_libepoll, dep_rt],
include_directories : includes_epoll) # note: wants an include_directories object
error('No built-in epoll or libepoll-shim found.')
endif
dep_libepoll = declare_dependency(
include_directories : includes_epoll,
dependencies : [dep_libepoll, dep_rt])
endif
############ libinput-util.a ############
src_libinput_util = [
'src/libinput-util.c',
......@@ -286,6 +314,7 @@ deps_libinput = [
dep_mtdev,
dep_udev,
dep_libevdev,
dep_libepoll,
dep_lm,
dep_rt,
dep_libwacom,
......
......@@ -2,6 +2,10 @@ option('udev-dir',
type: 'string',
value: '',
description: 'udev base directory [default=$prefix/lib/udev]')
option('epoll-dir',
type: 'string',
value: '',
description: 'libepoll-shim base directory (for non-Linux OS) [default=$prefix]')
option('libwacom',
type: 'boolean',
value: true,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment