[Libguestfs] [PATCH 4/4] Mac OS X: Detect bindtextdomain.
Jim Meyering
jim at meyering.net
Mon Mar 22 08:36:27 UTC 2010
Richard W.M. Jones wrote:
> Updated patch.
...
> Subject: [PATCH] Mac OS X: Detect bindtextdomain.
>
> These are missing on Mac OS X. I think you would need to install
> a gettext package to get these.
> ---
> configure.ac | 2 +-
> fish/fish.c | 2 ++
> test-tool/test-tool.c | 2 ++
> 3 files changed, 5 insertions(+), 1 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index 086b00c..4a492b2 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -135,7 +135,7 @@ dnl Headers.
> AC_CHECK_HEADERS([errno.h sys/types.h sys/un.h sys/wait.h sys/socket.h endian.h byteswap.h])
>
> dnl Functions.
> -AC_CHECK_FUNCS([posix_fallocate])
> +AC_CHECK_FUNCS([bindtextdomain posix_fallocate])
>
> dnl Build the daemon?
> AC_MSG_CHECKING([if we should build the daemon])
> diff --git a/fish/fish.c b/fish/fish.c
> index 2022ee3..5fbf290 100644
> --- a/fish/fish.c
> +++ b/fish/fish.c
> @@ -141,8 +141,10 @@ main (int argc, char *argv[])
> atexit (close_stdout);
>
> setlocale (LC_ALL, "");
> +#ifdef HAVE_BINDTEXTDOMAIN
> bindtextdomain (PACKAGE, LOCALEBASEDIR);
> textdomain (PACKAGE);
> +#endif
>
> enum { HELP_OPTION = CHAR_MAX + 1 };
>
> diff --git a/test-tool/test-tool.c b/test-tool/test-tool.c
> index 5423374..57de78f 100644
> --- a/test-tool/test-tool.c
> +++ b/test-tool/test-tool.c
> @@ -87,8 +87,10 @@ int
> main (int argc, char *argv[])
> {
> setlocale (LC_ALL, "");
> +#ifdef HAVE_BINDTEXTDOMAIN
> bindtextdomain (PACKAGE, LOCALEBASEDIR);
> textdomain (PACKAGE);
> +#endif
Putting the following somewhere after your #include "gettext.h"
makes each "main" slightly more aesthetic: fewer in-function ifdefs.
#if ! ENABLE_NLS
# undef textdomain
# define textdomain(Domainname) /* empty */
# undef bindtextdomain
# define bindtextdomain(Domainname, Dirname) /* empty */
#endif
More information about the Libguestfs
mailing list