configure: Account CXXFLAGS in gcc-plugin.m4.

Message ID 20211210232329.9649-1-iain@sandoe.co.uk
State New
Headers
Series configure: Account CXXFLAGS in gcc-plugin.m4. |

Commit Message

Iain Sandoe Dec. 10, 2021, 11:23 p.m. UTC
  While doing tests of the PCH changes, I noticed that all the
plugin tests were being omitted from m32 Darwin under some
permutations of flags.  It turned out to be a broken config
test - it was not removing -mdynamic-no-pic properly.

We now use a C++ compiler so that we need to process CXXFLAGS
as well as CFLAGS in the gcc-plugin config fragment.

Tested on i686, x86_64-darwin, x86_64, powerpc64le-linux
OK for master?
backports?

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>

config/ChangeLog:

	* gcc-plugin.m4: Save and process CXXFLAGS.

gcc/ChangeLog:

	* configure: Regenerate.

libcc1/ChangeLog:

	* configure: Regenerate.
---
 config/gcc-plugin.m4 | 5 +++++
 gcc/configure        | 5 +++++
 libcc1/configure     | 5 +++++
 3 files changed, 15 insertions(+)
  

Comments

Jeff Law Dec. 14, 2021, 9:59 p.m. UTC | #1
On 12/10/2021 4:23 PM, Iain Sandoe via Gcc-patches wrote:
> While doing tests of the PCH changes, I noticed that all the
> plugin tests were being omitted from m32 Darwin under some
> permutations of flags.  It turned out to be a broken config
> test - it was not removing -mdynamic-no-pic properly.
>
> We now use a C++ compiler so that we need to process CXXFLAGS
> as well as CFLAGS in the gcc-plugin config fragment.
>
> Tested on i686, x86_64-darwin, x86_64, powerpc64le-linux
> OK for master?
> backports?
>
> Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
>
> config/ChangeLog:
>
> 	* gcc-plugin.m4: Save and process CXXFLAGS.
>
> gcc/ChangeLog:
>
> 	* configure: Regenerate.
>
> libcc1/ChangeLog:
>
> 	* configure: Regenerate.
OK
jeff
  

Patch

diff --git a/config/gcc-plugin.m4 b/config/gcc-plugin.m4
index 8f278719118..7ee342fe5fe 100644
--- a/config/gcc-plugin.m4
+++ b/config/gcc-plugin.m4
@@ -91,14 +91,18 @@  AC_DEFUN([GCC_ENABLE_PLUGINS],
      # Check that we can build shared objects with -fPIC -shared
      saved_LDFLAGS="$LDFLAGS"
      saved_CFLAGS="$CFLAGS"
+     saved_CXXFLAGS="$CXXFLAGS"
      case "${host}" in
        *-*-darwin*)
 	 CFLAGS=`echo $CFLAGS | sed s/-mdynamic-no-pic//g`
 	 CFLAGS="$CFLAGS -fPIC"
+	 CXXFLAGS=`echo $CXXFLAGS | sed s/-mdynamic-no-pic//g`
+	 CXXFLAGS="$CXXFLAGS -fPIC"
 	 LDFLAGS="$LDFLAGS -shared -undefined dynamic_lookup"
        ;;
        *)
 	 CFLAGS="$CFLAGS -fPIC"
+	 CXXFLAGS="$CXXFLAGS -fPIC"
 	 LDFLAGS="$LDFLAGS -fPIC -shared"
        ;;
      esac
@@ -113,6 +117,7 @@  AC_DEFUN([GCC_ENABLE_PLUGINS],
      fi
      LDFLAGS="$saved_LDFLAGS"
      CFLAGS="$saved_CFLAGS"
+     CXXFLAGS="$saved_CXXFLAGS"
 
      # If plugin support had been requested but not available, fail.
      if test x"$enable_plugin" = x"no" ; then
diff --git a/gcc/configure b/gcc/configure
index de20e5d2629..5470987b62f 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -32038,14 +32038,18 @@  fi
      # Check that we can build shared objects with -fPIC -shared
      saved_LDFLAGS="$LDFLAGS"
      saved_CFLAGS="$CFLAGS"
+     saved_CXXFLAGS="$CXXFLAGS"
      case "${host}" in
        *-*-darwin*)
 	 CFLAGS=`echo $CFLAGS | sed s/-mdynamic-no-pic//g`
 	 CFLAGS="$CFLAGS -fPIC"
+	 CXXFLAGS=`echo $CXXFLAGS | sed s/-mdynamic-no-pic//g`
+	 CXXFLAGS="$CXXFLAGS -fPIC"
 	 LDFLAGS="$LDFLAGS -shared -undefined dynamic_lookup"
        ;;
        *)
 	 CFLAGS="$CFLAGS -fPIC"
+	 CXXFLAGS="$CXXFLAGS -fPIC"
 	 LDFLAGS="$LDFLAGS -fPIC -shared"
        ;;
      esac
@@ -32077,6 +32081,7 @@  rm -f core conftest.err conftest.$ac_objext \
      fi
      LDFLAGS="$saved_LDFLAGS"
      CFLAGS="$saved_CFLAGS"
+     CXXFLAGS="$saved_CXXFLAGS"
 
      # If plugin support had been requested but not available, fail.
      if test x"$enable_plugin" = x"no" ; then
diff --git a/libcc1/configure b/libcc1/configure
index b198b0b9074..01cfb2806da 100755
--- a/libcc1/configure
+++ b/libcc1/configure
@@ -15141,14 +15141,18 @@  fi
      # Check that we can build shared objects with -fPIC -shared
      saved_LDFLAGS="$LDFLAGS"
      saved_CFLAGS="$CFLAGS"
+     saved_CXXFLAGS="$CXXFLAGS"
      case "${host}" in
        *-*-darwin*)
 	 CFLAGS=`echo $CFLAGS | sed s/-mdynamic-no-pic//g`
 	 CFLAGS="$CFLAGS -fPIC"
+	 CXXFLAGS=`echo $CXXFLAGS | sed s/-mdynamic-no-pic//g`
+	 CXXFLAGS="$CXXFLAGS -fPIC"
 	 LDFLAGS="$LDFLAGS -shared -undefined dynamic_lookup"
        ;;
        *)
 	 CFLAGS="$CFLAGS -fPIC"
+	 CXXFLAGS="$CXXFLAGS -fPIC"
 	 LDFLAGS="$LDFLAGS -fPIC -shared"
        ;;
      esac
@@ -15180,6 +15184,7 @@  rm -f core conftest.err conftest.$ac_objext \
      fi
      LDFLAGS="$saved_LDFLAGS"
      CFLAGS="$saved_CFLAGS"
+     CXXFLAGS="$saved_CXXFLAGS"
 
      # If plugin support had been requested but not available, fail.
      if test x"$enable_plugin" = x"no" ; then