You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.5 KiB

  1. From 8ece1141e455d6643df0be885a5df200bdb3bc78 Mon Sep 17 00:00:00 2001
  2. From: Rosen Penev <rosenp@gmail.com>
  3. Date: Thu, 30 Jul 2020 14:34:07 -0700
  4. Subject: [PATCH] icu/meson: link against iconv when used externally
  5. This basically adds -liconv to LDFLAGS, fixing a linking issue when
  6. iconv is missing in the libc.
  7. The previous commit fixed finding iconv but did not fix linking.
  8. Switched to using c_compiler for iconv. It seems compiler does not work
  9. properly.
  10. Signed-off-by: Rosen Penev <rosenp@gmail.com>
  11. ---
  12. src/lib/icu/meson.build | 14 ++++++++++++--
  13. 1 file changed, 12 insertions(+), 2 deletions(-)
  14. --- a/src/lib/icu/meson.build
  15. +++ b/src/lib/icu/meson.build
  16. @@ -18,8 +18,18 @@ if icu_dep.found()
  17. 'Init.cxx',
  18. ]
  19. elif not get_option('iconv').disabled()
  20. - have_iconv = compiler.has_function('iconv', prefix : '#include <iconv.h>')
  21. - conf.set('HAVE_ICONV', have_iconv)
  22. + have_iconv = c_compiler.has_header_symbol('iconv.h', 'iconv')
  23. + if have_iconv
  24. + libiconv = c_compiler.find_library('iconv', required : false)
  25. + conf.set('HAVE_ICONV', have_iconv)
  26. + libiconv_dep = static_library('iconv', icu_sources, include_directories: inc, dependencies: libiconv)
  27. + icu_dep = declare_dependency(link_with: libiconv_dep, dependencies: util_dep)
  28. + endif
  29. + if not have_iconv and c_compiler.has_function('iconv')
  30. + libiconv = []
  31. + have_iconv = true
  32. + conf.set('HAVE_ICONV', have_iconv)
  33. + endif
  34. if not have_iconv and get_option('iconv').enabled()
  35. error('iconv() not available')
  36. endif