summaryrefslogtreecommitdiffstats
path: root/meson.build
diff options
context:
space:
mode:
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build37
1 files changed, 31 insertions, 6 deletions
diff --git a/meson.build b/meson.build
index da7d05e..f64bd7a 100644
--- a/meson.build
+++ b/meson.build
@@ -6,10 +6,10 @@
# Authors: Martin Belanger <Martin.Belanger@dell.com>
#
project(
- 'libnvme', ['c', 'cpp'],
+ 'libnvme', ['c'],
meson_version: '>= 0.47.0',
- version: '1.0',
- license: 'LGPLv2+',
+ version: '1.1',
+ license: 'LGPL-2.1-or-later',
default_options: [
'c_std=gnu99',
'warning_level=1',
@@ -22,6 +22,7 @@ library_version = meson.project_version() + '.0'
################################################################################
cc = meson.get_compiler('c')
+cxx_available = add_languages('cpp', required: false)
prefixdir = get_option('prefix')
libdir = join_paths(prefixdir, get_option('libdir'))
@@ -36,10 +37,22 @@ pkgconfiglibdir = get_option('pkgconfiglibdir') == '' ? join_paths(libdir, 'pkgc
################################################################################
conf = configuration_data()
+version_tag = get_option('version-tag')
+if version_tag != ''
+ conf.set('GIT_VERSION', '"@0@"'.format(version_tag))
+else
+ r = run_command('meson-vcs-tag.sh',
+ meson.current_source_dir(),
+ meson.project_version(),
+ check: true)
+ conf.set('GIT_VERSION', '"@0@"'.format(r.stdout().strip()))
+endif
+conf.set('PROJECT_VERSION', '"@0@"'.format(meson.project_version()))
+
conf.set('SYSCONFDIR', '"@0@"'.format(sysconfdir))
# Check for libuuid availability
-libuuid_dep = dependency('uuid', required: true)
+libuuid_dep = dependency('uuid', required: true, fallback : ['uuid', 'uuid_dep'])
conf.set('CONFIG_LIBUUID', libuuid_dep.found(), description: 'Is libuuid required?')
# Check for json-c availability
@@ -65,6 +78,10 @@ if openssl_dep.found()
description: 'OpenSSL version 3.x')
endif
+# Check for libsystemd availability. Optional, only required for MCTP dbus scan
+libsystemd_dep = dependency('libsystemd', version: '>219', required: false)
+conf.set('CONFIG_LIBSYSTEMD', libsystemd_dep.found(), description: 'Is libsystemd(>219) available?')
+
# local (cross-compilable) implementations of ccan configure steps
conf.set10(
'HAVE_BUILTIN_TYPES_COMPATIBLE_P',
@@ -112,12 +129,12 @@ conf.set10(
)
conf.set10(
'HAVE_LITTLE_ENDIAN',
- build_machine.endian() == 'little',
+ host_machine.endian() == 'little',
description: 'Building for little-endian'
)
conf.set10(
'HAVE_BIG_ENDIAN',
- build_machine.endian() == 'big',
+ host_machine.endian() == 'big',
description: 'Building for big-endian'
)
conf.set10(
@@ -143,6 +160,14 @@ conf.set10(
),
description: 'Is isblank() available?'
)
+conf.set10(
+ 'HAVE_LINUX_MCTP_H',
+ cc.compiles(
+ '''#include <linux/mctp.h>''',
+ name: 'linux/mctp.h'
+ ),
+ description: 'Is linux/mctp.h include-able?'
+)
################################################################################
substs = configuration_data()