diff options
author | Karel Zak <kzak@redhat.com> | 2024-04-05 10:57:13 +0200 |
---|---|---|
committer | Karel Zak <kzak@redhat.com> | 2024-04-05 10:57:13 +0200 |
commit | 6f548300b2b823af0b2ae208e12ddfdeebe3e71d (patch) | |
tree | b71be15a967fb23f2501b4d9d342b60bda2b18bf | |
parent | a2d5c0caf8e54a6622a3d7e5ec140f26cfc671bb (diff) | |
parent | 243950279f413e3844d13a2d87b3853c1242f437 (diff) | |
download | util-linux-6f548300b2b823af0b2ae208e12ddfdeebe3e71d.tar.gz |
Merge branch 'meson-optional-rt' of https://github.com/jwillikers/util-linux
* 'meson-optional-rt' of https://github.com/jwillikers/util-linux:
meson: Only pick up the rt library once
meson: Add build-lsfd option and make rt dependency optional
-rw-r--r-- | meson.build | 32 | ||||
-rw-r--r-- | meson_options.txt | 2 |
2 files changed, 20 insertions, 14 deletions
diff --git a/meson.build b/meson.build index daf1527327..688ea91202 100644 --- a/meson.build +++ b/meson.build @@ -733,12 +733,15 @@ if not cc.has_function('socket') endif endif +lib_rt = cc.find_library('rt', required : false) realtime_libs = [] have = cc.has_function('clock_gettime') if not have - realtime_libs += cc.find_library('rt', required : true) - have = cc.has_function('clock_gettime', - dependencies : realtime_libs) + if lib_rt.found() + realtime_libs += lib_rt + have = cc.has_function('clock_gettime', + dependencies : realtime_libs) + endif endif conf.set('HAVE_CLOCK_GETTIME', have ? 1 : false) @@ -746,9 +749,11 @@ thread_libs = dependency('threads') have = cc.has_function('timer_create') if not have - realtime_libs = [cc.find_library('rt', required : true)] - have = cc.has_function('timer_create', - dependencies : realtime_libs) + if lib_rt.found() + realtime_libs = [lib_rt] + have = cc.has_function('timer_create', + dependencies : realtime_libs) + endif if not have realtime_libs += thread_libs have = cc.has_function('timer_create', @@ -2759,19 +2764,18 @@ errnos_h = custom_target('errnos.h', command : ['tools/all_errnos', cc.cmd_array(), get_option('c_args')], ) -mq_libs = [] -mq_libs += cc.find_library('rt', required : true) - +opt = not get_option('build-lsfd').require(lib_rt.found()).disabled() exe = executable( 'lsfd', lsfd_sources, errnos_h, include_directories : includes, link_with : [lib_common, lib_smartcols], - dependencies : mq_libs, + dependencies : [lib_rt], install_dir : usrbin_exec_dir, - install : true) -if not is_disabler(exe) + install : opt, + build_by_default : opt) +if opt and not is_disabler(exe) exes += exe manadocs += ['misc-utils/lsfd.1.adoc'] endif @@ -3547,14 +3551,14 @@ exe = executable( build_by_default: program_tests) exes += exe -if LINUX +if LINUX and lib_rt.found() exe = executable( 'test_mkfds', 'tests/helpers/test_mkfds.c', 'tests/helpers/test_mkfds.h', 'tests/helpers/test_mkfds_ppoll.c', include_directories : includes, - dependencies : mq_libs, + dependencies : [lib_rt], build_by_default: program_tests) exes += exe endif diff --git a/meson_options.txt b/meson_options.txt index 76e917b56e..1bc0bc2ecf 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -101,6 +101,8 @@ option('build-cal', type : 'feature', description : 'build cal') option('build-logger', type : 'feature', description : 'build logger') +option('build-lsfd', type : 'feature', + description : 'build lsfd') option('build-switch_root', type : 'feature', description : 'switch_root') option('build-pivot_root', type : 'feature', |