Skip to content

Commit

Permalink
Detect iconv by compiler.find_library
Browse files Browse the repository at this point in the history
  • Loading branch information
whs committed Sep 13, 2021
1 parent fe461c4 commit 04d1743
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 26 deletions.
4 changes: 0 additions & 4 deletions datrie/meson.build
Original file line number Diff line number Diff line change
@@ -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')
Expand Down
26 changes: 5 additions & 21 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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('.')
Expand Down
1 change: 0 additions & 1 deletion meson_options.txt
Original file line number Diff line number Diff line change
@@ -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')

0 comments on commit 04d1743

Please sign in to comment.