From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x636.google.com (mail-ej1-x636.google.com [IPv6:2a00:1450:4864:20::636]) by sourceware.org (Postfix) with ESMTPS id 7D7BB3858D1E; Sat, 24 Dec 2022 10:01:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7D7BB3858D1E 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-ej1-x636.google.com with SMTP id qk9so16997223ejc.3; Sat, 24 Dec 2022 02:01:47 -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=NsM+awf4fCi4M2rXhjlyGLRHsPNBu73hVH2+s+qZKp8=; b=q7iKvOKI3GaML+cmDPCUoY92LinCwE7jBhm1vhSItwFZUDdiwnjXGrUWCh7dlwcdur 9cLJOLD7ylC43cR9ccjvGFluwhCDOLekNR/2RlA+JawMdByTLKRYQZtoX+xOgFuSIsdg V/JPfy7Y/LKP11ihlw+syYIpJKovsbqwUcRmWwPRfNh8JtPl68f9VdvYRgwnmaUp/fkW ytA0Y5ykrNX1VTbm2DCK16/IjW1VBLxPjR2JcGK/WqTQfpY6xoG55n1frn5j+BtUYL2q NcC66j+mvjZKSenW6+ToJsTFuXqN4HvqdzLzd3FlVZBVFvV1QoIrPGN6PpWCDt4wyRUz YBWw== 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=NsM+awf4fCi4M2rXhjlyGLRHsPNBu73hVH2+s+qZKp8=; b=cy6klrXH4x5SWnfnADaJwE574eg5c4kaq35y8Ql1eLWItZ2lezXYLjPBjB9Lgfe/0c VlEZ6t/T5qrMJfmSXV0l8sH9sRZoIIxmaA1Sym0I45iSPyHCs5x1UEjHcI1a74jzRSnH 4V8HyzPPfy8r36rhrvFgW1UmTdymNDUmqoy/DOU+Ftn9NsoiqD+YLD32d8fGHNrJ+q+L xv50nddnokhFwUOHhOLjJVGmYEe1bHpp+mSQc7ymI3x1FVTwe7oP2bCdpIUtWP637j9K xyUdj/3s6wMiRewbFbXCnzvYttVwS+mdQmuixeUunceo1kAXSUWk1wZwFjtPrkGzxgIo zD5g== X-Gm-Message-State: AFqh2kp/bIJBC7vxqqkDMfZ5hN5mX9SBftrdsasu34A94orpidBfRz+k WRDmjnyk2GI3wVMin19uAr4fna1TD438WUQASTI= X-Google-Smtp-Source: AMrXdXvmq0Rnqfb+vTEYy9E+Quej6QokMLPvfIdj1+7CV0Tkm3ToxOSEL1GOyPZbsHYJZh9e/+BM/b1uJgoBkrsFxAI= X-Received: by 2002:a17:906:f82:b0:7c0:e306:8930 with SMTP id q2-20020a1709060f8200b007c0e3068930mr1183739ejj.386.1671876106122; Sat, 24 Dec 2022 02:01:46 -0800 (PST) MIME-Version: 1.0 References: <20221223170619.38428-1-iain@sandoe.co.uk> In-Reply-To: From: Jonathan Wakely Date: Sat, 24 Dec 2022 10:01:34 +0000 Message-ID: Subject: Re: [PATCH] libstdc++, configure: Fix GLIBCXX_ZONEINFO_DIR configuration macro. To: Iain Sandoe Cc: "libstdc++" , GCC Patches Content-Type: multipart/alternative; boundary="00000000000069f95a05f08ffd2e" 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: --00000000000069f95a05f08ffd2e Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sat, 24 Dec 2022, 09:56 Iain Sandoe, wrote: > Hi, > > > On 23 Dec 2022, at 23:17, Jonathan Wakely wrote: > > > > On Fri, 23 Dec 2022, 17:06 Iain Sandoe via Libstdc++, < > libstdc++@gcc.gnu.org> 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=3D > > 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 ne= ed > for time zone conversions. > > Actually, I had not explored all those possibilities. > > My thinking was that =E2=80=99no=E2=80=99 is a valid answer and either we= need to produce > a configure diagnostic saying that it is not a valid choice - or we should > apply it in some useful way. Silent acceptance but doing something > different from what the user was expecting seems a bad idea. > > Your use cases seem quite reasonable - and, yes, I guess that means the > code could be stubbed or given a trivial impl. for that case. > I'll look into doing that in the new year. > cheers, and season=E2=80=99s greetings, > Iain > > > > > > > > > > /some/path : set _GLIBCXX_ZONEINFO_DIR =3D "/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=3D"${withval}" > > - AC_DEFINE(_GLIBCXX_ZONEINFO_DIR, "${withval}", > > - [Define if a non-default location should be used for tzdata > files.]) > > - ], > > - [ > > + [],[with_libstdcxx_zoneinfo_dir=3Dyes]) > > + > > + # Pick a default when no specific path is set. > > + if test x${with_libstdcxx_zoneinfo_dir} =3D xyes; then > > case "$host" in > > # *-*-aix*) zoneinfo_dir=3D"/usr/share/lib/zoneinfo" ;; > > + *-*-darwin2*) zoneinfo_dir=3D"/usr/share/lib/zoneinfo.default" ;; > > *) zoneinfo_dir=3D"/usr/share/zoneinfo" ;; > > esac > > - ]) > > - > > + elif test x${with_libstdcxx_zoneinfo_dir} =3D xno; then > > + zoneinfo_dir=3Dnone > > + else > > + zoneinfo_dir=3D${with_libstdcxx_zoneinfo_dir} > > + fi > > AC_MSG_NOTICE([zoneinfo data directory: ${zoneinfo_dir}]) > > + if test x${zoneinfo_dir} !=3D 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) > > --00000000000069f95a05f08ffd2e--