From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gnu.wildebeest.org (gnu.wildebeest.org [45.83.234.184]) by sourceware.org (Postfix) with ESMTPS id 7FD833858425 for ; Wed, 21 Dec 2022 23:07:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7FD833858425 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=klomp.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=klomp.org Received: from reform (deer0x15.wildebeest.org [172.31.17.151]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id 3B72C300071A; Thu, 22 Dec 2022 00:07:04 +0100 (CET) Received: by reform (Postfix, from userid 1000) id 04BC12E803A3; Thu, 22 Dec 2022 00:07:03 +0100 (CET) Date: Thu, 22 Dec 2022 00:07:03 +0100 From: Mark Wielaard To: Yonggang Luo Cc: elfutils-devel@sourceware.org Subject: Re: [PATCH v2 16/16] lib: Use HAVE_LIBINTL_H to guard #include Message-ID: References: <20221217165213.152-1-luoyonggang@gmail.com> <20221217165213.152-17-luoyonggang@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221217165213.152-17-luoyonggang@gmail.com> X-Spam-Status: No, score=-3038.4 required=5.0 tests=BAYES_00,GIT_PATCH_0,JMQ_SPF_NEUTRAL,KAM_DMARC_STATUS,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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 > --- > 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 > +#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