Skip to content

Commit

Permalink
iconv dependency: try even harder to find working iconv
Browse files Browse the repository at this point in the history
has_function(prefix: '...') is useless to check the difference between
builtins and external library functions. It has code to detect
"builtins" that misfires and reports that iconv_open is defined as a
builtin on mingw, but only if you include the header.

Instead compile an open-coded test file that this iconv dependency
implementation fully controls, that doesn't get up to imaginative edge
cases like trying to find `__builtin_iconv_open`.

Fixes commit db1fa70, which merely
moved the brokenness over one step to the right (by breaking mingw
instead of freebsd)

Fixes mesonbuild#9632 (comment)
  • Loading branch information
eli-schwartz authored and jpakkane committed Nov 28, 2021
1 parent b361fc5 commit 1e19757
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion mesonbuild/dependencies/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,8 +451,9 @@ def __init__(self, name: str, env: 'Environment', kwargs: T.Dict[str, T.Any]):
class IconvBuiltinDependency(BuiltinDependency):
def __init__(self, name: str, env: 'Environment', kwargs: T.Dict[str, T.Any]):
super().__init__(name, env, kwargs)
code = '''#include <iconv.h>\n\nint main() {\n iconv_open("","");\n}''' # [ignore encoding] this is C, not python, Mr. Lint

if self.clib_compiler.has_function('iconv_open', '#include <iconv.h>', env)[0]:
if self.clib_compiler.links(code, env)[0]:
self.is_found = True


Expand Down

0 comments on commit 1e19757

Please sign in to comment.