From 04d17437b2d42b47e3863cecd1d5709ea7953c38 Mon Sep 17 00:00:00 2001 From: Manatsawin Hanmongkolchai Date: Mon, 13 Sep 2021 15:40:26 +0700 Subject: [PATCH] Detect iconv by compiler.find_library --- datrie/meson.build | 4 ---- meson.build | 26 +++++--------------------- meson_options.txt | 1 - 3 files changed, 5 insertions(+), 26 deletions(-) diff --git a/datrie/meson.build b/datrie/meson.build index cb1bf871..d3c53569 100644 --- a/datrie/meson.build +++ b/datrie/meson.build @@ -1,10 +1,6 @@ ldflags = [] link_depends = ['libdatrie.map'] -if ld_no_undefined != '' - ldflags += [ld_no_undefined] -endif - if ld_has_version_script ldflags += [ '-Wl,--version-script,@0@'.format(meson.current_source_dir() / 'libdatrie.map') diff --git a/meson.build b/meson.build index f5eb23a6..bc1751ea 100644 --- a/meson.build +++ b/meson.build @@ -13,25 +13,17 @@ if fs.exists('VERSION') else version = run_command(files('build-aux/git-version-gen'), check : true).stdout().strip() endif -meson.add_dist_script(sh, '-c', 'echo "@0@" > $MESON_DIST_ROOT/VERSION'.format(version)) -meson.add_dist_script(sh, '-c', 'cd $MESON_DIST_ROOT && ./autogen.sh') +meson.add_dist_script(sh, '-c', 'echo "@0@" > "$MESON_DIST_ROOT/VERSION"'.format(version)) +meson.add_dist_script(sh, '-c', 'cd "$MESON_DIST_ROOT" && ./autogen.sh') conf_data = configuration_data() conf_data.set_quoted('VERSION', version) # Detect for iconv compiler_has_iconv = compiler.has_function('iconv_open') -iconv_pkgconfig = get_option('iconv_pkgconfig') -if iconv_pkgconfig.auto() - if not compiler_has_iconv - deps += dependency('iconv') - endif -elif iconv_pkgconfig.enabled() - deps += dependency('iconv') -elif iconv_pkgconfig.disabled() - if not compiler_has_iconv - error('No usable iconv() implementation found') - endif +iconv = compiler.find_library('iconv', required : not compiler_has_iconv) +if iconv.found() + deps += iconv endif # Detect for locale_charset @@ -58,14 +50,6 @@ ld_has_version_script = compiler.has_link_argument( '-Wl,-version-script,@0@'.format(meson.source_root() / 'build-aux' / 'test.map') ) -# Detect no-undefined flag -ld_no_undefined = '' -if compiler.has_link_argument('-Wl,-no-undefined') - ld_no_undefined = '-Wl,-no-undefined' -elif compiler.has_link_argument('-Wl,-undefined,error') - ld_no_undefined = '-Wl,-undefined,error' -endif - # Generate config.h configure_file(output : 'config.h', configuration: conf_data) configuration_inc = include_directories('.') diff --git a/meson_options.txt b/meson_options.txt index 35df1c82..0dec9af5 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,3 +1,2 @@ -option('iconv_pkgconfig', type : 'feature', value : 'auto', description : 'Search for iconv with pkg-config or equivalent') option('docs', type : 'feature', value : 'auto', description : 'Build docs') option('docsdir', type : 'string', value : 'share/doc/datrie', description : 'Where to install the doxygen-generated HTML doc')