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.

43 lines
1.6 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. diff --git a/src/lib/icu/meson.build b/src/lib/icu/meson.build
  15. index bd6e30944..e63d614a0 100644
  16. --- a/src/lib/icu/meson.build
  17. +++ b/src/lib/icu/meson.build
  18. @@ -18,8 +18,18 @@ if icu_dep.found()
  19. 'Init.cxx',
  20. ]
  21. elif not get_option('iconv').disabled()
  22. - have_iconv = compiler.has_function('iconv', prefix : '#include <iconv.h>')
  23. - conf.set('HAVE_ICONV', have_iconv)
  24. + have_iconv = c_compiler.has_header_symbol('iconv.h', 'iconv')
  25. + if have_iconv
  26. + libiconv = c_compiler.find_library('iconv', required : false)
  27. + conf.set('HAVE_ICONV', have_iconv)
  28. + libiconv_dep = static_library('iconv', icu_sources, include_directories: inc, dependencies: libiconv)
  29. + icu_dep = declare_dependency(link_with: libiconv_dep, dependencies: util_dep)
  30. + endif
  31. + if not have_iconv and c_compiler.has_function('iconv')
  32. + libiconv = []
  33. + have_iconv = true
  34. + conf.set('HAVE_ICONV', have_iconv)
  35. + endif
  36. if not have_iconv and get_option('iconv').enabled()
  37. error('iconv() not available')
  38. endif