From patchwork Fri Dec 23 17:06:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iain Sandoe X-Patchwork-Id: 62370 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CA1343850F28 for ; Fri, 23 Dec 2022 17:06:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CA1343850F28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1671815211; bh=Jc/IAHWn9M46/SW5jrSlAZtbLrw0aSHnCze/BdoitDM=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=Yy43Svpwpht4qxP1YPVILh3wUxbKPLH7VbB9xvBoVEa/bnFYcuXCN2L7r7ynhLM3W g5K/B0hGDrRA0B8tzMAg0CDHx1QAaLqDKCXUEE1GyGKIelrFEdcxvHjRLJrI3Cj6ej YoO+xU473wc3ZCnWT85jT2HUILzzqLEtDV6X9twU= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by sourceware.org (Postfix) with ESMTPS id 858763858425; Fri, 23 Dec 2022 17:06:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 858763858425 Received: by mail-wm1-x32f.google.com with SMTP id bg10so4011100wmb.1; Fri, 23 Dec 2022 09:06:22 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:reply-to:message-id:date :subject:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Jc/IAHWn9M46/SW5jrSlAZtbLrw0aSHnCze/BdoitDM=; b=AAKabYQZZSdH5GYBqQU4+R3QhXGUaKEoeYenGV5FTpp+21biAKwM67zmskAp9FrCuh 1EMqD6v9JVGNWyUN6Nz1FGPD6Njx6P6HsgaonwnjKOZ6ZctG3sRzE192A634M81pKiwJ Va+xnjxF+gW8nEq/DQglxUjXqDEohqMTbdI3Nq5e9cAjmUpfsDq/Pj8ogg+rz9qRZ2vV OkFa1SrXRC++cjeyRbImTh/YJ7U2quSHmtinpVqcn0wfrwGoACLJjVI7BT8TBAzvggri uf+GnzAOGM+N4JS/0bpK1AXf8dfIdmLnIdaUUp3dZ5oHzqSIW9a/rRTlHQzf73cgjYqM J2Jw== X-Gm-Message-State: AFqh2kpIsUcJ9hsYy3TxL4Mt0GJxWBFsIOh6ay5Z0V/boH+e9Va53oiJ rMgkhnJ0hDxwREF8rwwET6kVoKEgj5g= X-Google-Smtp-Source: AMrXdXv3UNk7oC/TK9yj3gyGCw0BvABmg3MEaxya7wx4rvuNpRHm4w9xoq/eUo8Pz2v5OUVveRPp3A== X-Received: by 2002:a7b:cb59:0:b0:3d3:5709:68e8 with SMTP id v25-20020a7bcb59000000b003d3570968e8mr7648110wmj.36.1671815181208; Fri, 23 Dec 2022 09:06:21 -0800 (PST) Received: from localhost.localdomain (host81-138-1-83.in-addr.btopenworld.com. [81.138.1.83]) by smtp.gmail.com with ESMTPSA id y24-20020a05600c365800b003cf894dbc4fsm4963157wmq.25.2022.12.23.09.06.20 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 23 Dec 2022 09:06:20 -0800 (PST) X-Google-Original-From: Iain Sandoe To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [PATCH] libstdc++, configure: Fix GLIBCXX_ZONEINFO_DIR configuration macro. Date: Fri, 23 Dec 2022 17:06:19 +0000 Message-Id: <20221223170619.38428-1-iain@sandoe.co.uk> X-Mailer: git-send-email 2.37.1 (Apple Git-137.1) MIME-Version: 1.0 X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Iain Sandoe via Gcc-patches From: Iain Sandoe Reply-To: iain@sandoe.co.uk Cc: Iain Sandoe Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "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 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