From: Iain Sandoe <iains.gcc@gmail.com>
To: libstdc++ <libstdc++@gcc.gnu.org>
Subject: Fwd: [PATCH 2/4] libstdc++: Adjust build of PCH files accounting configured host support.
Date: Thu, 4 Nov 2021 21:03:43 +0000 [thread overview]
Message-ID: <EB9AC754-904B-4877-AD17-94886712C10E@gmail.com> (raw)
In-Reply-To: <20211104200218.24159-3-iain@sandoe.co.uk>
Well, I did try to CC it to this list ..
> Begin forwarded message:
>
> From: Iain Sandoe via Gcc-patches <gcc-patches@gcc.gnu.org>
> Subject: [PATCH 2/4] libstdc++: Adjust build of PCH files accounting configured host support.
> Date: 4 November 2021 at 20:02:16 GMT
> To: gcc-patches@gcc.gnu.org
> Cc: Iain Sandoe <iains.gcc@gmail.com>
> Reply-To: iain@sandoe.co.uk
>
> This takes account of the overall configuration for host PCH support
> when deciding if we should build the libstdc++ PCH files.
>
> We now require both the support is configured and that we are hosted.
> A non-fatal configure warning is given if the user attempts to
> --disable-host-pch-support --enable-libstdcxx-pch since the latter
> conflicts with the former (but does not prevent a useable libstdc++
> library build).
>
> Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
>
> libstdc++-v3/ChangeLog:
>
> * acinclude.m4: Account for configured host PCH support.
> * configure: Regenerate.
> * configure.ac: Act on --enable-host-pch-support.
> ---
> libstdc++-v3/acinclude.m4 | 49 ++++++++++++++++-----------
> libstdc++-v3/configure | 71 ++++++++++++++++++++++++++-------------
> libstdc++-v3/configure.ac | 11 ++++--
> 3 files changed, 86 insertions(+), 45 deletions(-)
>
> diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
> index 90ecc4a87a2..87652306691 100644
> --- a/libstdc++-v3/acinclude.m4
> +++ b/libstdc++-v3/acinclude.m4
> @@ -3225,7 +3225,7 @@ AC_DEFUN([GLIBCXX_ENABLE_WCHAR_T], [
> ])
>
>
> -dnl
> +≈
> dnl Check to see if building and using a C++ precompiled header can be done.
> dnl
> dnl --enable-libstdcxx-pch=yes
> @@ -3240,29 +3240,40 @@ dnl Substs:
> dnl glibcxx_PCHFLAGS
> dnl
> AC_DEFUN([GLIBCXX_ENABLE_PCH], [
> - GLIBCXX_ENABLE(libstdcxx-pch,$1,,[build pre-compiled libstdc++ headers])
> + dnl This is only allowed if host support is enabled, and we are hosted.
> + if test "$1" = "yes" && test "$2" = "yes"; then
> + can_pch=yes
> + else
> + can_pch=no
> + fi
> + GLIBCXX_ENABLE(libstdcxx-pch,$can_pch,,[build pre-compiled libstdc++ headers])
> if test $enable_libstdcxx_pch = yes; then
> - AC_CACHE_CHECK([for compiler with PCH support],
> - [glibcxx_cv_prog_CXX_pch],
> - [ac_save_CXXFLAGS="$CXXFLAGS"
> - CXXFLAGS="$CXXFLAGS -Werror -Winvalid-pch -Wno-deprecated"
> - AC_LANG_SAVE
> - AC_LANG_CPLUSPLUS
> - echo '#include <math.h>' > conftest.h
> - if $CXX $CXXFLAGS $CPPFLAGS -x c++-header conftest.h \
> + if test "$2" != "yes"; then
> + glibcxx_cv_prog_CXX_pch=no
> + AC_MSG_WARN([PCH headers cannot be built since host PCH is disabled])
> + else
> + AC_CACHE_CHECK([for compiler with PCH support],
> + [glibcxx_cv_prog_CXX_pch],
> + [ac_save_CXXFLAGS="$CXXFLAGS"
> + CXXFLAGS="$CXXFLAGS -Werror -Winvalid-pch -Wno-deprecated"
> + AC_LANG_SAVE
> + AC_LANG_CPLUSPLUS
> + echo '#include <math.h>' > conftest.h
> + if $CXX $CXXFLAGS $CPPFLAGS -x c++-header conftest.h \
> -o conftest.h.gch 1>&5 2>&1 &&
> echo '#error "pch failed"' > conftest.h &&
> echo '#include "conftest.h"' > conftest.cc &&
> $CXX -c $CXXFLAGS $CPPFLAGS conftest.cc 1>&5 2>&1 ;
> - then
> - glibcxx_cv_prog_CXX_pch=yes
> - else
> - glibcxx_cv_prog_CXX_pch=no
> - fi
> - rm -f conftest*
> - CXXFLAGS=$ac_save_CXXFLAGS
> - AC_LANG_RESTORE
> - ])
> + then
> + glibcxx_cv_prog_CXX_pch=yes
> + else
> + glibcxx_cv_prog_CXX_pch=no
> + fi
> + rm -f conftest*
> + CXXFLAGS=$ac_save_CXXFLAGS
> + AC_LANG_RESTORE
> + ])
> + fi
> enable_libstdcxx_pch=$glibcxx_cv_prog_CXX_pch
> fi
>
>
> diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac
> index 2d68b3672b9..ce82f16c859 100644
> --- a/libstdc++-v3/configure.ac
> +++ b/libstdc++-v3/configure.ac
> @@ -103,7 +103,6 @@ if test "$enable_vtable_verify" = yes; then
> postdep_objects_CXX="${postdep_objects_CXX} ${glibcxx_builddir}/../libgcc/vtv_end.o"
> fi
>
> -
> # libtool variables for C++ shared and position-independent compiles.
> #
> # Use glibcxx_lt_pic_flag to designate the automake variable
> @@ -147,8 +146,16 @@ GLIBCXX_ENABLE_HOSTED
> # Enable descriptive messages to standard output on termination.
> GLIBCXX_ENABLE_VERBOSE
>
> +# The current default is that PCH is supported by the host unless otherwise
> +# stated.
> +AC_ARG_ENABLE(host_pch_support,
> +AS_HELP_STRING([--disable-host-pch-support],
> + [Disable host support for precompiled headers]),
> +host_pch_support=$enableval,
> +host_pch_support=yes)
> +
> # Enable compiler support that doesn't require linking.
> -GLIBCXX_ENABLE_PCH($is_hosted)
> +GLIBCXX_ENABLE_PCH($is_hosted, $host_pch_support)
> GLIBCXX_ENABLE_THREADS
> GLIBCXX_ENABLE_ATOMIC_BUILTINS
> GLIBCXX_ENABLE_LOCK_POLICY
> --
> 2.24.3 (Apple Git-128)
>
next parent reply other threads:[~2021-11-04 21:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20211104200218.24159-3-iain@sandoe.co.uk>
2021-11-04 21:03 ` Iain Sandoe [this message]
2021-11-05 23:23 ` 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=EB9AC754-904B-4877-AD17-94886712C10E@gmail.com \
--to=iains.gcc@gmail.com \
--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).