From 1bfae624b27ea4a1f5c5a92050d741b511e7b3d5 Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Wed, 28 Feb 2018 00:54:05 +0000
Subject: [PATCH 30/39] ldbl128 config

Upstream-Status: Pending

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 gcc/configure    | 13 +++++++++++++
 gcc/configure.ac | 16 ++++++++++++++--
 2 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/gcc/configure b/gcc/configure
index 0788b7bf0b5..eb1a45bb263 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -29370,6 +29370,15 @@ if test "${with_long_double_128+set}" = set; then :
   withval=$with_long_double_128; gcc_cv_target_ldbl128="$with_long_double_128"
 else
 
+      case "$target" in
+	s390*-*-linux-musl*)
+	  gcc_cv_target_ldbl128=yes
+	  ;;
+	powerpc*-*-linux-musl*)
+	  gcc_cv_target_ldbl128=no
+	  ;;
+	*)
+
 if test $glibc_version_major -gt 2 \
   || ( test $glibc_version_major -eq 2 && test $glibc_version_minor -ge 4 ); then :
   gcc_cv_target_ldbl128=yes
@@ -29381,6 +29390,10 @@ else
       && gcc_cv_target_ldbl128=yes
 
 fi
+
+	  ;;
+      esac
+
 fi
 
     ;;
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 5ab50fae0f3..7ffe35ee1c3 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -6030,13 +6030,25 @@ case "$target" in
     AC_ARG_WITH(long-double-128,
       [AS_HELP_STRING([--with-long-double-128],
 		      [use 128-bit long double by default])],
-      gcc_cv_target_ldbl128="$with_long_double_128",
+      gcc_cv_target_ldbl128="$with_long_double_128", [
+      case "$target" in
+	s390*-*-linux-musl*)
+	  gcc_cv_target_ldbl128=yes
+	  ;;
+	powerpc*-*-linux-musl*)
+	  gcc_cv_target_ldbl128=no
+	  ;;
+	*)]
       [GCC_GLIBC_VERSION_GTE_IFELSE([2], [4], [gcc_cv_target_ldbl128=yes], [
       [gcc_cv_target_ldbl128=no
       grep '^[ 	]*#[ 	]*define[ 	][ 	]*__LONG_DOUBLE_MATH_OPTIONAL' \
         $target_header_dir/bits/wordsize.h > /dev/null 2>&1 \
       && gcc_cv_target_ldbl128=yes
-      ]])])
+      ]])]
+      [
+	  ;;
+      esac
+      ])
     ;;
 esac
 if test x$gcc_cv_target_ldbl128 = xyes; then
-- 
2.25.1

