2016-04-11 14:16:34 +00:00
|
|
|
##
|
|
|
|
# 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
|
|
|
|
#
|
|
|
|
|
2014-10-28 23:21:46 +00:00
|
|
|
require 'mkmf'
|
|
|
|
|
|
|
|
LIBDIR = RbConfig::CONFIG['libdir']
|
|
|
|
INCLUDEDIR = RbConfig::CONFIG['includedir']
|
|
|
|
|
|
|
|
HEADER_DIRS = [INCLUDEDIR]
|
2015-07-28 03:20:19 +00:00
|
|
|
LIB_DIRS = [LIBDIR]
|
2014-10-28 23:21:46 +00:00
|
|
|
|
|
|
|
dir_config('systemd', HEADER_DIRS, LIB_DIRS)
|
|
|
|
|
2018-09-14 00:59:12 +00:00
|
|
|
$CFLAGS += ' -std=c11'
|
2015-07-28 03:20:19 +00:00
|
|
|
|
2015-02-05 13:58:57 +00:00
|
|
|
def have_funcs
|
|
|
|
# check functions. redefine const list in sd_journal.h if changed
|
2015-09-07 12:49:15 +00:00
|
|
|
%w(sd_journal_print sd_journal_sendv sd_journal_perror).inject(true) do |have_funcs, func|
|
|
|
|
have_funcs && have_func(func)
|
2015-02-05 13:58:57 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-10-28 23:21:46 +00:00
|
|
|
# check headers
|
2015-02-05 13:58:57 +00:00
|
|
|
have_header('systemd/sd-journal.h')
|
|
|
|
|
|
|
|
# first try to find funcs in systemd
|
|
|
|
have_library('systemd')
|
2014-10-28 23:21:46 +00:00
|
|
|
|
2015-02-05 13:58:57 +00:00
|
|
|
unless have_funcs
|
|
|
|
have_library('systemd-journal') # try to fall back to systemd-journal if older systemd
|
2015-02-05 14:29:19 +00:00
|
|
|
have_funcs
|
2014-10-28 23:21:46 +00:00
|
|
|
end
|
|
|
|
|
2018-10-11 13:39:27 +00:00
|
|
|
if with_config("dummy")
|
|
|
|
$defs.push "-DJOURNALD_NATIVE_COMPILE_DUMMY"
|
|
|
|
$defs.push "-DJOURNALD_NATIVE_SD_JOURNAL_DUMMY"
|
|
|
|
end
|
|
|
|
|
2015-02-05 13:58:57 +00:00
|
|
|
create_header
|
2014-10-30 20:42:16 +00:00
|
|
|
create_makefile('journald_native')
|