libstdc++: respect with-{headers, newlib} for default hosted value

Message ID 20221012194734.85319-1-arsen@aarsen.me
State Accepted, archived
Headers
Series libstdc++: respect with-{headers, newlib} for default hosted value |

Checks

Context Check Description
snail/gcc-patch-check success Github commit url

Commit Message

Arsen Arsenović Oct. 12, 2022, 7:47 p.m. UTC
  This saves us a build flag when building for freestanding targets.

libstdc++-v3/ChangeLog:

	* acinclude.m4: Default hosted to off if building without
	headers and without newlib.
---
Tested for x86_64-elf.

 libstdc++-v3/acinclude.m4 | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
  

Comments

Jonathan Wakely Oct. 21, 2022, 9:51 a.m. UTC | #1
Pushed to trunk, thanks.

On Wed, 12 Oct 2022 at 20:48, Arsen Arsenović via Libstdc++
<libstdc++@gcc.gnu.org> wrote:
>
> This saves us a build flag when building for freestanding targets.
>
> libstdc++-v3/ChangeLog:
>
>         * acinclude.m4: Default hosted to off if building without
>         headers and without newlib.
> ---
> Tested for x86_64-elf.
>
>  libstdc++-v3/acinclude.m4 | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
> index 719eab15c77..8f4e901c909 100644
> --- a/libstdc++-v3/acinclude.m4
> +++ b/libstdc++-v3/acinclude.m4
> @@ -2982,7 +2982,10 @@ AC_DEFUN([GLIBCXX_ENABLE_HOSTED], [
>             enable_hosted_libstdcxx=no
>             ;;
>         *)
> -           enable_hosted_libstdcxx=yes
> +           case "${with_newlib}-${with_headers}" in
> +           no-no) enable_hosted_libstdcxx=no ;;
> +           *) enable_hosted_libstdcxx=yes ;;
> +           esac
>             ;;
>       esac])
>
> --
> 2.38.0
>
  

Patch

diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
index 719eab15c77..8f4e901c909 100644
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -2982,7 +2982,10 @@  AC_DEFUN([GLIBCXX_ENABLE_HOSTED], [
 	    enable_hosted_libstdcxx=no
 	    ;;
 	*)
-	    enable_hosted_libstdcxx=yes
+	    case "${with_newlib}-${with_headers}" in
+	    no-no) enable_hosted_libstdcxx=no ;;
+	    *) enable_hosted_libstdcxx=yes ;;
+	    esac
 	    ;;
      esac])