Re: [PATCH/RCF] autoconf: Check if <libintl.h> exists and set NO_GETTEXT
From: Jakub Narebski <hidden>
Date: 2016-06-15 22:48:53
On Tue, Jun 1, 2010, Ævar Arnfjörð Bjarmason wrote:
On Tue, Jun 1, 2010 at 17:01, Jakub Narebski [off-list ref] wrote:quoted
[...] Could you also provide change to configure.ac, so that ./configure would detect if we have gettext installed or not? Thanks in advance.Here's a check that just checks if we have libintl.h similar to the existing checks for libgen.h and other headers. Do you think this be adequate?
I'm not sure. If NO_GETTEXT is used only to protect '#include <libintl.h>' it might be enough.
quoted hunk ↗ jump to hunk
config.mak.in | 1 + configure.ac | 6 ++++++ 2 files changed, 7 insertions(+), 0 deletions(-)diff --git a/config.mak.in b/config.mak.in index 0d4b64d..a15f3c1 100644 --- a/config.mak.in +++ b/config.mak.in@@ -32,6 +32,7 @@ NO_CURL=@NO_CURL@ NO_EXPAT=@NO_EXPAT@ NO_LIBGEN_H=@NO_LIBGEN_H@ HAVE_PATHS_H=@HAVE_PATHS_H@ +NO_GETTEXT=@NO_GETTEXT@ NEEDS_LIBICONV=@NEEDS_LIBICONV@ NEEDS_SOCKET=@NEEDS_SOCKET@ NEEDS_RESOLV=@NEEDS_RESOLV@
O.K.
quoted hunk ↗ jump to hunk
diff --git a/configure.ac b/configure.ac index 71038fc..7bebfd8 100644 --- a/configure.ac +++ b/configure.ac@@ -730,6 +730,12 @@ AC_CHECK_HEADER([paths.h], [HAVE_PATHS_H=]) AC_SUBST(HAVE_PATHS_H) # +# Define NO_GETTEXT if you don't have libintl.h +AC_CHECK_HEADER([libintl.h], +[NO_GETTEXT=], +[NO_GETTEXT=YesPlease]) +AC_SUBST(NO_GETTEXT) +# # Define NO_STRCASESTR if you don't have strcasestr. GIT_CHECK_FUNC(strcasestr, [NO_STRCASESTR=],
The getext documentation says that `gettext.m4' defines AM_GNU_GETTEXT macro that tests for the presence of GNU gettext function family. The complication is that `gettext.m4' might not exist, and then AM_GNU_GETTEXT would be not defined. So if we are to use AM_GNU_GETTEXT, we should I guess protect it with m4_ifdef(): m4_ifdef([AM_GNU_GETTEXT], [AM_GNU_GETTEXT([external])]) or something like that. And of course we need to work around the fact that AM_GNU_GETTEXT sets USE_NLS to either 'yes' or 'no' instead of setting setting NO_GETTEXT to either non-empty or empty value. Or we can do something similar to what we do for NEEDS_LIBICINV / NO_ICONV, namely make ./configure compile simple test program using gettext. Cc-ed Ben Walton and David M. Syzdek: perhaps they can help with this issue. -- Jakub Narebski Poland