Message ID | 20221217165213.152-17-luoyonggang@gmail.com |
---|---|
State | Dropped |
Headers |
Return-Path: <elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C741C3AA943D for <patchwork@sourceware.org>; Sat, 17 Dec 2022 16:54:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C741C3AA943D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1671296053; bh=QzqJjgq2Wg3PQFpPrTB068GWw+gudae3/+fzkmb9O20=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Help:List-Subscribe:From: Reply-To:From; b=I8GrwYgi24Y8iC711eNx8R5Bq/rgVSDAvTInqYxLkgm3cbYOkVOPu17t30wCAHEbp 70bMKx0uQdHC5WKRA3dwT3T1KojM1fsqDoY0RcHT7cdFqb43RJt5kxhA3lEUynJq3F BYFNwcgroY4R3/x2Y7qN2AUcWjcGMUZB6EdO7x6s= X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by sourceware.org (Postfix) with ESMTPS id 60A583AA9803 for <elfutils-devel@sourceware.org>; Sat, 17 Dec 2022 16:53:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 60A583AA9803 Received: by mail-pl1-x630.google.com with SMTP id t2so5221395ply.2 for <elfutils-devel@sourceware.org>; Sat, 17 Dec 2022 08:53:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QzqJjgq2Wg3PQFpPrTB068GWw+gudae3/+fzkmb9O20=; b=gxPej3mnRReYRRsb+ptVdOv1EPUlzyQZ1008GdOMkAHcDYRGg/6SMVeSWuyBUEujd5 qRxBxUg/7phjrSztFkC3Pnq6HOTPJH3Bc4l+3kAsHgUGdIlZVAMObyweEaRepZaO0wk+ sy/FWyQd1YVYkteoaTF/DCVSHxH8iF0Obnx5yiX+D5iJZWtQ9wKb073Mb72suv5zkJCS YnHtT2jXh0GzKmiyU0AQCbCCPKyvYZuwgdTodub33t8BSsgPrjkWNZxKj8n83s8I0Qmn KTVbnHXwnvP2scvcbR6lBhse0FjrNFeHGuXEp8xc6kKa7EsVKY+NPuZOWySpV2tnJbqd WgQw== X-Gm-Message-State: ANoB5plBMHz1oood8X+MnCxCs4zh+bwY8GAe5/5m6+5hqqA0SVjHG0yg udYyaWCyJxbUEAGaxPfL4NCzUlHQlKw= X-Google-Smtp-Source: AA0mqf5Y9xNleqli3icXlogopAMv7dJN6m60Hu0aPqp4YDRZbu0KSoCKPfQ/81v5E7dhm7aYUxYIoQ== X-Received: by 2002:a17:90a:3188:b0:219:3e5f:2a65 with SMTP id j8-20020a17090a318800b002193e5f2a65mr37873026pjb.36.1671295983092; Sat, 17 Dec 2022 08:53:03 -0800 (PST) Received: from localhost.localdomain ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id s92-20020a17090a2f6500b002191873187dsm6643229pjd.33.2022.12.17.08.53.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Dec 2022 08:53:02 -0800 (PST) To: elfutils-devel@sourceware.org Cc: Yonggang Luo <luoyonggang@gmail.com> Subject: [PATCH v2 16/16] lib: Use HAVE_LIBINTL_H to guard #include <libintl.h> Date: Sun, 18 Dec 2022 00:52:13 +0800 Message-Id: <20221217165213.152-17-luoyonggang@gmail.com> X-Mailer: git-send-email 2.36.1.windows.1 In-Reply-To: <20221217165213.152-1-luoyonggang@gmail.com> References: <20221217165213.152-1-luoyonggang@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, 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 X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list <elfutils-devel.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/elfutils-devel>, <mailto:elfutils-devel-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/elfutils-devel/> List-Help: <mailto:elfutils-devel-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/elfutils-devel>, <mailto:elfutils-devel-request@sourceware.org?subject=subscribe> From: Yonggang Luo via Elfutils-devel <elfutils-devel@sourceware.org> Reply-To: Yonggang Luo <luoyonggang@gmail.com> Errors-To: elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org Sender: "Elfutils-devel" <elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org> |
Series |
Patches for building with mingw/gcc msvc/clang-cl
|
|
Commit Message
Yonggang Luo
Dec. 17, 2022, 4:52 p.m. UTC
MSVC doesn't have libintl.h, so use macro to guard it.
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
---
configure.ac | 2 ++
lib/eu-config.h | 7 +++++++
2 files changed, 9 insertions(+)
Comments
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 <luoyonggang@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
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]) 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 /* Compiler-specific definitions. */ #define strong_alias(name, aliasname) \