[glib: 1/2] Make libelf dependency optional via meson feature




commit aa0e120174fd1dc19ffbdba7cee8aa16de15b3ea
Author: Niklas Gürtler <profclonk gmail com>
Date:   Thu Oct 1 13:47:36 2020 +0000

    Make libelf dependency optional via meson feature

 gio/meson.build   | 4 ++--
 meson_options.txt | 5 +++++
 2 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/gio/meson.build b/gio/meson.build
index 40a9ca6d0..37af9e438 100644
--- a/gio/meson.build
+++ b/gio/meson.build
@@ -874,14 +874,14 @@ endif
 
 # Dependencies used by executables below
 have_libelf = false
-libelf = dependency('libelf', version : '>= 0.8.12', required : false)
+libelf = dependency('libelf', version : '>= 0.8.12', required : get_option ('libelf'))
 if libelf.found()
   have_libelf = true
 else
   # This fallback is necessary on *BSD. elfutils isn't the only libelf
   # implementation, and *BSD usually includes their own libelf as a system
   # library which doesn't have a corresponding .pc file.
-  libelf = cc.find_library('elf', required : false)
+  libelf = cc.find_library('elf', required : get_option ('libelf'))
   have_libelf = libelf.found()
   have_libelf = have_libelf and cc.has_function('elf_begin', dependencies : libelf)
   have_libelf = have_libelf and cc.has_function('elf_getshdrstrndx', dependencies : libelf)
diff --git a/meson_options.txt b/meson_options.txt
index c6f228a01..af9645eda 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -111,3 +111,8 @@ option('glib_checks',
        value : true,
        yield : true,
        description : 'Enable GLib checks such as API guards (see docs/macros.txt)')
+
+option('libelf',
+       type : 'feature',
+       value : 'auto',
+       description : 'Enable support for listing and extracting from ELF resource files with gresource tool')
\ No newline at end of file


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]