public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] libstdc++, configure: Fix GLIBCXX_ZONEINFO_DIR configuration macro.
@ 2022-12-23 17:06 Iain Sandoe
  2022-12-23 23:17 ` Jonathan Wakely
  2023-01-14 18:24 ` Jonathan Wakely
  0 siblings, 2 replies; 6+ messages in thread
From: Iain Sandoe @ 2022-12-23 17:06 UTC (permalink / raw)
  To: libstdc++, gcc-patches

 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
 /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)


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-01-14 18:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-23 17:06 [PATCH] libstdc++, configure: Fix GLIBCXX_ZONEINFO_DIR configuration macro Iain Sandoe
2022-12-23 23:17 ` Jonathan Wakely
2022-12-24  9:56   ` Iain Sandoe
2022-12-24 10:01     ` Jonathan Wakely
2023-01-14 18:24 ` Jonathan Wakely
2023-01-14 18:26   ` Jonathan Wakely

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).