From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp001-out.apm-internet.net (smtp001-out.apm-internet.net [85.119.248.222]) by sourceware.org (Postfix) with ESMTPS id 0E0FA3858425 for ; Sat, 24 Dec 2022 09:56:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0E0FA3858425 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=sandoe.co.uk Authentication-Results: sourceware.org; spf=none smtp.mailfrom=sandoe.co.uk Received: (qmail 3349 invoked from network); 24 Dec 2022 09:56:03 -0000 X-APM-Out-ID: 16718757630334 X-APM-Authkey: 257869/1(257869/1) 3 Received: from unknown (HELO smtpclient.apple) (81.138.1.83) by smtp001.apm-internet.net with SMTP; 24 Dec 2022 09:56:03 -0000 Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\)) Subject: Re: [PATCH] libstdc++, configure: Fix GLIBCXX_ZONEINFO_DIR configuration macro. From: Iain Sandoe In-Reply-To: Date: Sat, 24 Dec 2022 09:56:03 +0000 Cc: libstdc++ , GCC Patches Content-Transfer-Encoding: quoted-printable Message-Id: References: <20221223170619.38428-1-iain@sandoe.co.uk> To: Jonathan Wakely X-Mailer: Apple Mail (2.3696.120.41.1.1) X-Spam-Status: No, score=-14.1 required=5.0 tests=BAYES_00,GIT_PATCH_0,KAM_COUK,KAM_DMARC_STATUS,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_NONE,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 23 Dec 2022, at 23:17, Jonathan Wakely = wrote: >=20 > 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 >=20 > --- 8< --- >=20 > 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). >=20 > This patch proposes revising the behaviour of the configure flag thus: >=20 > --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 >=20 > 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. 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. cheers, and season=E2=80=99s greetings,=20 Iain >=20 >=20 >=20 > /some/path : set _GLIBCXX_ZONEINFO_DIR =3D "/some/path" >=20 > Signed-off-by: Iain Sandoe >=20 > libstdc++-v3/ChangeLog: >=20 > * 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(-) >=20 > 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 > ]) >=20 > # Macros from the top-level gcc directory. >=20 > 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 >=20 > +// 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 > --=20 > 2.37.1 (Apple Git-137.1)