]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Fix configuration of default zoneinfo dir on linux
authorJonathan Wakely <jwakely@redhat.com>
Tue, 17 Jan 2023 11:47:11 +0000 (11:47 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Tue, 17 Jan 2023 14:15:13 +0000 (14:15 +0000)
The config for --with-libstdcxx-zoneinfo=yes was comparing the target
triplet to "gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu" which is only
the last component of the triplet, so failed to match and always used
the zoneinfo_dir=none default. Check $target_os instead.

There was also an error in the check for native builds that tzdata.zi is
actually present in the configured directory. That meant a warning was
printed even when the file was present:

configure: zoneinfo data directory: /usr/share/zoneinfo
configure: WARNING: "/usr/share/zoneinfo does not contain tzdata.zi file"
configure: static tzdata.zi file will be compiled into the library

libstdc++-v3/ChangeLog:

* acinclude.m4 (GLIBCXX_ZONEINFO_DIR): Check $target_os instead
of $host. Fix check for file being present during native build.
* configure: Regenerate.

libstdc++-v3/acinclude.m4
libstdc++-v3/configure

index b1608ae923712669cd64fc6416ab27c8a30a01ba..982e979a840b6c42521fe0a851357aee2ad4e447 100644 (file)
@@ -5180,17 +5180,17 @@ AC_DEFUN([GLIBCXX_ZONEINFO_DIR], [
 
   if test "x${with_libstdcxx_zoneinfo}" = xyes; then
     # Pick a default when no specific path is set.
-    case "$host" in
+    case "$target_os" in
       gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu)
        # Not all distros ship tzdata.zi in this dir.
        zoneinfo_dir="/usr/share/zoneinfo"
        ;;
-      *-*-aix*)
+      aix*)
        # Binary tzfile files are in /usr/share/lib/zoneinfo
        # but tzdata.zi is not present there.
        zoneinfo_dir=none
        ;;
-      *-*-darwin2*)
+      darwin2*)
        # Binary tzfile files are in /usr/share/lib/zoneinfo.default
        # but tzdata.zi is not present there.
        zoneinfo_dir=none
@@ -5230,7 +5230,7 @@ AC_DEFUN([GLIBCXX_ZONEINFO_DIR], [
   if test "x${zoneinfo_dir}" != xnone; then
     AC_DEFINE_UNQUOTED(_GLIBCXX_ZONEINFO_DIR, "${zoneinfo_dir}",
       [Define if a directory should be searched for tzdata files.])
-    if $GLIBCXX_IS_NATIVE -a ! test -f "$zoneinfo_dir/tzdata.zi"; then
+    if $GLIBCXX_IS_NATIVE && ! test -f "$zoneinfo_dir/tzdata.zi"; then
       AC_MSG_WARN("$zoneinfo_dir does not contain tzdata.zi file")
     fi
   fi
index 9c0f3a3e7c94e28baeece167e79af0091b7b19d4..a298cbd45a0a2c03b5d1837e55644858001e48fd 100755 (executable)
 
   if test "x${with_libstdcxx_zoneinfo}" = xyes; then
     # Pick a default when no specific path is set.
-    case "$host" in
+    case "$target_os" in
       gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu)
        # Not all distros ship tzdata.zi in this dir.
        zoneinfo_dir="/usr/share/zoneinfo"
        ;;
-      *-*-aix*)
+      aix*)
        # Binary tzfile files are in /usr/share/lib/zoneinfo
        # but tzdata.zi is not present there.
        zoneinfo_dir=none
        ;;
-      *-*-darwin2*)
+      darwin2*)
        # Binary tzfile files are in /usr/share/lib/zoneinfo.default
        # but tzdata.zi is not present there.
        zoneinfo_dir=none
@@ -71590,7 +71590,7 @@ cat >>confdefs.h <<_ACEOF
 #define _GLIBCXX_ZONEINFO_DIR "${zoneinfo_dir}"
 _ACEOF
 
-    if $GLIBCXX_IS_NATIVE -a ! test -f "$zoneinfo_dir/tzdata.zi"; then
+    if $GLIBCXX_IS_NATIVE && ! test -f "$zoneinfo_dir/tzdata.zi"; then
       { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \"$zoneinfo_dir does not contain tzdata.zi file\"" >&5
 $as_echo "$as_me: WARNING: \"$zoneinfo_dir does not contain tzdata.zi file\"" >&2;}
     fi