public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely.gcc@gmail.com>
To: Iain Sandoe <iain@sandoe.co.uk>
Cc: "libstdc++" <libstdc++@gcc.gnu.org>,
	GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] libstdc++, configure: Fix GLIBCXX_ZONEINFO_DIR configuration macro.
Date: Sat, 24 Dec 2022 10:01:34 +0000	[thread overview]
Message-ID: <CAH6eHdRvDn3uT8+Sdw+wabefE223gUQ0AsSiD3sa6Q2WTmcRTA@mail.gmail.com> (raw)
In-Reply-To: <DF91A3D6-015F-4315-988D-960E341F950E@sandoe.co.uk>

[-- Attachment #1: Type: text/plain, Size: 4649 bytes --]

On Sat, 24 Dec 2022, 09:56 Iain Sandoe, <iain@sandoe.co.uk> wrote:

> Hi,
>
> > On 23 Dec 2022, at 23:17, Jonathan Wakely <jwakely.gcc@gmail.com> 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=
> >  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.
>
> Actually, I had not explored all  those possibilities.
>
> My thinking was that ’no’ 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’s greetings,
> Iain
>
>
> >
> >
> >
> >  /some/path  : set _GLIBCXX_ZONEINFO_DIR = "/some/path"
> >
> > Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
> >
> > 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)
>
>

  reply	other threads:[~2022-12-24 10:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-23 17:06 Iain Sandoe
2022-12-23 23:17 ` Jonathan Wakely
2022-12-24  9:56   ` Iain Sandoe
2022-12-24 10:01     ` Jonathan Wakely [this message]
2023-01-14 18:24 ` Jonathan Wakely
2023-01-14 18:26   ` Jonathan Wakely

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAH6eHdRvDn3uT8+Sdw+wabefE223gUQ0AsSiD3sa6Q2WTmcRTA@mail.gmail.com \
    --to=jwakely.gcc@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=iain@sandoe.co.uk \
    --cc=libstdc++@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).