From da003219abf27766aec78013d5036e08fef76a58 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Mon, 13 May 2019 22:57:51 +0200 Subject: Add tests for headers etc --- meson.build | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 53 insertions(+), 9 deletions(-) diff --git a/meson.build b/meson.build index 106aa030..8163dd9f 100644 --- a/meson.build +++ b/meson.build @@ -23,7 +23,7 @@ gtkspell = dependency('gtkspell-2.0', required : false) aspell = dependency('aspell', required : false) enchant = dependency('enchant', required : false) oniguruma = dependency('oniguruma', required : false) - +# Compface check is further down # Suppress some compiler warnings (for now) @@ -85,6 +85,16 @@ if oniguruma.found() add_project_arguments('-DUSE_ONIGURUMA', language : 'c') endif +if compiler.has_header('compface.h') + conf_data.set('HAVE_LIBCOMPFACE', 1) + compface_link_args = ['-lcompface'] +else + compface_link_args = [] +endif + +compface = declare_dependency(compile_args : [], + link_args : compface_link_args) + if compiler.has_header('sys/wait.h') conf_data.set('HAVE_SYS_WAIT_H', 1) endif @@ -101,6 +111,33 @@ if compiler.has_header('sys/utsname.h') conf_data.set('HAVE_SYS_UTSNAME_H', 1) endif +if compiler.has_header('alloca.h') + conf_data.set('HAVE_ALLOCA_H', 1) +endif + +if compiler.has_header('paths.h') + conf_data.set('HAVE_PATHS_H', 1) +endif + +if compiler.has_header('locale.h') + conf_data.set('HAVE_LOCALE_H', 1) +endif + +if compiler.has_header('sys/mman.h') + conf_data.set('HAVE_SYS_MMAN_H', 1) +endif + +if compiler.has_header('lockfile.h') + conf_data.set('HAVE_LOCKFILE_H', 1) + conf_data.set('HAVE_LIBLOCKFILE', 1) + lockfile_link_args = ['-llockfile'] +else + lockfile_link_args = [] +endif + +lockfile = declare_dependency(compile_args : [], + link_args : lockfile_link_args) + if compiler.has_header('regex.h') conf_data.set('HAVE_REGEX_H', 1) endif @@ -109,14 +146,21 @@ if compiler.has_function('regcomp', prefix : '#include ') conf_data.set('HAVE_REGCOMP', 1) endif -if compiler.has_header('compface.h') - conf_data.set('HAVE_LIBCOMPFACE', 1) - compface_link_args = ['-lcompface'] -else - compface_link_args = [] +if compiler.has_function('lockf', prefix : '#include ') + conf_data.set('HAVE_LOCKF', 1) +endif + +if compiler.has_function('flock', prefix : '#include ') + conf_data.set('HAVE_FLOCK', 1) +endif + +if compiler.has_function('mlock', prefix : '#include ') + conf_data.set('HAVE_MLOCK', 1) +endif + +if compiler.has_function('truncate', prefix : '#include \n#include ') + conf_data.set('HAVE_TRUNCATE', 1) endif -compface = declare_dependency(compile_args : [], - link_args : compface_link_args) configure_file(output : 'config.h', configuration : conf_data) @@ -186,7 +230,7 @@ libsylph = library('sylph', 'libsylph/virtual.c', 'libsylph/xml.c'], include_directories : libsylph_includes, - dependencies : [glib, gobject, openssl, oniguruma], + dependencies : [glib, gobject, openssl, oniguruma, lockfile], install : true) libsylph_dep = declare_dependency(include_directories : libsylph_includes, -- cgit v1.2.3