-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathextconf.rb
56 lines (45 loc) · 1.65 KB
/
extconf.rb
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
##
# journald-native ruby gem - a simple systemd-journal wrapper
# Copyright (C) 2014 Anton Smirnov
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#
require 'mkmf'
LIBDIR = RbConfig::CONFIG['libdir']
INCLUDEDIR = RbConfig::CONFIG['includedir']
HEADER_DIRS = [INCLUDEDIR]
LIB_DIRS = [LIBDIR]
dir_config('systemd', HEADER_DIRS, LIB_DIRS)
$CFLAGS += ' -std=c11'
def have_funcs
# check functions. redefine const list in sd_journal.h if changed
%w(sd_journal_print sd_journal_sendv sd_journal_perror).inject(true) do |have_funcs, func|
have_funcs && have_func(func)
end
end
# check headers
have_header('systemd/sd-journal.h')
# first try to find funcs in systemd
have_library('systemd')
unless have_funcs
have_library('systemd-journal') # try to fall back to systemd-journal if older systemd
have_funcs
end
if with_config("dummy")
$defs.push "-DJOURNALD_NATIVE_COMPILE_DUMMY"
$defs.push "-DJOURNALD_NATIVE_SD_JOURNAL_DUMMY"
end
create_header
create_makefile('journald_native')