From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [IPv6:2a00:1450:4864:20::52e]) by sourceware.org (Postfix) with ESMTPS id CCDFB3858D1E; Fri, 23 Dec 2022 23:18:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CCDFB3858D1E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-x52e.google.com with SMTP id b88so1533107edf.6; Fri, 23 Dec 2022 15:18:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=sBM7HjZXjuLhgeMAYqOEvy3m1Iy/VZUKSfZBmPHDROA=; b=qdyr3cmG1Qo2R3lys48uS87YgYII7WFxC2cyu9ixRJB4nxuV91eM2WjP2A71LWUQeo n+oj+x151nsV4dmZSiyobD9aOGYESJOU9M+2dM74woNQgJwsYJQZlCZTmjC35z4ewGbu MLu+Zc4ucZmENU20hZZOuL7wxPVubJ/Bh7ulqYcBvJgng8q+Z52yhXmUWPwpbI24Cm2G 8O1MSafbxBlbJqpxQvApViMsCWAwht3fHexEMCKsJo0+g3WqGLsOjt5ttW4+IZs9KKNB Ju/KwVotXCKay3aa2cqA8PB9UU8lAaI18X7KzISWNGPfFM19Z7T1VL1kyHMfiSpe2b3/ uhzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=sBM7HjZXjuLhgeMAYqOEvy3m1Iy/VZUKSfZBmPHDROA=; b=tQvep5dmUoBoPsyrNZcn3hIauTBBqx/0/GeAE154R5syRcSm2YfKF2Y9+KUyS5iyPh GeeOKRWNjmDqhpJ1qdI1mH+PZvfrI5GKGvPELgkp8RFKkl+5HvTdER1Kj7ZCk8QuIhGz 8Hs0gqIImIzCncSq5F5wFmuNOwYagivPCY4uQSbgoi/IUCYCqJ434jqMWZZJ4+G/0ww6 BCKAferFEIU2dIX2ZhPeySRemxg3yas5cAF6s9OL63sEeX/vJrm8IDU0EfEyixENO8Is Q9AMnow/c9vFBqeMmhZqnQi1FlBIo6idJvZcIdOnKafydilnjWR0q74kZ+ZDkhWB3Z8f CCBA== X-Gm-Message-State: AFqh2kqv8LwSSGtmn8SzwQWQFF7aTNLpFPCQFE3ybV8YJymwwogJGMNj mkgSlG5zJ9lZ4LvIJndqz1WFuQ2jMdOJpvrG4Bs= X-Google-Smtp-Source: AMrXdXsIWhd8TLx2cLSaG/W/iZvL5W1P4Ze6s1mOwm7wrE9QMjLGVgV7J4zER/5saiB8eBYeU+EiXVIx8joFLPY4/lM= X-Received: by 2002:a05:6402:1d95:b0:478:df:44c3 with SMTP id dk21-20020a0564021d9500b0047800df44c3mr1037671edb.301.1671837481384; Fri, 23 Dec 2022 15:18:01 -0800 (PST) MIME-Version: 1.0 References: <20221223170619.38428-1-iain@sandoe.co.uk> In-Reply-To: <20221223170619.38428-1-iain@sandoe.co.uk> From: Jonathan Wakely Date: Fri, 23 Dec 2022 23:17:50 +0000 Message-ID: Subject: Re: [PATCH] libstdc++, configure: Fix GLIBCXX_ZONEINFO_DIR configuration macro. To: Iain Sandoe Cc: "libstdc++" , gcc-patches , Iain Sandoe Content-Type: multipart/alternative; boundary="0000000000003340c305f086ff76" X-Spam-Status: No, score=-6.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,HTML_MESSAGE,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 List-Id: --0000000000003340c305f086ff76 Content-Type: text/plain; charset="UTF-8" On Fri, 23 Dec 2022, 17:06 Iain Sandoe via Libstdc++, wrote: > This is a patch for comment on the approach - tested on x86_64-darwi21 > thoughts? > Iain > > --- 8< --- > > Testing on Darwin revealed that the GLIBCXX_ZONEINFO_DIR was not doing > quite > the right thing (we ended up with ${withval} in the config.h file). > > This patch proposes revising the behaviour of the configure flag thus: > > --with-libstdcxx-zoneinfo-dir= > unspecified : Set _GLIBCXX_ZONEINFO_DIR to a default suitable for $host > yes : Set _GLIBCXX_ZONEINFO_DIR to a default suitable for $host > no : Do not set _GLIBCXX_ZONEINFO_DIR > What's the use case for "no"? Enforcing a UTC-only tzdb that doesn't even try to load the tzdata? If that's desirable, we could #ifdef huge parts of src/c++20/tzdb.cc to make the library smaller. That might make sense for a toolchain for embedded targets where it's known there's no need for time zone conversions. /some/path : set _GLIBCXX_ZONEINFO_DIR = "/some/path" > > Signed-off-by: Iain Sandoe > > libstdc++-v3/ChangeLog: > > * acinclude.m4 (GLIBCXX_ZONEINFO_DIR): Revise configure flag > handling. > * configure: Regenerate. > * src/c++20/tzdb.cc: Add a comment that an unset > _GLIBCXX_ZONEINFO_DIR > implies that the configuration specified that no directory should > be > used. > --- > libstdc++-v3/acinclude.m4 | 21 ++++++++++++++------- > libstdc++-v3/configure | 28 +++++++++++++++++++--------- > libstdc++-v3/src/c++20/tzdb.cc | 1 + > 3 files changed, 34 insertions(+), 16 deletions(-) > > diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4 > index f73946a4918..3653822aed4 100644 > --- a/libstdc++-v3/acinclude.m4 > +++ b/libstdc++-v3/acinclude.m4 > @@ -5153,18 +5153,25 @@ AC_DEFUN([GLIBCXX_ZONEINFO_DIR], [ > AC_ARG_WITH([libstdcxx-zoneinfo-dir], > AC_HELP_STRING([--with-libstdcxx-zoneinfo-dir], > [the directory to search for tzdata files]), > - [zoneinfo_dir="${withval}" > - AC_DEFINE(_GLIBCXX_ZONEINFO_DIR, "${withval}", > - [Define if a non-default location should be used for tzdata > files.]) > - ], > - [ > + [],[with_libstdcxx_zoneinfo_dir=yes]) > + > + # Pick a default when no specific path is set. > + if test x${with_libstdcxx_zoneinfo_dir} = xyes; then > case "$host" in > # *-*-aix*) zoneinfo_dir="/usr/share/lib/zoneinfo" ;; > + *-*-darwin2*) zoneinfo_dir="/usr/share/lib/zoneinfo.default" ;; > *) zoneinfo_dir="/usr/share/zoneinfo" ;; > esac > - ]) > - > + elif test x${with_libstdcxx_zoneinfo_dir} = xno; then > + zoneinfo_dir=none > + else > + zoneinfo_dir=${with_libstdcxx_zoneinfo_dir} > + fi > AC_MSG_NOTICE([zoneinfo data directory: ${zoneinfo_dir}]) > + if test x${zoneinfo_dir} != xnone; then > + AC_DEFINE_UNQUOTED(_GLIBCXX_ZONEINFO_DIR, "${zoneinfo_dir}", > + [Define if a non-default location should be used for tzdata > files.]) > + fi > ]) > > # Macros from the top-level gcc directory. > > diff --git a/libstdc++-v3/src/c++20/tzdb.cc > b/libstdc++-v3/src/c++20/tzdb.cc > index 5f5c4199f65..c4311d0902a 100644 > --- a/libstdc++-v3/src/c++20/tzdb.cc > +++ b/libstdc++-v3/src/c++20/tzdb.cc > @@ -52,6 +52,7 @@ > # endif > #endif > > +// This is a bit odd; the configure-time setting was 'no zoneinfo > directory' > #ifndef _GLIBCXX_ZONEINFO_DIR > # define _GLIBCXX_ZONEINFO_DIR "/usr/share/zoneinfo" > #endif > -- > 2.37.1 (Apple Git-137.1) > > --0000000000003340c305f086ff76--