diff --git a/meson.build b/meson.build index b3d3305814c7ec0785ae8793665707984fe83c2e..f69633b5047929f64431eba6380d66c233b9fd9f 100644 --- a/meson.build +++ b/meson.build @@ -32,8 +32,10 @@ dir_locale = dir_prefix / get_option('localedir') host_os = host_machine.system() +bsd = ['freebsd', 'openbsd', 'dragonfly'] cygwin = 'cygwin' windows = 'windows' +sys_bsd = bsd.contains(host_os) sys_cygwin = cygwin.contains(host_os) sys_windows = windows.contains(host_os) @@ -559,9 +561,24 @@ else endif xml_deps += lzma_dep +# icu +icu_dep = dependency('icu-i18n', method: 'pkg-config', required: get_option('icu')) +if icu_dep.found() + defs = icu_dep.get_variable(pkgconfig: 'DEFS') + if cc.has_argument(defs) + libxml2_cflags += defs + endif +endif +xml_deps += icu_dep + ### iconv if not get_option('minimum') - iconv_dep = dependency('iconv', required: get_option('iconv')) +# this is a hack for the BSDs. The iconv dependency works as long as libiconv is not in the include path. + if sys_bsd and icu_dep.found() + iconv_dep = cc.find_library('iconv', dirs: icu_dep.get_variable(pkgconfig: 'includedir'), required: get_option('iconv')) + else + iconv_dep = dependency('iconv', required: get_option('iconv')) + endif else iconv_dep = dependency('', required: false) endif @@ -573,14 +590,6 @@ else want_iso8859x = true endif -# icu -icu_dep = dependency('icu-i18n', method: 'pkg-config', required: get_option('icu')) -if icu_dep.found() - def_var = icu_dep.get_variable(pkgconfig: 'DEFS') - config_dir += include_directories(def_var) - xml_deps += icu_dep -endif - subdir('include/libxml') # Set config_h after all subdirs and dependencies have set values