Hi, On Sun, Dec 18, 2022 at 12:52:13AM +0800, Yonggang Luo via Elfutils-devel wrote: > MSVC doesn't have libintl.h, so use macro to guard it. > > Signed-off-by: Yonggang Luo <luoyongg...@gmail.com> > --- > configure.ac | 2 ++ > lib/eu-config.h | 7 +++++++ > 2 files changed, 9 insertions(+) > > diff --git a/configure.ac b/configure.ac > index b84623fe..aea12be3 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -441,6 +441,8 @@ AC_CHECK_FUNCS([process_vm_readv mremap]) > AS_IF([test "x$ac_cv_func_mremap" = "xno"], > [AC_MSG_WARN([elf_update needs mremap to support ELF_C_RDWR_MMAP])]) > > +AC_CHECK_HEADERS([libintl.h]) > + > AC_CHECK_HEADERS([error.h]) > AC_CHECK_HEADERS([err.h])
We already use AM_GNU_GETTEXT. I think that would detect whether there is gettext/libintl.h support already. Which defines ENABLE_NLS. > diff --git a/lib/eu-config.h b/lib/eu-config.h > index 78a5c4fe..72b7793e 100644 > --- a/lib/eu-config.h > +++ b/lib/eu-config.h > @@ -52,10 +52,17 @@ > # define rwlock_unlock(lock) ((void) (lock)) > #endif /* USE_LOCKS */ > > +#if defined(HAVE_LIBINTL_H) > #include <libintl.h> > +#endif > + > /* gettext helper macros. */ > #define N_(Str) Str > +#if defined(HAVE_LIBINTL_H) > #define _(Str) dgettext ("elfutils", Str) > +#else > +#define _(Str) N_(Str) > +#endif So I think the guard here is should be #if ENABLE_NLS Also just define _(Str) Str directly instead of going through N_(Str). Cheers, Mark