diff options
author | Eli Schwartz <eschwartz@archlinux.org> | 2021-06-13 13:45:15 -0400 |
---|---|---|
committer | Eli Schwartz <eschwartz@archlinux.org> | 2021-06-17 13:22:25 -0400 |
commit | 2c6ccfe4c40741ae1f15f073f7d7bc8c398a1648 (patch) | |
tree | 9bdcb39277363de6d67c91ade68416618a4d556d /docs/markdown/snippets | |
parent | ad206037e321237bc664227764a5b3fe6243c554 (diff) | |
download | meson-2c6ccfe4c40741ae1f15f073f7d7bc8c398a1648.zip meson-2c6ccfe4c40741ae1f15f073f7d7bc8c398a1648.tar.gz meson-2c6ccfe4c40741ae1f15f073f7d7bc8c398a1648.tar.bz2 |
intl custom dependency
Checking how to aquire the *gettext family of symbols portably is
annoyingly complex, and may come from the libc, or standalone.
builtin dependency:
This detects if libintl is unneeded, because the *gettext family of
symbols is available in the libc.
system dependency:
This detects if libintl is installed as separate software, linkable via
-lintl; unfortunately, GNU gettext does not ship pkg-config files for
it.
Fixes #3929
Diffstat (limited to 'docs/markdown/snippets')
-rw-r--r-- | docs/markdown/snippets/intl-dependency.md | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/docs/markdown/snippets/intl-dependency.md b/docs/markdown/snippets/intl-dependency.md new file mode 100644 index 0000000..8e0cd40 --- /dev/null +++ b/docs/markdown/snippets/intl-dependency.md @@ -0,0 +1,35 @@ +## New custom dependency for libintl + +Meson can now find the library needed for translating messages via gettext. +This works both on systems where libc provides gettext, such as GNU or musl, +and on systems where the gettext project's standalone intl support library is +required, such as macOS. + +Rather than doing something such as: + +``` +intl_dep = dependency('', required: false) + +if cc.has_function('ngettext') + intl_found = true +else + intl_dep = cc.find_library('intl', required: false) + intl_found = intl_dep.found() +endif + +if intl_found + # build options that need gettext + conf.set('ENABLE_NLS', 1) +endif +``` + +one may simply use: + +``` +intl_dep = dependency('intl') + +if intl_dep.found() + # build options that need gettext + conf.set('ENABLE_NLS', 1) +endif +``` |