diff mbox

Introduce --with-gcc-major-version-only configure option

Message ID 20170109204316.GR21933@tucnak
State New
Headers show

Commit Message

Jakub Jelinek Jan. 9, 2017, 8:43 p.m. UTC
Hi!

On Fri, Jan 06, 2017 at 01:48:26PM +0100, Jakub Jelinek wrote:
> Yet another option is introduce AC_ARG_ENABLE into all those configure
> scripts (some macro in config/*.m4) and do the sed conditionally.

Here is a patch to do that.
Bootstrapped/regtested on x86_64-linux (without
--with-gcc-major-version-only) and on i686-linux (with
--with-gcc-major-version-only), then tested make install of both.
The former uses the standard gcc -dumpversion of 7.0.0 and 7.0.0 in
pathnames (e.g. usr/local/bin/x86_64-pc-linux-gnu-gcc-7.0.0,
usr/local/lib/gcc/x86_64-pc-linux-gnu/7.0.0,
usr/local/libexec/gcc/x86_64-pc-linux-gnu/7.0.0,
usr/local/lib/go/7.0.0/x86_64-pc-linux-gnu,
usr/local/include/c++/7.0.0 etc.), while the latter uses
gcc -dumpversion of 7 and 7 in pathnames (e.g.
i686-pc-linux-gnu-gcc-7, usr/local/lib/gcc/i686-pc-linux-gnu/7,
usr/local/libexec/gcc/i686-pc-linux-gnu/7,
usr/local/lib/go/7/i686-pc-linux-gnu,
usr/local/include/c++/7 etc.).
Ok for trunk?

2017-01-09  Jakub Jelinek  <jakub@redhat.com>

	* configure: Regenerated.
config/
	* acx.m4 (GCC_BASE_VER): New m4 function.
	(ACX_TOOL_DIRS): Require GCC_BASE_VER, for
	--with-gcc-major-version-only use just major number from BASE-VER.
gcc/
	* configure.ac: Add GCC_BASE_VER.
	* Makefile.in (version): Use @get_gcc_base_ver@ instead of cat to get
	version from BASE-VER file.
	* doc/install.texi: Document --with-gcc-major-version-only.
	* configure: Regenerated.
libatomic/
	* configure.ac: Add GCC_BASE_VER.
	* Makefile.am (gcc_version): Use @get_gcc_base_ver@ instead of cat to
	get version from BASE-VER file.
	* testsuite/Makefile.in: Regenerated.
	* configure: Regenerated.
	* Makefile.in: Regenerated.
libgomp/
	* configure.ac: Add GCC_BASE_VER.
	* Makefile.am (gcc_version): Use @get_gcc_base_ver@ instead of cat to
	get version from BASE-VER file.
	* testsuite/Makefile.in: Regenerated.
	* configure: Regenerated.
	* Makefile.in: Regenerated.
libgcc/
	* configure.ac: Add GCC_BASE_VER.
	* Makefile.in (version): Use @get_gcc_base_ver@ instead of cat to get
	version from BASE-VER file.
	* configure: Regenerated.
libssp/
	* configure.ac: Add GCC_BASE_VER.
	* Makefile.am (gcc_version): Use @get_gcc_base_ver@ instead of cat to
	get version from BASE-VER file.
	* configure: Regenerated.
	* Makefile.in: Regenerated.
liboffloadmic/
	* configure.ac: Add GCC_BASE_VER.
	* Makefile.am (gcc_version): Use @get_gcc_base_ver@ instead of cat to
	get version from BASE-VER file.
	* aclocal.m4: Include ../config/acx.m4.
	* configure: Regenerated.
	* Makefile.in: Regenerated.
libquadmath/
	* configure.ac: Add GCC_BASE_VER.
	* Makefile.am (gcc_version): Use @get_gcc_base_ver@ instead of cat to
	get version from BASE-VER file.
	* configure: Regenerated.
	* Makefile.in: Regenerated.
libmpx/
	* configure.ac: Add GCC_BASE_VER.
	* Makefile.am (gcc_version): Use @get_gcc_base_ver@ instead of cat to
	get version from BASE-VER file.
	* configure: Regenerated.
	* Makefile.in: Regenerated.
libada/
	* configure.ac: Add GCC_BASE_VER.
	* Makefile.in (version): Use @get_gcc_base_ver@ instead of cat to get
	version from BASE-VER file.
	* configure: Regenerated.
lto-plugin/
	* configure.ac: Add GCC_BASE_VER.
	* Makefile.am (gcc_version): Use @get_gcc_base_ver@ instead of cat to
	get version from BASE-VER file.
	* configure: Regenerated.
	* Makefile.in: Regenerated.
libitm/
	* configure.ac: Add GCC_BASE_VER.
	* Makefile.am (gcc_version): Use @get_gcc_base_ver@ instead of cat to
	get version from BASE-VER file.
	* testsuite/Makefile.in: Regenerated.
	* configure: Regenerated.
	* Makefile.in: Regenerated.
fixincludes/
	* configure.ac: Add GCC_BASE_VER.
	* Makefile.in (gcc_version): Use @get_gcc_base_ver@ instead of cat to
	get version from BASE-VER file.
	* configure: Regenerated.
libcilkrts/
	* configure.ac: Add GCC_BASE_VER.
	* Makefile.am (gcc_version): Use @get_gcc_base_ver@ instead of cat to
	get version from BASE-VER file.
	* aclocal.m4: Include ../config/acx.m4.
	* configure: Regenerated.
	* Makefile.in: Regenerated.
libcc1/
	* configure.ac: Add GCC_BASE_VER.  For --with-gcc-major-version-only
	use just major number from BASE-VER.
	* configure: Regenerated.
	* Makefile.in: Regenerated.
libobjc/
	* configure.ac: Add GCC_BASE_VER.
	* Makefile.in (gcc_version): Use @get_gcc_base_ver@ instead of cat to
	get version from BASE-VER file.
	* configure: Regenerated.
libstdc++-v3/
	* configure.ac: Add GCC_BASE_VER.
	* fragment.am (gcc_version): Use @get_gcc_base_ver@ instead of cat to
	get version from BASE-VER file.
	* po/Makefile.in: Regenerated.
	* libsupc++/Makefile.in: Regenerated.
	* testsuite/Makefile.in: Regenerated.
	* src/Makefile.in: Regenerated.
	* configure: Regenerated.
	* Makefile.in: Regenerated.
	* include/Makefile.in: Regenerated.
	* doc/Makefile.in: Regenerated.
	* python/Makefile.in: Regenerated.
	* src/c++11/Makefile.in: Regenerated.
	* src/c++98/Makefile.in: Regenerated.
	* src/filesystem/Makefile.in: Regenerated.
libvtv/
	* configure.ac: Add GCC_BASE_VER.
	* Makefile.am (gcc_version): Use @get_gcc_base_ver@ instead of cat to
	get version from BASE-VER file.
	* testsuite/Makefile.in: Regenerated.
	* configure: Regenerated.
	* Makefile.in: Regenerated.
libsanitizer/
	* configure.ac: Add GCC_BASE_VER.
	* Makefile.am (gcc_version): Use @get_gcc_base_ver@ instead of cat to
	get version from BASE-VER file.
	* libbacktrace/Makefile.in: Regenerated.
	* interception/Makefile.in: Regenerated.
	* asan/Makefile.in: Regenerated.
	* ubsan/Makefile.in: Regenerated.
	* configure: Regenerated.
	* sanitizer_common/Makefile.in: Regenerated.
	* lsan/Makefile.in: Regenerated.
	* Makefile.in: Regenerated.
	* tsan/Makefile.in: Regenerated.
libgfortran/
	* configure.ac: Add GCC_BASE_VER.
	* Makefile.am (gcc_version): Use @get_gcc_base_ver@ instead of cat to
	get version from BASE-VER file.
	* configure: Regenerated.
	* Makefile.in: Regenerated.



	Jakub

Comments

Matthias Klose Jan. 9, 2017, 11:15 p.m. UTC | #1
On 09.01.2017 21:43, Jakub Jelinek wrote:
> Hi!
> 
> On Fri, Jan 06, 2017 at 01:48:26PM +0100, Jakub Jelinek wrote:
>> Yet another option is introduce AC_ARG_ENABLE into all those configure
>> scripts (some macro in config/*.m4) and do the sed conditionally.
> 
> Here is a patch to do that.
> Bootstrapped/regtested on x86_64-linux (without
> --with-gcc-major-version-only) and on i686-linux (with
> --with-gcc-major-version-only), then tested make install of both.
> The former uses the standard gcc -dumpversion of 7.0.0 and 7.0.0 in
> pathnames (e.g. usr/local/bin/x86_64-pc-linux-gnu-gcc-7.0.0,
> usr/local/lib/gcc/x86_64-pc-linux-gnu/7.0.0,
> usr/local/libexec/gcc/x86_64-pc-linux-gnu/7.0.0,
> usr/local/lib/go/7.0.0/x86_64-pc-linux-gnu,
> usr/local/include/c++/7.0.0 etc.), while the latter uses
> gcc -dumpversion of 7 and 7 in pathnames (e.g.
> i686-pc-linux-gnu-gcc-7, usr/local/lib/gcc/i686-pc-linux-gnu/7,
> usr/local/libexec/gcc/i686-pc-linux-gnu/7,
> usr/local/lib/go/7/i686-pc-linux-gnu,
> usr/local/include/c++/7 etc.).
> Ok for trunk?

Thanks for working on this.  I'm using such a layout for the Debian/Ubuntu GCC
builds for some years.  The one thing a dislike with your patch is the changed
output of the -dumpversion option which is different whether you use the the new
configure option or not.  This could break builds of third party software.  I
would prefer having -dumpversion the very same output independent of any
configure options.  Please could you introduce a new option if you really need that?

Matthias
Jakub Jelinek Jan. 10, 2017, 6:56 a.m. UTC | #2
On Tue, Jan 10, 2017 at 12:15:41AM +0100, Matthias Klose wrote:
> On 09.01.2017 21:43, Jakub Jelinek wrote:
> > On Fri, Jan 06, 2017 at 01:48:26PM +0100, Jakub Jelinek wrote:
> >> Yet another option is introduce AC_ARG_ENABLE into all those configure
> >> scripts (some macro in config/*.m4) and do the sed conditionally.
> > 
> > Here is a patch to do that.
> > Bootstrapped/regtested on x86_64-linux (without
> > --with-gcc-major-version-only) and on i686-linux (with
> > --with-gcc-major-version-only), then tested make install of both.
> > The former uses the standard gcc -dumpversion of 7.0.0 and 7.0.0 in
> > pathnames (e.g. usr/local/bin/x86_64-pc-linux-gnu-gcc-7.0.0,
> > usr/local/lib/gcc/x86_64-pc-linux-gnu/7.0.0,
> > usr/local/libexec/gcc/x86_64-pc-linux-gnu/7.0.0,
> > usr/local/lib/go/7.0.0/x86_64-pc-linux-gnu,
> > usr/local/include/c++/7.0.0 etc.), while the latter uses
> > gcc -dumpversion of 7 and 7 in pathnames (e.g.
> > i686-pc-linux-gnu-gcc-7, usr/local/lib/gcc/i686-pc-linux-gnu/7,
> > usr/local/libexec/gcc/i686-pc-linux-gnu/7,
> > usr/local/lib/go/7/i686-pc-linux-gnu,
> > usr/local/include/c++/7 etc.).
> > Ok for trunk?
> 
> Thanks for working on this.  I'm using such a layout for the Debian/Ubuntu GCC
> builds for some years.  The one thing a dislike with your patch is the changed
> output of the -dumpversion option which is different whether you use the the new
> configure option or not.  This could break builds of third party software.  I
> would prefer having -dumpversion the very same output independent of any
> configure options.  Please could you introduce a new option if you really need that?

As I said on IRC, I think -dumpversion of 7 in this configuration is the
right thing to do.  In GCC sources, we have 3 uses of -dumpversion,
two of them look like:
gcc_version := $(shell $(GOC) -dumpversion)
...
toolexeclibgodir = $(nover_glibgo_toolexeclibdir)/go/$(gcc_version)/$(target_alias)
libexecsubdir = $(libexecdir)/gcc/$(target_alias)/$(gcc_version)
(in libgo and gotools), one in config/tcl.m4 is like:
                            if test "`gcc -dumpversion | awk -F. '{print [$]1}'`" -lt "3" ; then
                                AC_MSG_WARN([64bit mode not supported with GCC < 3.2 on $system])
which works well whether it prints 7 or 7.1.1.
With --with-gcc-major-version-only, the spec_version is different from
BASEVER, and -dumpversion can print just one of those, when they are not the
same.  So, we either break users that expect they can do
`$CC -dumpmachine`-gcc-`$CC -dumpversion`, or find out the C++ includes by
g++ -dumpversion, etc., or we break users that expect 3 numbers separated
by dot or 2 numbers separated by dot with optional another one.
In the past, we have not always pointed 3 numbers, releases printed just
major.minor, like gcc -dumpversion printed 3.0 (as mentioned in the manual).
But the former 3.0 in the previous versioning scheme corresponds to just 7
in the new one.  So, users that expect 3 numbers are already broken,
and just one number is just adjusting those assumptions to the current
versioning scheme.  Yes, we can add a new option, but IMNSHO it should
be -dumpbaseversion or -dumpfullversion that will always print
major.minor.patchlevel.  From the SUSE bugzilla, it looks like SUSE has
been shipping compilers that printed just 5 or 6 for almost 2 years now,
so hopefully some changes if needed somewhere have been already upstreamed.

	Jakub
Andris Pavēnis Jan. 19, 2017, 6:22 a.m. UTC | #3
Just one suggestion:

What about configure option like --with-version-convert where one could specify actual conversion?

I have used conversion sed -e 's:\.::2g' for DJGPP to leave only the first dot in version for 
complying with MS-DOS file name restrictions. The implementation of that was not in shape I could 
submit. This implementation (for --with-gcc-major-version-only) is better. Adding a possibility to 
to specify something like --with-version-convert='sed -e s:\.::2g' would be easy now.

One can of course also simply use --with-gcc-major-version-only for native DJGPP builds (also that 
would remove need of part of DJGPP related changes not submitted to upstream and which did not work 
always nicely for example for cross-native build from Linux)

Andris
diff mbox

Patch

--- config/acx.m4.jj	2016-12-02 13:21:59.731628906 +0100
+++ config/acx.m4	2017-01-09 18:26:52.113282585 +0100
@@ -235,8 +235,28 @@  fi
 ])
 
 
+dnl ####
+dnl # GCC_BASE_VER
+dnl # Determine GCC version number to use in compiler directories.
+
+AC_DEFUN([GCC_BASE_VER],
+[
+  get_gcc_base_ver="cat"
+  AC_ARG_WITH(gcc-major-version-only,
+  [AS_HELP_STRING([--with-gcc-major-version-only], [use only GCC major number in filesystem paths])],
+  [if test x$with_gcc_major_version_only = xyes ; then
+    changequote(,)dnl
+    get_gcc_base_ver="sed -e 's/^\([0-9]*\).*\$\$/\1/'"
+    changequote([,])dnl
+  fi
+  ])
+  AC_SUBST(get_gcc_base_ver)
+])
+
+
 AC_DEFUN([ACX_TOOL_DIRS], [
 AC_REQUIRE([ACX_PATH_SEP])
+AC_REQUIRE([GCC_BASE_VER])
 if test "x$exec_prefix" = xNONE; then
         if test "x$prefix" = xNONE; then
                 gcc_cv_tool_prefix=$ac_default_prefix
@@ -251,7 +271,13 @@  fi
 # case, if there is no compiler in the tree nobody should use
 # AS_FOR_TARGET and LD_FOR_TARGET.
 if test x$host = x$build && test -f $srcdir/gcc/BASE-VER; then
-    gcc_version=`cat $srcdir/gcc/BASE-VER`
+    if test x$with_gcc_major_version_only = xyes ; then
+        changequote(,)dnl
+        gcc_version=`sed -e 's/^\([0-9]*\).*$/\1/' $srcdir/gcc/BASE-VER`
+        changequote([,])dnl
+    else
+        gcc_version=`cat $srcdir/gcc/BASE-VER`
+    fi
     gcc_cv_tool_dirs="$gcc_cv_tool_prefix/libexec/gcc/$target_noncanonical/$gcc_version$PATH_SEPARATOR"
     gcc_cv_tool_dirs="$gcc_cv_tool_dirs$gcc_cv_tool_prefix/libexec/gcc/$target_noncanonical$PATH_SEPARATOR"
     gcc_cv_tool_dirs="$gcc_cv_tool_dirs/usr/lib/gcc/$target_noncanonical/$gcc_version$PATH_SEPARATOR"
--- fixincludes/configure.ac.jj	2014-09-25 15:03:18.905982040 +0200
+++ fixincludes/configure.ac	2017-01-09 17:33:38.936383375 +0100
@@ -114,6 +114,9 @@  AC_SUBST(MAINT)
 AC_DEFINE_UNQUOTED([SED_PROGRAM], "${SED}",
    [Defined to the best working sed program on the host system])
 
+# Determine what GCC version number to use in filesystem paths.
+GCC_BASE_VER
+
 AC_CONFIG_HEADERS(config.h, [echo timestamp > stamp-h])
 AC_CONFIG_FILES(Makefile mkheaders.almost:mkheaders.in)
 AC_OUTPUT
--- fixincludes/Makefile.in.jj	2014-09-25 15:03:18.803983954 +0200
+++ fixincludes/Makefile.in	2017-01-09 17:33:38.937383362 +0100
@@ -49,7 +49,7 @@  target = @target@
 target_noncanonical:=@target_noncanonical@
 
 # The version of GCC in this tree
-gcc_version := $(shell cat $(srcdir)/../gcc/BASE-VER)
+gcc_version := $(shell @get_gcc_base_ver@ $(srcdir)/../gcc/BASE-VER)
 
 # Directory in which the compiler finds libraries etc.
 libsubdir = $(libdir)/gcc/$(target_noncanonical)/$(gcc_version)
--- gcc/configure.ac.jj	2017-01-02 18:15:33.786946193 +0100
+++ gcc/configure.ac	2017-01-09 17:33:38.939383336 +0100
@@ -1794,6 +1794,9 @@  static struct plugin_gcc_version gcc_ver
 EOF
 changequote([,])dnl
 
+# Determine what GCC version number to use in filesystem paths.
+GCC_BASE_VER
+
 # Internationalization
 ZW_GNU_GETTEXT_SISTER_DIR
 
--- gcc/Makefile.in.jj	2017-01-06 16:58:43.506596421 +0100
+++ gcc/Makefile.in	2017-01-09 17:33:38.940383323 +0100
@@ -865,7 +865,7 @@  else
 REVISION_c  := $(shell cat $(REVISION))
 endif
 
-version     := $(BASEVER_c)
+version     := $(shell @get_gcc_base_ver@ $(BASEVER))
 
 PATCHLEVEL_c := \
   $(shell echo $(BASEVER_c) | sed -e 's/^[0-9]*\.[0-9]*\.\([0-9]*\)$$/\1/')
--- gcc/doc/install.texi.jj	2017-01-02 18:15:32.211966153 +0100
+++ gcc/doc/install.texi	2017-01-09 17:33:38.941383310 +0100
@@ -894,6 +894,10 @@  ideas of what it is for.  People use it
 install part of GCC@.  Perhaps they make this assumption because
 installing GCC creates the directory.
 
+@item --with-gcc-major-version-only
+Specifies that GCC should use only the major number rather than
+@var{major}.@var{minor}.@var{patchlevel} in filesystem paths.
+
 @item --with-native-system-header-dir=@var{dirname}
 Specifies that @var{dirname} is the directory that contains native system
 header files, rather than @file{/usr/include}.  This option is most useful
--- libada/configure.ac.jj	2017-01-02 18:15:36.849907375 +0100
+++ libada/configure.ac	2017-01-09 17:33:38.942383297 +0100
@@ -144,6 +144,9 @@  if test x$have_unwind_getipinfo = xyes;
 fi
 AC_SUBST(have_getipinfo)
 
+# Determine what GCC version number to use in filesystem paths.
+GCC_BASE_VER
+
 # Output: create a Makefile.
 AC_CONFIG_FILES([Makefile])
 
--- libada/Makefile.in.jj	2017-01-04 20:11:02.397150833 +0100
+++ libada/Makefile.in	2017-01-09 17:33:38.943383284 +0100
@@ -67,7 +67,7 @@  host_subdir = @host_subdir@
 GCC_DIR=$(MULTIBUILDTOP)../../$(host_subdir)/gcc
 
 target_noncanonical:=@target_noncanonical@
-version := $(shell cat $(srcdir)/../gcc/BASE-VER)
+version := $(shell @get_gcc_base_ver@ $(srcdir)/../gcc/BASE-VER)
 libsubdir := $(libdir)/gcc/$(target_noncanonical)/$(version)$(MULTISUBDIR)
 ADA_RTS_DIR=$(GCC_DIR)/ada/rts$(subst /,_,$(MULTISUBDIR))
 ADA_RTS_SUBDIR=./rts$(subst /,_,$(MULTISUBDIR))
--- libatomic/configure.ac.jj	2017-01-02 18:15:30.956982058 +0100
+++ libatomic/configure.ac	2017-01-09 17:33:38.943383284 +0100
@@ -254,6 +254,9 @@  AM_CONDITIONAL(ARCH_I386,
 AM_CONDITIONAL(ARCH_X86_64,
 	       [test "$ARCH" = x86 && test x$libat_cv_wordsize = x8])
 
+# Determine what GCC version number to use in filesystem paths.
+GCC_BASE_VER
+
 if test ${multilib} = yes; then
   multilib_arg="--enable-multilib"
 else
--- libatomic/Makefile.am.jj	2017-01-02 18:15:30.979981766 +0100
+++ libatomic/Makefile.am	2017-01-09 17:33:38.943383284 +0100
@@ -26,7 +26,7 @@  ACLOCAL_AMFLAGS = -I .. -I ../config
 SUBDIRS = testsuite
 
 ## May be used by toolexeclibdir.
-gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
+gcc_version := $(shell @get_gcc_base_ver@ $(top_srcdir)/../gcc/BASE-VER)
 
 config_path= @config_path@
 search_path = $(addprefix $(top_srcdir)/config/, $(config_path)) \
--- libcc1/configure.ac.jj	2017-01-04 20:11:00.083180649 +0100
+++ libcc1/configure.ac	2017-01-09 17:33:38.944383271 +0100
@@ -48,7 +48,15 @@  AC_SUBST(visibility)
 
 AC_CHECK_DECLS([basename])
 
-gcc_version=`cat $srcdir/../gcc/BASE-VER`
+GCC_BASE_VER
+
+if test x$with_gcc_major_version_only = xyes ; then
+  changequote(,)dnl
+  gcc_version=`sed -e 's/^\([0-9]*\).*$/\1/' $srcdir/../gcc/BASE-VER`
+  changequote([,])dnl
+else
+  gcc_version=`cat $srcdir/../gcc/BASE-VER`
+fi
 AC_SUBST(gcc_version)
 AC_SUBST([CONFIG_STATUS_DEPENDENCIES], ['$(top_srcdir)/../gcc/BASE-VER'])
 
--- libcilkrts/configure.ac.jj	2016-12-02 13:22:00.433619939 +0100
+++ libcilkrts/configure.ac	2017-01-09 17:33:38.945383258 +0100
@@ -253,6 +253,8 @@  else
 fi
 AC_SUBST(link_cilkrts)
 
+# Determine what GCC version number to use in filesystem paths.
+GCC_BASE_VER
 
 # Must be last
 AC_OUTPUT
--- libcilkrts/Makefile.am.jj	2016-12-02 13:22:00.506619006 +0100
+++ libcilkrts/Makefile.am	2017-01-09 17:33:38.945383258 +0100
@@ -62,7 +62,7 @@  AM_CPPFLAGS = $(GENERAL_FLAGS)
 AM_LDFLAGS = $(XLDFLAGS)
 
 # May be used by toolexeclibdir.
-gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
+gcc_version := $(shell @get_gcc_base_ver@ $(top_srcdir)/../gcc/BASE-VER)
 
 # Target list.
 nodist_toolexeclib_HEADERS = libcilkrts.spec
--- libcilkrts/aclocal.m4.jj	2015-05-13 16:37:01.464776769 +0200
+++ libcilkrts/aclocal.m4	2017-01-09 17:33:38.946383245 +0100
@@ -992,6 +992,7 @@  m4_include([../config/depstand.m4])
 m4_include([../config/lead-dot.m4])
 m4_include([../config/multi.m4])
 m4_include([../config/override.m4])
+m4_include([../config/acx.m4])
 m4_include([../libtool.m4])
 m4_include([../ltoptions.m4])
 m4_include([../ltsugar.m4])
--- libgcc/configure.ac.jj	2016-09-21 15:13:45.659640056 +0200
+++ libgcc/configure.ac	2017-01-09 17:33:38.947383232 +0100
@@ -544,6 +544,9 @@  AC_SUBST(tm_defines)
 # Map from thread model to thread header.
 GCC_AC_THREAD_HEADER([$target_thread_file])
 
+# Determine what GCC version number to use in filesystem paths.
+GCC_BASE_VER
+
 # Substitute configuration variables
 AC_SUBST(cpu_type)
 AC_SUBST(extra_parts)
--- libgcc/Makefile.in.jj	2017-01-04 20:11:00.933169710 +0100
+++ libgcc/Makefile.in	2017-01-09 17:33:38.948383220 +0100
@@ -224,7 +224,7 @@  export slibdir
 export toolexecdir
 export toolexeclibdir
 
-version := $(shell cat $(srcdir)/../gcc/BASE-VER)
+version := $(shell @get_gcc_base_ver@ $(srcdir)/../gcc/BASE-VER)
 
 ifeq ($(decimal_float),yes)
 ifeq ($(enable_decimal_float),bid)
--- libgfortran/configure.ac.jj	2016-12-12 18:02:22.055118590 +0100
+++ libgfortran/configure.ac	2017-01-09 17:33:38.948383220 +0100
@@ -621,6 +621,9 @@  LIBGFOR_CHECK_AVX2
 # Check wether we support AVX512f extensions
 LIBGFOR_CHECK_AVX512F
 
+# Determine what GCC version number to use in filesystem paths.
+GCC_BASE_VER
+
 AC_CACHE_SAVE
 
 if test ${multilib} = yes; then
--- libgfortran/Makefile.am.jj	2016-12-20 17:54:21.145168201 +0100
+++ libgfortran/Makefile.am	2017-01-09 17:33:38.949383207 +0100
@@ -4,7 +4,7 @@ 
 ACLOCAL_AMFLAGS = -I .. -I ../config
 
 ## May be used by toolexeclibdir.
-gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
+gcc_version := $(shell @get_gcc_base_ver@ $(top_srcdir)/../gcc/BASE-VER)
 
 ## Symbol versioning (copied from libssp).
 if LIBGFOR_USE_SYMVER
--- libgomp/configure.ac.jj	2016-12-02 13:21:59.273634756 +0100
+++ libgomp/configure.ac	2017-01-09 17:33:38.950383194 +0100
@@ -379,6 +379,9 @@  AC_SUBST(OMP_LOCK_25_KIND)
 AC_SUBST(OMP_NEST_LOCK_25_KIND)
 CFLAGS="$save_CFLAGS"
 
+# Determine what GCC version number to use in filesystem paths.
+GCC_BASE_VER
+
 AC_CONFIG_FILES(omp.h omp_lib.h omp_lib.f90 libgomp_f.h)
 AC_CONFIG_FILES(Makefile testsuite/Makefile libgomp.spec)
 AC_CONFIG_FILES([testsuite/libgomp-test-support.pt.exp:testsuite/libgomp-test-support.exp.in])
--- libgomp/Makefile.am.jj	2016-11-24 18:03:13.552733931 +0100
+++ libgomp/Makefile.am	2017-01-09 17:33:38.951383181 +0100
@@ -4,7 +4,7 @@  ACLOCAL_AMFLAGS = -I .. -I ../config
 SUBDIRS = testsuite
 
 ## May be used by toolexeclibdir.
-gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
+gcc_version := $(shell @get_gcc_base_ver@ $(top_srcdir)/../gcc/BASE-VER)
 
 config_path = @config_path@
 search_path = $(addprefix $(top_srcdir)/config/, $(config_path)) $(top_srcdir) \
--- libitm/configure.ac.jj	2017-01-02 18:15:20.980108497 +0100
+++ libitm/configure.ac	2017-01-09 17:33:38.951383181 +0100
@@ -286,5 +286,8 @@  AM_CONDITIONAL([ARCH_X86], [test "$ARCH"
 AM_CONDITIONAL([ARCH_X86_AVX], [test "$libitm_cv_as_avx" = yes])
 AM_CONDITIONAL([ARCH_FUTEX], [test $enable_linux_futex = yes])
 
+# Determine what GCC version number to use in filesystem paths.
+GCC_BASE_VER
+
 AC_CONFIG_FILES(Makefile testsuite/Makefile libitm.spec)
 AC_OUTPUT
--- libitm/Makefile.am.jj	2016-01-21 17:37:06.015673845 +0100
+++ libitm/Makefile.am	2017-01-09 17:33:38.951383181 +0100
@@ -4,7 +4,7 @@  ACLOCAL_AMFLAGS = -I .. -I ../config
 SUBDIRS = testsuite
 
 ## May be used by toolexeclibdir.
-gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
+gcc_version := $(shell @get_gcc_base_ver@ $(top_srcdir)/../gcc/BASE-VER)
 
 abi_version = -fabi-version=4
 
--- libmpx/configure.ac.jj	2015-09-03 17:28:49.459703842 +0200
+++ libmpx/configure.ac	2017-01-09 17:33:38.952383168 +0100
@@ -125,6 +125,9 @@  else
   multilib_arg=
 fi
 
+# Determine what GCC version number to use in filesystem paths.
+GCC_BASE_VER
+
 AC_CONFIG_FILES([Makefile libmpx.spec])
 AC_CONFIG_HEADERS(config.h)
 AC_CONFIG_FILES(AC_FOREACH([DIR], [mpxrt mpxwrap], [DIR/Makefile ]),
--- libmpx/Makefile.am.jj	2015-03-10 16:56:02.643792850 +0100
+++ libmpx/Makefile.am	2017-01-09 17:33:38.952383168 +0100
@@ -9,7 +9,7 @@  nodist_toolexeclib_HEADERS = libmpx.spec
 endif
 
 ## May be used by toolexeclibdir.
-gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
+gcc_version := $(shell @get_gcc_base_ver@ $(top_srcdir)/../gcc/BASE-VER)
 
 # Work around what appears to be a GNU make bug handling MAKEFLAGS
 # values defined in terms of make variables, as is the case for CC and
--- libobjc/configure.ac.jj	2017-01-02 18:15:35.951918756 +0100
+++ libobjc/configure.ac	2017-01-09 17:33:38.952383168 +0100
@@ -347,6 +347,9 @@  AC_SUBST(OBJC_BOEHM_GC)
 AC_SUBST(OBJC_BOEHM_GC_INCLUDES)
 AC_SUBST(OBJC_BOEHM_GC_LIBS)
 
+# Determine what GCC version number to use in filesystem paths.
+GCC_BASE_VER
+
 # ------
 # Output
 # ------
--- libobjc/Makefile.in.jj	2017-01-02 18:15:35.906919326 +0100
+++ libobjc/Makefile.in	2017-01-09 17:33:38.953383155 +0100
@@ -31,7 +31,7 @@  VPATH = @glibcpp_srcdir@
 prefix = @prefix@
 exec_prefix = @exec_prefix@
 target_noncanonical = @target_noncanonical@
-gcc_version := $(shell cat $(srcdir)/../gcc/BASE-VER)
+gcc_version := $(shell @get_gcc_base_ver@ $(srcdir)/../gcc/BASE-VER)
 host_subdir = @host_subdir@
 top_srcdir = @top_srcdir@
 multi_basedir = @multi_basedir@
--- liboffloadmic/configure.ac.jj	2014-11-13 20:44:23.714783898 +0100
+++ liboffloadmic/configure.ac	2017-01-09 17:33:38.953383155 +0100
@@ -128,5 +128,8 @@  fi
 AC_SUBST(link_offloadmic_host)
 AC_SUBST(link_offloadmic_target)
 
+# Determine what GCC version number to use in filesystem paths.
+GCC_BASE_VER
+
 # Must be last
 AC_OUTPUT
--- liboffloadmic/Makefile.am.jj	2016-07-22 15:02:02.176876795 +0200
+++ liboffloadmic/Makefile.am	2017-01-09 17:33:38.954383142 +0100
@@ -41,7 +41,7 @@  libgomp_dir = $(build_dir)/../libgomp
 source_dir = $(top_srcdir)/runtime
 
 # May be used by toolexeclibdir.
-gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
+gcc_version := $(shell @get_gcc_base_ver@ $(top_srcdir)/../gcc/BASE-VER)
 libsubincludedir = $(libdir)/gcc/$(target_alias)/$(gcc_version)/include
 
 # Target list.
--- liboffloadmic/aclocal.m4.jj	2015-05-13 16:36:59.669804873 +0200
+++ liboffloadmic/aclocal.m4	2017-01-09 17:33:38.954383142 +0100
@@ -992,6 +992,7 @@  m4_include([../config/depstand.m4])
 m4_include([../config/lead-dot.m4])
 m4_include([../config/multi.m4])
 m4_include([../config/override.m4])
+m4_include([../config/acx.m4])
 m4_include([../libtool.m4])
 m4_include([../ltoptions.m4])
 m4_include([../ltsugar.m4])
--- libquadmath/configure.ac.jj	2015-01-26 20:00:55.778725986 +0100
+++ libquadmath/configure.ac	2017-01-09 17:33:38.955383129 +0100
@@ -364,6 +364,8 @@  AS_HELP_STRING([--enable-generated-files
 AC_MSG_RESULT($enable_generated_files_in_srcdir)
 AM_CONDITIONAL(GENINSRC, test "$enable_generated_files_in_srcdir" = yes)
 
+# Determine what GCC version number to use in filesystem paths.
+GCC_BASE_VER
 
 AC_CONFIG_FILES(Makefile)
 AC_OUTPUT
--- libquadmath/Makefile.am.jj	2015-09-03 17:28:49.478703565 +0200
+++ libquadmath/Makefile.am	2017-01-09 17:33:38.955383129 +0100
@@ -9,7 +9,7 @@  ACLOCAL_AMFLAGS = -I .. -I ../config
 AM_CPPFLAGS = -I $(top_srcdir)/../include
 
 ## May be used by toolexeclibdir.
-gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
+gcc_version := $(shell @get_gcc_base_ver@ $(top_srcdir)/../gcc/BASE-VER)
 
 ## Symbol versioning (copied from libssp).
 if LIBQUAD_USE_SYMVER
--- libsanitizer/configure.ac.jj	2016-11-09 18:26:30.796867945 +0100
+++ libsanitizer/configure.ac	2017-01-09 17:33:38.955383129 +0100
@@ -377,4 +377,7 @@  fi
 AC_SUBST([TSAN_TARGET_DEPENDENT_OBJECTS])
 AC_SUBST([SANITIZER_COMMON_TARGET_DEPENDENT_OBJECTS])
 
+# Determine what GCC version number to use in filesystem paths.
+GCC_BASE_VER
+
 AC_OUTPUT
--- libsanitizer/Makefile.am.jj	2014-09-25 15:01:25.453109772 +0200
+++ libsanitizer/Makefile.am	2017-01-09 17:33:38.955383129 +0100
@@ -24,7 +24,7 @@  endif
 endif
 
 ## May be used by toolexeclibdir.
-gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
+gcc_version := $(shell @get_gcc_base_ver@ $(top_srcdir)/../gcc/BASE-VER)
 
 # Work around what appears to be a GNU make bug handling MAKEFLAGS
 # values defined in terms of make variables, as is the case for CC and
--- libssp/configure.ac.jj	2014-09-25 15:03:18.034998385 +0200
+++ libssp/configure.ac	2017-01-09 17:33:38.956383116 +0100
@@ -195,5 +195,8 @@  else
   multilib_arg=
 fi
 
+# Determine what GCC version number to use in filesystem paths.
+GCC_BASE_VER
+
 AC_CONFIG_FILES([Makefile ssp/ssp.h])
 AC_OUTPUT
--- libssp/Makefile.am.jj	2017-01-04 20:11:02.429150420 +0100
+++ libssp/Makefile.am	2017-01-09 17:33:38.957383103 +0100
@@ -8,7 +8,7 @@  ACLOCAL_AMFLAGS = -I .. -I ../config
 MAINT_CHARSET = latin1
 
 # May be used by various substitution variables.
-gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
+gcc_version := $(shell @get_gcc_base_ver@ $(top_srcdir)/../gcc/BASE-VER)
 
 if LIBSSP_USE_SYMVER
 if LIBSSP_USE_SYMVER_GNU
--- libstdc++-v3/configure.ac.jj	2017-01-06 16:58:42.298612373 +0100
+++ libstdc++-v3/configure.ac	2017-01-09 17:33:38.957383103 +0100
@@ -509,6 +509,9 @@  GLIBCXX_EXPORT_INSTALL_INFO
 GLIBCXX_EXPORT_INCLUDES
 GLIBCXX_EXPORT_FLAGS
 
+# Determine what GCC version number to use in filesystem paths.
+GCC_BASE_VER
+
 dnl In autoconf 2.5x, AC_OUTPUT is replaced by four AC_CONFIG_* macros,
 dnl which can all be called multiple times as needed, plus one (different)
 dnl AC_OUTPUT macro.  This one lists the files to be created:
--- libstdc++-v3/fragment.am.jj	2017-01-06 16:58:42.347611726 +0100
+++ libstdc++-v3/fragment.am	2017-01-09 17:33:38.958383090 +0100
@@ -2,7 +2,7 @@ 
 ## This is used in all Makefile.am's.  Set defaults here.
 
 # May be used by various substitution variables.
-gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
+gcc_version := $(shell @get_gcc_base_ver@ $(top_srcdir)/../gcc/BASE-VER)
 
 MAINT_CHARSET = latin1
 
--- libvtv/configure.ac.jj	2015-12-03 18:24:57.820390364 +0100
+++ libvtv/configure.ac	2017-01-09 17:33:38.958383090 +0100
@@ -190,4 +190,7 @@  AM_CONDITIONAL(VTV_CYGMIN, test $vtv_cyg
 AC_CHECK_FUNCS([_obstack_begin])
 AM_CONDITIONAL(VTV_NO_OBSTACK, test $ac_cv_func__obstack_begin = no)
 
+# Determine what GCC version number to use in filesystem paths.
+GCC_BASE_VER
+
 AC_OUTPUT
--- libvtv/Makefile.am.jj	2017-01-04 20:11:02.389150936 +0100
+++ libvtv/Makefile.am	2017-01-09 17:33:38.959383077 +0100
@@ -28,7 +28,7 @@  endif
 ACLOCAL_AMFLAGS = -I .. -I ../config
 
 # May be used by toolexeclibdir.
-gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
+gcc_version := $(shell @get_gcc_base_ver@ $(top_srcdir)/../gcc/BASE-VER)
 
 DEFS = @DEFS@
 AM_CPPFLAGS = -I$(top_srcdir)/../include
--- lto-plugin/configure.ac.jj	2015-07-03 20:50:45.498788569 +0200
+++ lto-plugin/configure.ac	2017-01-09 17:33:38.959383077 +0100
@@ -45,6 +45,9 @@  fi
 AC_SUBST(accel_dir_suffix)
 AC_SUBST(real_target_noncanonical)
 
+# Determine what GCC version number to use in filesystem paths.
+GCC_BASE_VER
+
 AM_PROG_LIBTOOL
 ACX_LT_HOST_FLAGS
 AC_SUBST(target_noncanonical)
--- lto-plugin/Makefile.am.jj	2015-05-13 16:37:00.085798359 +0200
+++ lto-plugin/Makefile.am	2017-01-09 17:33:38.960383064 +0100
@@ -3,7 +3,7 @@ 
 ACLOCAL_AMFLAGS = -I .. -I ../config
 AUTOMAKE_OPTIONS = no-dependencies
 
-gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
+gcc_version := $(shell @get_gcc_base_ver@ $(top_srcdir)/../gcc/BASE-VER)
 target_noncanonical := @target_noncanonical@
 libexecsubdir := $(libexecdir)/gcc/$(real_target_noncanonical)/$(gcc_version)$(accel_dir_suffix)
 
--- configure.jj	2017-01-04 20:11:00.932169723 +0100
+++ configure	2017-01-09 18:28:04.146361563 +0100
@@ -641,6 +641,7 @@  CXXFLAGS_FOR_TARGET
 CFLAGS_FOR_TARGET
 DEBUG_PREFIX_CFLAGS_FOR_TARGET
 SYSROOT_CFLAGS_FOR_TARGET
+get_gcc_base_ver
 extra_host_zlib_configure_flags
 extra_host_libiberty_configure_flags
 stage1_languages
@@ -786,6 +787,7 @@  enable_objc_gc
 with_target_bdw_gc
 with_target_bdw_gc_include
 with_target_bdw_gc_lib
+with_gcc_major_version_only
 with_build_sysroot
 with_debug_prefix_map
 with_build_config
@@ -1562,6 +1564,8 @@  Optional Packages:
                           files
   --with-target-bdw-gc-lib=PATHLIST
                           specify directories for installed bdw-gc library
+  --with-gcc-major-version-only
+                          use only GCC major number in filesystem paths
   --with-build-sysroot=SYSROOT
                           use sysroot as the system root during the build
   --with-debug-prefix-map='A=B C=D ...'
@@ -6619,6 +6623,20 @@  if test "${PATH_SEPARATOR+set}" != set;
 fi
 
 
+  get_gcc_base_ver="cat"
+
+# Check whether --with-gcc-major-version-only was given.
+if test "${with_gcc_major_version_only+set}" = set; then :
+  withval=$with_gcc_major_version_only; if test x$with_gcc_major_version_only = xyes ; then
+        get_gcc_base_ver="sed -e 's/^\([0-9]*\).*\$\$/\1/'"
+      fi
+
+fi
+
+
+
+
+
 
 if test "x$exec_prefix" = xNONE; then
         if test "x$prefix" = xNONE; then
@@ -6634,7 +6652,11 @@  fi
 # case, if there is no compiler in the tree nobody should use
 # AS_FOR_TARGET and LD_FOR_TARGET.
 if test x$host = x$build && test -f $srcdir/gcc/BASE-VER; then
-    gcc_version=`cat $srcdir/gcc/BASE-VER`
+    if test x$with_gcc_major_version_only = xyes ; then
+                gcc_version=`sed -e 's/^\([0-9]*\).*$/\1/' $srcdir/gcc/BASE-VER`
+            else
+        gcc_version=`cat $srcdir/gcc/BASE-VER`
+    fi
     gcc_cv_tool_dirs="$gcc_cv_tool_prefix/libexec/gcc/$target_noncanonical/$gcc_version$PATH_SEPARATOR"
     gcc_cv_tool_dirs="$gcc_cv_tool_dirs$gcc_cv_tool_prefix/libexec/gcc/$target_noncanonical$PATH_SEPARATOR"
     gcc_cv_tool_dirs="$gcc_cv_tool_dirs/usr/lib/gcc/$target_noncanonical/$gcc_version$PATH_SEPARATOR"
--- fixincludes/configure.jj	2014-09-25 15:03:18.802983973 +0200
+++ fixincludes/configure	2017-01-09 18:29:54.352952449 +0100
@@ -590,6 +590,7 @@  ac_includes_default="\
 
 ac_subst_vars='LTLIBOBJS
 LIBOBJS
+get_gcc_base_ver
 MAINT
 TARGET
 target_noncanonical
@@ -664,6 +665,7 @@  enable_werror_always
 with_local_prefix
 enable_twoprocess
 enable_maintainer_mode
+with_gcc_major_version_only
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1298,6 +1300,8 @@  Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
   --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
   --with-local-prefix=DIR specifies directory to put local include
+  --with-gcc-major-version-only
+                          use only GCC major number in filesystem paths
 
 Some influential environment variables:
   CC          C compiler command
@@ -4561,6 +4565,12 @@  $as_echo "$ac_cv_path_SED" >&6; }
 # Figure out what compiler warnings we can enable.
 # See config/warnings.m4 for details.
 
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
 WARN_CFLAGS=
 save_CFLAGS="$CFLAGS"
 for real_option in -W -Wall -Wwrite-strings -Wstrict-prototypes \
@@ -4607,6 +4617,18 @@  $as_echo "$ac_res" >&6; }
 fi
   done
 CFLAGS="$save_CFLAGS"
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 WARN_PEDANTIC=
 # Do the check with the no- prefix removed from the warning options
@@ -4645,10 +4667,22 @@  if test $acx_cv_prog_cc_pedantic__Wlong_
 fi
 
 fi
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
 
 
 # Only enable with --enable-werror-always until existing warnings are
 # corrected.
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
 WERROR=
 # Check whether --enable-werror-always was given.
 if test "${enable_werror_always+set}" = set; then :
@@ -4661,6 +4695,12 @@  if test $enable_werror_always = yes; the
   WERROR="$WERROR${WERROR:+ }-Werror"
 fi
 
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
 
 
 # Determine the noncanonical target name, for directory use.
@@ -5354,6 +5394,21 @@  cat >>confdefs.h <<_ACEOF
 _ACEOF
 
 
+# Determine what GCC version number to use in filesystem paths.
+
+  get_gcc_base_ver="cat"
+
+# Check whether --with-gcc-major-version-only was given.
+if test "${with_gcc_major_version_only+set}" = set; then :
+  withval=$with_gcc_major_version_only; if test x$with_gcc_major_version_only = xyes ; then
+        get_gcc_base_ver="sed -e 's/^\([0-9]*\).*\$\$/\1/'"
+      fi
+
+fi
+
+
+
+
 ac_config_headers="$ac_config_headers config.h"
 
 ac_config_files="$ac_config_files Makefile mkheaders.almost:mkheaders.in"
--- gcc/configure.jj	2017-01-04 20:11:01.004168795 +0100
+++ gcc/configure	2017-01-09 18:29:55.418938820 +0100
@@ -734,6 +734,7 @@  INCINTL
 LIBINTL_DEP
 LIBINTL
 USE_NLS
+get_gcc_base_ver
 extra_opt_files
 extra_modes_file
 NATIVE_SYSTEM_HEADER_DIR
@@ -918,6 +919,7 @@  with_multilib_list
 enable_rpath
 with_libiconv_prefix
 enable_sjlj_exceptions
+with_gcc_major_version_only
 enable_secureplt
 enable_leading_mingw64_underscores
 enable_cld
@@ -1721,6 +1723,8 @@  Optional Packages:
   --with-gnu-ld           assume the C compiler uses GNU ld default=no
   --with-libiconv-prefix[=DIR]  search for libiconv in DIR/include and DIR/lib
   --without-libiconv-prefix     don't search for libiconv in includedir and libdir
+  --with-gcc-major-version-only
+                          use only GCC major number in filesystem paths
   --with-pic              try to use only PIC/non-PIC objects [default=use
                           both]
   --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
@@ -11860,6 +11864,21 @@  static struct plugin_gcc_version gcc_ver
 						configuration_arguments};
 EOF
 
+# Determine what GCC version number to use in filesystem paths.
+
+  get_gcc_base_ver="cat"
+
+# Check whether --with-gcc-major-version-only was given.
+if test "${with_gcc_major_version_only+set}" = set; then :
+  withval=$with_gcc_major_version_only; if test x$with_gcc_major_version_only = xyes ; then
+        get_gcc_base_ver="sed -e 's/^\([0-9]*\).*\$\$/\1/'"
+      fi
+
+fi
+
+
+
+
 # Internationalization
 # If we haven't got the data from the intl directory,
 # assume NLS is disabled.
@@ -18414,7 +18433,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 18417 "configure"
+#line 18436 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -18520,7 +18539,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 18523 "configure"
+#line 18542 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
--- libada/configure.jj	2017-01-04 20:11:02.397150833 +0100
+++ libada/configure	2017-01-09 18:29:55.714935035 +0100
@@ -553,6 +553,7 @@  PACKAGE_URL=
 ac_unique_file="Makefile.in"
 ac_subst_vars='LTLIBOBJS
 LIBOBJS
+get_gcc_base_ver
 have_getipinfo
 default_gnatlib_target
 LN_S
@@ -633,6 +634,7 @@  enable_maintainer_mode
 enable_multilib
 enable_shared
 with_system_libunwind
+with_gcc_major_version_only
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1261,6 +1263,8 @@  Optional Packages:
   --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
   --with-build-libsubdir=DIR  Directory where to find libraries for build system
   --with-system-libunwind use installed libunwind
+  --with-gcc-major-version-only
+                          use only GCC major number in filesystem paths
 
 Some influential environment variables:
   CC          C compiler command
@@ -3008,6 +3012,21 @@  if test x$have_unwind_getipinfo = xyes;
 fi
 
 
+# Determine what GCC version number to use in filesystem paths.
+
+  get_gcc_base_ver="cat"
+
+# Check whether --with-gcc-major-version-only was given.
+if test "${with_gcc_major_version_only+set}" = set; then :
+  withval=$with_gcc_major_version_only; if test x$with_gcc_major_version_only = xyes ; then
+        get_gcc_base_ver="sed -e 's/^\([0-9]*\).*\$\$/\1/'"
+      fi
+
+fi
+
+
+
+
 # Output: create a Makefile.
 ac_config_files="$ac_config_files Makefile"
 
--- libatomic/testsuite/Makefile.in.jj	2014-09-25 15:01:36.733898215 +0200
+++ libatomic/testsuite/Makefile.in	2017-01-09 18:02:05.731318033 +0100
@@ -174,6 +174,7 @@  dvidir = @dvidir@
 enable_shared = @enable_shared@
 enable_static = @enable_static@
 exec_prefix = @exec_prefix@
+get_gcc_base_ver = @get_gcc_base_ver@
 host = @host@
 host_alias = @host_alias@
 host_cpu = @host_cpu@
--- libatomic/configure.jj	2016-11-16 16:38:07.544245670 +0100
+++ libatomic/configure	2017-01-09 18:29:56.385926456 +0100
@@ -601,6 +601,7 @@  ac_subst_vars='am__EXEEXT_FALSE
 am__EXEEXT_TRUE
 LTLIBOBJS
 LIBOBJS
+get_gcc_base_ver
 ARCH_X86_64_FALSE
 ARCH_X86_64_TRUE
 ARCH_I386_FALSE
@@ -763,6 +764,7 @@  with_gnu_ld
 enable_libtool_lock
 enable_maintainer_mode
 enable_symvers
+with_gcc_major_version_only
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1415,6 +1417,8 @@  Optional Packages:
   --with-pic              try to use only PIC/non-PIC objects [default=use
                           both]
   --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
+  --with-gcc-major-version-only
+                          use only GCC major number in filesystem paths
 
 Some influential environment variables:
   CC          C compiler command
@@ -11111,7 +11115,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11114 "configure"
+#line 11118 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11217,7 +11221,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11220 "configure"
+#line 11224 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -15256,6 +15260,21 @@  else
 fi
 
 
+# Determine what GCC version number to use in filesystem paths.
+
+  get_gcc_base_ver="cat"
+
+# Check whether --with-gcc-major-version-only was given.
+if test "${with_gcc_major_version_only+set}" = set; then :
+  withval=$with_gcc_major_version_only; if test x$with_gcc_major_version_only = xyes ; then
+        get_gcc_base_ver="sed -e 's/^\([0-9]*\).*\$\$/\1/'"
+      fi
+
+fi
+
+
+
+
 if test ${multilib} = yes; then
   multilib_arg="--enable-multilib"
 else
--- libatomic/Makefile.in.jj	2016-01-07 19:39:34.459218559 +0100
+++ libatomic/Makefile.in	2017-01-09 18:02:05.787317313 +0100
@@ -259,6 +259,7 @@  dvidir = @dvidir@
 enable_shared = @enable_shared@
 enable_static = @enable_static@
 exec_prefix = @exec_prefix@
+get_gcc_base_ver = @get_gcc_base_ver@
 host = @host@
 host_alias = @host_alias@
 host_cpu = @host_cpu@
@@ -298,7 +299,7 @@  top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 ACLOCAL_AMFLAGS = -I .. -I ../config
 SUBDIRS = testsuite
-gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
+gcc_version := $(shell @get_gcc_base_ver@ $(top_srcdir)/../gcc/BASE-VER)
 search_path = $(addprefix $(top_srcdir)/config/, $(config_path)) \
 	$(top_srcdir) $(top_builddir)
 
--- libcc1/configure.jj	2016-03-14 18:17:28.260906952 +0100
+++ libcc1/configure	2017-01-09 18:29:57.008918490 +0100
@@ -610,6 +610,7 @@  WERROR
 WARN_FLAGS
 CONFIG_STATUS_DEPENDENCIES
 gcc_version
+get_gcc_base_ver
 visibility
 CXXCPP
 am__fastdepCXX_FALSE
@@ -747,6 +748,7 @@  with_pic
 enable_fast_install
 with_gnu_ld
 enable_libtool_lock
+with_gcc_major_version_only
 enable_werror_always
 enable_plugin
 '
@@ -1403,6 +1405,8 @@  Optional Packages:
   --with-pic              try to use only PIC/non-PIC objects [default=use
                           both]
   --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
+  --with-gcc-major-version-only
+                          use only GCC major number in filesystem paths
 
 Some influential environment variables:
   CC          C compiler command
@@ -10540,7 +10544,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10543 "configure"
+#line 10547 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -10646,7 +10650,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10649 "configure"
+#line 10653 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -14305,7 +14309,25 @@  cat >>confdefs.h <<_ACEOF
 _ACEOF
 
 
-gcc_version=`cat $srcdir/../gcc/BASE-VER`
+
+  get_gcc_base_ver="cat"
+
+# Check whether --with-gcc-major-version-only was given.
+if test "${with_gcc_major_version_only+set}" = set; then :
+  withval=$with_gcc_major_version_only; if test x$with_gcc_major_version_only = xyes ; then
+        get_gcc_base_ver="sed -e 's/^\([0-9]*\).*\$\$/\1/'"
+      fi
+
+fi
+
+
+
+
+if test x$with_gcc_major_version_only = xyes ; then
+    gcc_version=`sed -e 's/^\([0-9]*\).*$/\1/' $srcdir/../gcc/BASE-VER`
+  else
+  gcc_version=`cat $srcdir/../gcc/BASE-VER`
+fi
 
 CONFIG_STATUS_DEPENDENCIES='$(top_srcdir)/../gcc/BASE-VER'
 
--- libcc1/Makefile.in.jj	2016-04-11 23:20:50.672784754 +0200
+++ libcc1/Makefile.in	2017-01-09 18:02:21.690112860 +0100
@@ -236,6 +236,7 @@  docdir = @docdir@
 dvidir = @dvidir@
 exec_prefix = @exec_prefix@
 gcc_version = @gcc_version@
+get_gcc_base_ver = @get_gcc_base_ver@
 host = @host@
 host_alias = @host_alias@
 host_cpu = @host_cpu@
--- libcilkrts/configure.jj	2016-12-02 13:22:00.432619952 +0100
+++ libcilkrts/configure	2017-01-09 18:29:57.636910460 +0100
@@ -604,6 +604,7 @@  ac_subst_vars='am__EXEEXT_FALSE
 am__EXEEXT_TRUE
 LTLIBOBJS
 LIBOBJS
+get_gcc_base_ver
 link_cilkrts
 XLDFLAGS
 XCFLAGS
@@ -749,6 +750,7 @@  with_pic
 enable_fast_install
 with_gnu_ld
 enable_libtool_lock
+with_gcc_major_version_only
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1404,6 +1406,8 @@  Optional Packages:
   --with-pic              try to use only PIC/non-PIC objects [default=use
                           both]
   --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
+  --with-gcc-major-version-only
+                          use only GCC major number in filesystem paths
 
 Some influential environment variables:
   CC          C compiler command
@@ -11937,7 +11941,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11940 "configure"
+#line 11944 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12043,7 +12047,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12046 "configure"
+#line 12050 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -15402,6 +15406,20 @@  else
 fi
 
 
+# Determine what GCC version number to use in filesystem paths.
+
+  get_gcc_base_ver="cat"
+
+# Check whether --with-gcc-major-version-only was given.
+if test "${with_gcc_major_version_only+set}" = set; then :
+  withval=$with_gcc_major_version_only; if test x$with_gcc_major_version_only = xyes ; then
+        get_gcc_base_ver="sed -e 's/^\([0-9]*\).*\$\$/\1/'"
+      fi
+
+fi
+
+
+
 
 # Must be last
 cat >confcache <<\_ACEOF
--- libcilkrts/Makefile.in.jj	2016-12-02 13:22:00.432619952 +0100
+++ libcilkrts/Makefile.in	2017-01-09 18:02:38.076902185 +0100
@@ -165,9 +165,10 @@  am__aclocal_m4_deps = $(top_srcdir)/../c
 	$(top_srcdir)/../config/lead-dot.m4 \
 	$(top_srcdir)/../config/multi.m4 \
 	$(top_srcdir)/../config/override.m4 \
-	$(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
-	$(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
-	$(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/configure.ac
+	$(top_srcdir)/../config/acx.m4 $(top_srcdir)/../libtool.m4 \
+	$(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
+	$(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
+	$(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
@@ -349,6 +350,7 @@  datarootdir = @datarootdir@
 docdir = @docdir@
 dvidir = @dvidir@
 exec_prefix = @exec_prefix@
+get_gcc_base_ver = @get_gcc_base_ver@
 host = @host@
 host_alias = @host_alias@
 host_cpu = @host_cpu@
@@ -406,7 +408,7 @@  AM_CPPFLAGS = $(GENERAL_FLAGS)
 AM_LDFLAGS = $(XLDFLAGS)
 
 # May be used by toolexeclibdir.
-gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
+gcc_version := $(shell @get_gcc_base_ver@ $(top_srcdir)/../gcc/BASE-VER)
 
 # Target list.
 nodist_toolexeclib_HEADERS = libcilkrts.spec
--- libgcc/configure.jj	2017-01-04 20:11:00.938169645 +0100
+++ libgcc/configure	2017-01-09 18:29:58.013905640 +0100
@@ -561,6 +561,7 @@  enable_execute_stack
 asm_hidden_op
 extra_parts
 cpu_type
+get_gcc_base_ver
 thread_header
 tm_defines
 tm_file
@@ -676,6 +677,7 @@  with_system_libunwind
 enable_explicit_exception_frame_registration
 with_glibc_version
 enable_tls
+with_gcc_major_version_only
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1330,6 +1332,8 @@  Optional Packages:
   --with-system-libunwind use installed libunwind
   --with-glibc-version=M.N
                           assume GCC used with glibc version M.N or later
+  --with-gcc-major-version-only
+                          use only GCC major number in filesystem paths
 
 Some influential environment variables:
   CC          C compiler command
@@ -5084,6 +5088,21 @@  esac
 
 
 
+# Determine what GCC version number to use in filesystem paths.
+
+  get_gcc_base_ver="cat"
+
+# Check whether --with-gcc-major-version-only was given.
+if test "${with_gcc_major_version_only+set}" = set; then :
+  withval=$with_gcc_major_version_only; if test x$with_gcc_major_version_only = xyes ; then
+        get_gcc_base_ver="sed -e 's/^\([0-9]*\).*\$\$/\1/'"
+      fi
+
+fi
+
+
+
+
 # Substitute configuration variables
 
 
--- libgfortran/configure.jj	2016-12-12 18:02:22.053118615 +0100
+++ libgfortran/configure	2017-01-09 18:29:58.856894862 +0100
@@ -605,6 +605,7 @@  ac_subst_vars='am__EXEEXT_FALSE
 am__EXEEXT_TRUE
 LTLIBOBJS
 LIBOBJS
+get_gcc_base_ver
 IEEE_FLAGS
 IEEE_SUPPORT
 IEEE_SUPPORT_FALSE
@@ -779,6 +780,7 @@  enable_fast_install
 enable_libtool_lock
 enable_largefile
 enable_libquadmath_support
+with_gcc_major_version_only
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1437,6 +1439,8 @@  Optional Packages:
   --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
   --with-pic              try to use only PIC/non-PIC objects [default=use
                           both]
+  --with-gcc-major-version-only
+                          use only GCC major number in filesystem paths
 
 Some influential environment variables:
   CC          C compiler command
@@ -12417,7 +12421,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12420 "configure"
+#line 12424 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12523,7 +12527,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12526 "configure"
+#line 12530 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -26315,6 +26319,21 @@  rm -f core conftest.err conftest.$ac_obj
   CFLAGS="$ac_save_CFLAGS"
 
 
+# Determine what GCC version number to use in filesystem paths.
+
+  get_gcc_base_ver="cat"
+
+# Check whether --with-gcc-major-version-only was given.
+if test "${with_gcc_major_version_only+set}" = set; then :
+  withval=$with_gcc_major_version_only; if test x$with_gcc_major_version_only = xyes ; then
+        get_gcc_base_ver="sed -e 's/^\([0-9]*\).*\$\$/\1/'"
+      fi
+
+fi
+
+
+
+
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
 # tests run on this system so they can be shared between configure
--- libgfortran/Makefile.in.jj	2016-12-20 17:54:21.082169019 +0100
+++ libgfortran/Makefile.in	2017-01-09 18:03:36.688148654 +0100
@@ -525,6 +525,7 @@  enable_shared = @enable_shared@
 enable_static = @enable_static@
 exec_prefix = @exec_prefix@
 extra_ldflags_libgfortran = @extra_ldflags_libgfortran@
+get_gcc_base_ver = @get_gcc_base_ver@
 host = @host@
 host_alias = @host_alias@
 host_cpu = @host_cpu@
@@ -566,7 +567,7 @@  top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 ACLOCAL_AMFLAGS = -I .. -I ../config
-gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
+gcc_version := $(shell @get_gcc_base_ver@ $(top_srcdir)/../gcc/BASE-VER)
 @LIBGFOR_USE_SYMVER_FALSE@version_arg = 
 @LIBGFOR_USE_SYMVER_GNU_TRUE@@LIBGFOR_USE_SYMVER_TRUE@version_arg = -Wl,--version-script=$(srcdir)/gfortran.map
 @LIBGFOR_USE_SYMVER_SUN_TRUE@@LIBGFOR_USE_SYMVER_TRUE@version_arg = -Wl,-M,gfortran.map-sun
--- libgomp/testsuite/Makefile.in.jj	2016-12-02 13:21:59.276634718 +0100
+++ libgomp/testsuite/Makefile.in	2017-01-09 18:07:06.378455270 +0100
@@ -201,6 +201,7 @@  dvidir = @dvidir@
 enable_shared = @enable_shared@
 enable_static = @enable_static@
 exec_prefix = @exec_prefix@
+get_gcc_base_ver = @get_gcc_base_ver@
 host = @host@
 host_alias = @host_alias@
 host_cpu = @host_cpu@
--- libgomp/configure.jj	2016-12-02 13:21:59.430632751 +0100
+++ libgomp/configure	2017-01-09 18:29:59.523886333 +0100
@@ -603,6 +603,7 @@  ac_subst_vars='am__EXEEXT_FALSE
 am__EXEEXT_TRUE
 LTLIBOBJS
 LIBOBJS
+get_gcc_base_ver
 OMP_NEST_LOCK_25_KIND
 OMP_LOCK_25_KIND
 OMP_NEST_LOCK_25_ALIGN
@@ -798,6 +799,7 @@  with_hsa_runtime_lib
 enable_linux_futex
 enable_tls
 enable_symvers
+with_gcc_major_version_only
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1476,6 +1478,8 @@  Optional Packages:
   --with-hsa-runtime-lib=PATH
                           specify directory for the installed HSA run-time
                           library
+  --with-gcc-major-version-only
+                          use only GCC major number in filesystem paths
 
 Some influential environment variables:
   CC          C compiler command
@@ -11151,7 +11155,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11154 "configure"
+#line 11158 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11257,7 +11261,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11260 "configure"
+#line 11264 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -15135,7 +15139,7 @@  fi
 
 # Plugins for offload execution, configure.ac fragment.  -*- mode: autoconf -*-
 #
-# Copyright (C) 2014-2016 Free Software Foundation, Inc.
+# Copyright (C) 2014-2017 Free Software Foundation, Inc.
 #
 # Contributed by Mentor Embedded.
 #
@@ -16796,6 +16800,21 @@  fi
 
 CFLAGS="$save_CFLAGS"
 
+# Determine what GCC version number to use in filesystem paths.
+
+  get_gcc_base_ver="cat"
+
+# Check whether --with-gcc-major-version-only was given.
+if test "${with_gcc_major_version_only+set}" = set; then :
+  withval=$with_gcc_major_version_only; if test x$with_gcc_major_version_only = xyes ; then
+        get_gcc_base_ver="sed -e 's/^\([0-9]*\).*\$\$/\1/'"
+      fi
+
+fi
+
+
+
+
 ac_config_files="$ac_config_files omp.h omp_lib.h omp_lib.f90 libgomp_f.h"
 
 ac_config_files="$ac_config_files Makefile testsuite/Makefile libgomp.spec"
--- libgomp/Makefile.in.jj	2016-12-02 13:21:59.273634756 +0100
+++ libgomp/Makefile.in	2017-01-09 18:07:06.451454336 +0100
@@ -17,7 +17,7 @@ 
 
 # Plugins for offload execution, Makefile.am fragment.
 #
-# Copyright (C) 2014-2016 Free Software Foundation, Inc.
+# Copyright (C) 2014-2017 Free Software Foundation, Inc.
 #
 # Contributed by Mentor Embedded.
 #
@@ -358,6 +358,7 @@  dvidir = @dvidir@
 enable_shared = @enable_shared@
 enable_static = @enable_static@
 exec_prefix = @exec_prefix@
+get_gcc_base_ver = @get_gcc_base_ver@
 host = @host@
 host_alias = @host_alias@
 host_cpu = @host_cpu@
@@ -401,7 +402,7 @@  top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 ACLOCAL_AMFLAGS = -I .. -I ../config
 SUBDIRS = testsuite
-gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
+gcc_version := $(shell @get_gcc_base_ver@ $(top_srcdir)/../gcc/BASE-VER)
 search_path = $(addprefix $(top_srcdir)/config/, $(config_path)) $(top_srcdir) \
 	      $(top_srcdir)/../include
 
--- libitm/testsuite/Makefile.in.jj	2017-01-04 20:10:59.916182798 +0100
+++ libitm/testsuite/Makefile.in	2017-01-09 18:07:24.242226651 +0100
@@ -185,6 +185,7 @@  dvidir = @dvidir@
 enable_shared = @enable_shared@
 enable_static = @enable_static@
 exec_prefix = @exec_prefix@
+get_gcc_base_ver = @get_gcc_base_ver@
 host = @host@
 host_alias = @host_alias@
 host_cpu = @host_cpu@
--- libitm/configure.jj	2016-11-16 16:38:06.433259632 +0100
+++ libitm/configure	2017-01-09 18:30:00.231877281 +0100
@@ -601,6 +601,7 @@  ac_subst_vars='am__EXEEXT_FALSE
 am__EXEEXT_TRUE
 LTLIBOBJS
 LIBOBJS
+get_gcc_base_ver
 ARCH_FUTEX_FALSE
 ARCH_FUTEX_TRUE
 ARCH_X86_AVX_FALSE
@@ -776,6 +777,7 @@  enable_maintainer_mode
 enable_linux_futex
 enable_tls
 enable_symvers
+with_gcc_major_version_only
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1431,6 +1433,8 @@  Optional Packages:
   --with-pic              try to use only PIC/non-PIC objects [default=use
                           both]
   --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
+  --with-gcc-major-version-only
+                          use only GCC major number in filesystem paths
 
 Some influential environment variables:
   CC          C compiler command
@@ -11790,7 +11794,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11793 "configure"
+#line 11797 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11896,7 +11900,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11899 "configure"
+#line 11903 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -17636,6 +17640,21 @@  else
 fi
 
 
+# Determine what GCC version number to use in filesystem paths.
+
+  get_gcc_base_ver="cat"
+
+# Check whether --with-gcc-major-version-only was given.
+if test "${with_gcc_major_version_only+set}" = set; then :
+  withval=$with_gcc_major_version_only; if test x$with_gcc_major_version_only = xyes ; then
+        get_gcc_base_ver="sed -e 's/^\([0-9]*\).*\$\$/\1/'"
+      fi
+
+fi
+
+
+
+
 ac_config_files="$ac_config_files Makefile testsuite/Makefile libitm.spec"
 
 cat >confcache <<\_ACEOF
--- libitm/Makefile.in.jj	2017-01-04 20:10:59.916182798 +0100
+++ libitm/Makefile.in	2017-01-09 18:07:24.309225793 +0100
@@ -293,6 +293,7 @@  dvidir = @dvidir@
 enable_shared = @enable_shared@
 enable_static = @enable_static@
 exec_prefix = @exec_prefix@
+get_gcc_base_ver = @get_gcc_base_ver@
 host = @host@
 host_alias = @host_alias@
 host_cpu = @host_cpu@
@@ -332,7 +333,7 @@  top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 ACLOCAL_AMFLAGS = -I .. -I ../config
 SUBDIRS = testsuite
-gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
+gcc_version := $(shell @get_gcc_base_ver@ $(top_srcdir)/../gcc/BASE-VER)
 abi_version = -fabi-version=4
 search_path = $(addprefix $(top_srcdir)/config/, $(config_path)) $(top_srcdir)
 fincludedir = $(libdir)/gcc/$(target_alias)/$(gcc_version)/finclude
--- libmpx/configure.jj	2016-11-16 16:38:06.776255322 +0100
+++ libmpx/configure	2017-01-09 18:30:00.780870261 +0100
@@ -11585,6 +11585,9 @@  else
   multilib_arg=
 fi
 
+# Determine what GCC version number to use in filesystem paths.
+GCC_BASE_VER
+
 ac_config_files="$ac_config_files Makefile libmpx.spec"
 
 ac_config_headers="$ac_config_headers config.h"
--- libmpx/Makefile.in.jj	2015-12-11 17:48:47.466972919 +0100
+++ libmpx/Makefile.in	2017-01-09 18:07:35.213086246 +0100
@@ -255,7 +255,7 @@  top_srcdir = @top_srcdir@
 ACLOCAL_AMFLAGS = -I .. -I ../config
 @LIBMPX_SUPPORTED_TRUE@SUBDIRS = mpxrt $(am__append_1)
 @LIBMPX_SUPPORTED_TRUE@nodist_toolexeclib_HEADERS = libmpx.spec
-gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
+gcc_version := $(shell @get_gcc_base_ver@ $(top_srcdir)/../gcc/BASE-VER)
 
 # Work around what appears to be a GNU make bug handling MAKEFLAGS
 # values defined in terms of make variables, as is the case for CC and
--- libobjc/configure.jj	2016-12-02 13:22:00.405620297 +0100
+++ libobjc/configure	2017-01-09 18:30:01.331863216 +0100
@@ -600,6 +600,7 @@  ac_includes_default="\
 
 ac_subst_vars='LTLIBOBJS
 LIBOBJS
+get_gcc_base_ver
 OBJC_BOEHM_GC_LIBS
 OBJC_BOEHM_GC_INCLUDES
 OBJC_BOEHM_GC
@@ -725,6 +726,7 @@  enable_objc_gc
 with_target_bdw_gc
 with_target_bdw_gc_include
 with_target_bdw_gc_lib
+with_gcc_major_version_only
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1379,6 +1381,8 @@  Optional Packages:
                           files
   --with-target-bdw-gc-lib=PATHLIST
                           specify directories for installed bdw-gc library
+  --with-gcc-major-version-only
+                          use only GCC major number in filesystem paths
 
 Some influential environment variables:
   CC          C compiler command
@@ -10590,7 +10594,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10593 "configure"
+#line 10597 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -10696,7 +10700,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10699 "configure"
+#line 10703 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11683,6 +11687,21 @@  fi
 
 
 
+
+# Determine what GCC version number to use in filesystem paths.
+
+  get_gcc_base_ver="cat"
+
+# Check whether --with-gcc-major-version-only was given.
+if test "${with_gcc_major_version_only+set}" = set; then :
+  withval=$with_gcc_major_version_only; if test x$with_gcc_major_version_only = xyes ; then
+        get_gcc_base_ver="sed -e 's/^\([0-9]*\).*\$\$/\1/'"
+      fi
+
+fi
+
+
+
 
 # ------
 # Output
--- liboffloadmic/configure.jj	2016-11-16 16:38:06.680256528 +0100
+++ liboffloadmic/configure	2017-01-09 18:30:01.941855417 +0100
@@ -602,6 +602,7 @@  ac_subst_vars='am__EXEEXT_FALSE
 am__EXEEXT_TRUE
 LTLIBOBJS
 LIBOBJS
+get_gcc_base_ver
 link_offloadmic_target
 link_offloadmic_host
 lt_cv_dlopen_libs
@@ -744,6 +745,7 @@  with_pic
 enable_fast_install
 with_gnu_ld
 enable_libtool_lock
+with_gcc_major_version_only
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1398,6 +1400,8 @@  Optional Packages:
   --with-pic              try to use only PIC/non-PIC objects [default=use
                           both]
   --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
+  --with-gcc-major-version-only
+                          use only GCC major number in filesystem paths
 
 Some influential environment variables:
   CC          C compiler command
@@ -11104,7 +11108,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11107 "configure"
+#line 11111 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11210,7 +11214,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11213 "configure"
+#line 11217 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -14481,6 +14485,21 @@  fi
 
 
 
+# Determine what GCC version number to use in filesystem paths.
+
+  get_gcc_base_ver="cat"
+
+# Check whether --with-gcc-major-version-only was given.
+if test "${with_gcc_major_version_only+set}" = set; then :
+  withval=$with_gcc_major_version_only; if test x$with_gcc_major_version_only = xyes ; then
+        get_gcc_base_ver="sed -e 's/^\([0-9]*\).*\$\$/\1/'"
+      fi
+
+fi
+
+
+
+
 # Must be last
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
@@ -17075,7 +17094,7 @@  ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_
       ac_sub_configure=$ac_srcdir/configure.gnu
     elif test -f "$ac_srcdir/configure"; then
       ac_sub_configure=$ac_srcdir/configure
-    elif test -f "$ac_srcdir/configure.ac"; then
+    elif test -f "$ac_srcdir/configure.in"; then
       # This should be Cygnus configure.
       ac_sub_configure=$ac_aux_dir/configure
     else
--- liboffloadmic/Makefile.in.jj	2016-07-22 15:02:01.554884281 +0200
+++ liboffloadmic/Makefile.in	2017-01-09 18:07:56.380815343 +0100
@@ -93,9 +93,10 @@  am__aclocal_m4_deps = $(top_srcdir)/../c
 	$(top_srcdir)/../config/lead-dot.m4 \
 	$(top_srcdir)/../config/multi.m4 \
 	$(top_srcdir)/../config/override.m4 \
-	$(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
-	$(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
-	$(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/configure.ac
+	$(top_srcdir)/../config/acx.m4 $(top_srcdir)/../libtool.m4 \
+	$(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
+	$(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
+	$(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
@@ -336,6 +337,7 @@  datarootdir = @datarootdir@
 docdir = @docdir@
 dvidir = @dvidir@
 exec_prefix = @exec_prefix@
+get_gcc_base_ver = @get_gcc_base_ver@
 host = @host@
 host_alias = @host_alias@
 host_cpu = @host_cpu@
@@ -388,7 +390,7 @@  libgomp_dir = $(build_dir)/../libgomp
 source_dir = $(top_srcdir)/runtime
 
 # May be used by toolexeclibdir.
-gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
+gcc_version := $(shell @get_gcc_base_ver@ $(top_srcdir)/../gcc/BASE-VER)
 libsubincludedir = $(libdir)/gcc/$(target_alias)/$(gcc_version)/include
 @LIBOFFLOADMIC_HOST_FALSE@nodist_toolexeclib_HEADERS = liboffloadmic_target.spec
 
--- libquadmath/configure.jj	2016-11-16 16:38:06.793255108 +0100
+++ libquadmath/configure	2017-01-09 18:30:02.543847720 +0100
@@ -601,6 +601,7 @@  ac_subst_vars='am__EXEEXT_FALSE
 am__EXEEXT_TRUE
 LTLIBOBJS
 LIBOBJS
+get_gcc_base_ver
 GENINSRC_FALSE
 GENINSRC_TRUE
 BUILD_LIBQUADMATH_FALSE
@@ -750,6 +751,7 @@  enable_libtool_lock
 enable_maintainer_mode
 enable_symvers
 enable_generated_files_in_srcdir
+with_gcc_major_version_only
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1406,6 +1408,8 @@  Optional Packages:
   --with-pic              try to use only PIC/non-PIC objects [default=use
                           both]
   --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
+  --with-gcc-major-version-only
+                          use only GCC major number in filesystem paths
 
 Some influential environment variables:
   CC          C compiler command
@@ -10568,7 +10572,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10571 "configure"
+#line 10575 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -10674,7 +10678,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10677 "configure"
+#line 10681 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12918,6 +12922,20 @@  else
 fi
 
 
+# Determine what GCC version number to use in filesystem paths.
+
+  get_gcc_base_ver="cat"
+
+# Check whether --with-gcc-major-version-only was given.
+if test "${with_gcc_major_version_only+set}" = set; then :
+  withval=$with_gcc_major_version_only; if test x$with_gcc_major_version_only = xyes ; then
+        get_gcc_base_ver="sed -e 's/^\([0-9]*\).*\$\$/\1/'"
+      fi
+
+fi
+
+
+
 
 ac_config_files="$ac_config_files Makefile"
 
--- libquadmath/Makefile.in.jj	2015-09-03 17:28:49.468703711 +0200
+++ libquadmath/Makefile.in	2017-01-09 18:08:06.507685740 +0100
@@ -300,6 +300,7 @@  dvidir = @dvidir@
 enable_shared = @enable_shared@
 enable_static = @enable_static@
 exec_prefix = @exec_prefix@
+get_gcc_base_ver = @get_gcc_base_ver@
 host = @host@
 host_alias = @host_alias@
 host_cpu = @host_cpu@
@@ -340,7 +341,7 @@  top_srcdir = @top_srcdir@
 AUTOMAKE_OPTIONS = 1.8 foreign
 @BUILD_LIBQUADMATH_TRUE@ACLOCAL_AMFLAGS = -I .. -I ../config
 @BUILD_LIBQUADMATH_TRUE@AM_CPPFLAGS = -I $(top_srcdir)/../include
-@BUILD_LIBQUADMATH_TRUE@gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
+@BUILD_LIBQUADMATH_TRUE@gcc_version := $(shell @get_gcc_base_ver@ $(top_srcdir)/../gcc/BASE-VER)
 @BUILD_LIBQUADMATH_TRUE@@LIBQUAD_USE_SYMVER_FALSE@version_arg = 
 @BUILD_LIBQUADMATH_TRUE@@LIBQUAD_USE_SYMVER_GNU_TRUE@@LIBQUAD_USE_SYMVER_TRUE@version_arg = -Wl,--version-script=$(srcdir)/quadmath.map
 @BUILD_LIBQUADMATH_TRUE@@LIBQUAD_USE_SYMVER_SUN_TRUE@@LIBQUAD_USE_SYMVER_TRUE@version_arg = -Wl,-M,quadmath.map-sun
--- libsanitizer/libbacktrace/Makefile.in.jj	2016-11-09 18:26:31.072864480 +0100
+++ libsanitizer/libbacktrace/Makefile.in	2017-01-09 18:08:15.218574259 +0100
@@ -245,6 +245,7 @@  dvidir = @dvidir@
 enable_shared = @enable_shared@
 enable_static = @enable_static@
 exec_prefix = @exec_prefix@
+get_gcc_base_ver = @get_gcc_base_ver@
 host = @host@
 host_alias = @host_alias@
 host_cpu = @host_cpu@
--- libsanitizer/interception/Makefile.in.jj	2016-11-09 18:26:30.797867933 +0100
+++ libsanitizer/interception/Makefile.in	2017-01-09 18:08:15.160575001 +0100
@@ -203,6 +203,7 @@  dvidir = @dvidir@
 enable_shared = @enable_shared@
 enable_static = @enable_static@
 exec_prefix = @exec_prefix@
+get_gcc_base_ver = @get_gcc_base_ver@
 host = @host@
 host_alias = @host_alias@
 host_cpu = @host_cpu@
--- libsanitizer/asan/Makefile.in.jj	2016-11-09 18:26:30.627870067 +0100
+++ libsanitizer/asan/Makefile.in	2017-01-09 18:08:15.124575462 +0100
@@ -254,6 +254,7 @@  dvidir = @dvidir@
 enable_shared = @enable_shared@
 enable_static = @enable_static@
 exec_prefix = @exec_prefix@
+get_gcc_base_ver = @get_gcc_base_ver@
 host = @host@
 host_alias = @host_alias@
 host_cpu = @host_cpu@
--- libsanitizer/ubsan/Makefile.in.jj	2016-11-09 18:26:31.110864003 +0100
+++ libsanitizer/ubsan/Makefile.in	2017-01-09 18:08:15.327572864 +0100
@@ -242,6 +242,7 @@  dvidir = @dvidir@
 enable_shared = @enable_shared@
 enable_static = @enable_static@
 exec_prefix = @exec_prefix@
+get_gcc_base_ver = @get_gcc_base_ver@
 host = @host@
 host_alias = @host_alias@
 host_cpu = @host_cpu@
--- libsanitizer/configure.jj	2016-11-16 16:38:06.822254744 +0100
+++ libsanitizer/configure	2017-01-09 18:30:03.200839319 +0100
@@ -604,6 +604,7 @@  ac_subst_vars='am__EXEEXT_FALSE
 am__EXEEXT_TRUE
 LTLIBOBJS
 LIBOBJS
+get_gcc_base_ver
 SANITIZER_COMMON_TARGET_DEPENDENT_OBJECTS
 TSAN_TARGET_DEPENDENT_OBJECTS
 LIBBACKTRACE_SUPPORTED_FALSE
@@ -772,6 +773,7 @@  with_pic
 enable_fast_install
 with_gnu_ld
 enable_libtool_lock
+with_gcc_major_version_only
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1426,6 +1428,8 @@  Optional Packages:
   --with-pic              try to use only PIC/non-PIC objects [default=use
                           both]
   --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
+  --with-gcc-major-version-only
+                          use only GCC major number in filesystem paths
 
 Some influential environment variables:
   CC          C compiler command
@@ -12028,7 +12032,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12031 "configure"
+#line 12035 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12134,7 +12138,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12137 "configure"
+#line 12141 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -16497,6 +16501,21 @@  if test "x$TSAN_SUPPORTED" = "xyes"; the
 
 fi
 
+
+
+
+# Determine what GCC version number to use in filesystem paths.
+
+  get_gcc_base_ver="cat"
+
+# Check whether --with-gcc-major-version-only was given.
+if test "${with_gcc_major_version_only+set}" = set; then :
+  withval=$with_gcc_major_version_only; if test x$with_gcc_major_version_only = xyes ; then
+        get_gcc_base_ver="sed -e 's/^\([0-9]*\).*\$\$/\1/'"
+      fi
+
+fi
+
 
 
 
--- libsanitizer/sanitizer_common/Makefile.in.jj	2016-11-09 18:26:30.289874310 +0100
+++ libsanitizer/sanitizer_common/Makefile.in	2017-01-09 18:08:15.275573529 +0100
@@ -247,6 +247,7 @@  dvidir = @dvidir@
 enable_shared = @enable_shared@
 enable_static = @enable_static@
 exec_prefix = @exec_prefix@
+get_gcc_base_ver = @get_gcc_base_ver@
 host = @host@
 host_alias = @host_alias@
 host_cpu = @host_cpu@
--- libsanitizer/lsan/Makefile.in.jj	2016-11-09 18:26:30.775868209 +0100
+++ libsanitizer/lsan/Makefile.in	2017-01-09 18:08:15.247573888 +0100
@@ -244,6 +244,7 @@  dvidir = @dvidir@
 enable_shared = @enable_shared@
 enable_static = @enable_static@
 exec_prefix = @exec_prefix@
+get_gcc_base_ver = @get_gcc_base_ver@
 host = @host@
 host_alias = @host_alias@
 host_cpu = @host_cpu@
--- libsanitizer/Makefile.in.jj	2016-11-09 18:26:30.626870079 +0100
+++ libsanitizer/Makefile.in	2017-01-09 18:08:15.350572569 +0100
@@ -244,6 +244,7 @@  dvidir = @dvidir@
 enable_shared = @enable_shared@
 enable_static = @enable_static@
 exec_prefix = @exec_prefix@
+get_gcc_base_ver = @get_gcc_base_ver@
 host = @host@
 host_alias = @host_alias@
 host_cpu = @host_cpu@
@@ -290,7 +291,7 @@  nodist_saninclude_HEADERS = $(am__append
 @SANITIZER_SUPPORTED_TRUE@SUBDIRS = sanitizer_common $(am__append_2) \
 @SANITIZER_SUPPORTED_TRUE@	$(am__append_3) lsan asan ubsan \
 @SANITIZER_SUPPORTED_TRUE@	$(am__append_4)
-gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
+gcc_version := $(shell @get_gcc_base_ver@ $(top_srcdir)/../gcc/BASE-VER)
 
 # Work around what appears to be a GNU make bug handling MAKEFLAGS
 # values defined in terms of make variables, as is the case for CC and
--- libsanitizer/tsan/Makefile.in.jj	2016-11-09 18:26:31.048864781 +0100
+++ libsanitizer/tsan/Makefile.in	2017-01-09 18:08:15.304573158 +0100
@@ -263,6 +263,7 @@  dvidir = @dvidir@
 enable_shared = @enable_shared@
 enable_static = @enable_static@
 exec_prefix = @exec_prefix@
+get_gcc_base_ver = @get_gcc_base_ver@
 host = @host@
 host_alias = @host_alias@
 host_cpu = @host_cpu@
--- libssp/configure.jj	2016-11-16 16:38:08.528233304 +0100
+++ libssp/configure	2017-01-09 18:30:03.739832428 +0100
@@ -602,6 +602,7 @@  ac_subst_vars='am__EXEEXT_FALSE
 am__EXEEXT_TRUE
 LTLIBOBJS
 LIBOBJS
+get_gcc_base_ver
 toolexeclibdir
 toolexecdir
 enable_static
@@ -742,6 +743,7 @@  with_pic
 enable_fast_install
 with_gnu_ld
 enable_libtool_lock
+with_gcc_major_version_only
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1387,6 +1389,8 @@  Optional Packages:
   --with-pic              try to use only PIC/non-PIC objects [default=use
                           both]
   --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
+  --with-gcc-major-version-only
+                          use only GCC major number in filesystem paths
 
 Some influential environment variables:
   CC          C compiler command
@@ -10667,7 +10671,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10670 "configure"
+#line 10674 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -10773,7 +10777,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10776 "configure"
+#line 10780 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11071,6 +11075,21 @@  else
   multilib_arg=
 fi
 
+# Determine what GCC version number to use in filesystem paths.
+
+  get_gcc_base_ver="cat"
+
+# Check whether --with-gcc-major-version-only was given.
+if test "${with_gcc_major_version_only+set}" = set; then :
+  withval=$with_gcc_major_version_only; if test x$with_gcc_major_version_only = xyes ; then
+        get_gcc_base_ver="sed -e 's/^\([0-9]*\).*\$\$/\1/'"
+      fi
+
+fi
+
+
+
+
 ac_config_files="$ac_config_files Makefile ssp/ssp.h"
 
 cat >confcache <<\_ACEOF
--- libssp/Makefile.in.jj	2015-05-13 16:37:01.447777035 +0200
+++ libssp/Makefile.in	2017-01-09 18:08:23.430469164 +0100
@@ -235,6 +235,7 @@  dvidir = @dvidir@
 enable_shared = @enable_shared@
 enable_static = @enable_static@
 exec_prefix = @exec_prefix@
+get_gcc_base_ver = @get_gcc_base_ver@
 host = @host@
 host_alias = @host_alias@
 host_cpu = @host_cpu@
@@ -278,7 +279,7 @@  ACLOCAL_AMFLAGS = -I .. -I ../config
 MAINT_CHARSET = latin1
 
 # May be used by various substitution variables.
-gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
+gcc_version := $(shell @get_gcc_base_ver@ $(top_srcdir)/../gcc/BASE-VER)
 @LIBSSP_USE_SYMVER_FALSE@version_arg = 
 @LIBSSP_USE_SYMVER_GNU_TRUE@@LIBSSP_USE_SYMVER_TRUE@version_arg = -Wl,--version-script=$(srcdir)/ssp.map
 @LIBSSP_USE_SYMVER_SUN_TRUE@@LIBSSP_USE_SYMVER_TRUE@version_arg = -Wl,-M,ssp.map-sun
--- libstdc++-v3/po/Makefile.in.jj	2017-01-06 16:58:42.302612320 +0100
+++ libstdc++-v3/po/Makefile.in	2017-01-09 18:08:36.463302370 +0100
@@ -234,6 +234,7 @@  dvidir = @dvidir@
 enable_shared = @enable_shared@
 enable_static = @enable_static@
 exec_prefix = @exec_prefix@
+get_gcc_base_ver = @get_gcc_base_ver@
 glibcxx_MOFILES = @glibcxx_MOFILES@
 glibcxx_PCHFLAGS = @glibcxx_PCHFLAGS@
 glibcxx_POFILES = @glibcxx_POFILES@
@@ -290,7 +291,7 @@  toplevel_builddir = @toplevel_builddir@
 toplevel_srcdir = @toplevel_srcdir@
 
 # May be used by various substitution variables.
-gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
+gcc_version := $(shell @get_gcc_base_ver@ $(top_srcdir)/../gcc/BASE-VER)
 MAINT_CHARSET = latin1
 mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs
 PWD_COMMAND = $${PWDCMD-pwd}
--- libstdc++-v3/libsupc++/Makefile.in.jj	2017-01-06 16:58:42.326612004 +0100
+++ libstdc++-v3/libsupc++/Makefile.in	2017-01-09 18:08:36.440302665 +0100
@@ -307,6 +307,7 @@  dvidir = @dvidir@
 enable_shared = @enable_shared@
 enable_static = @enable_static@
 exec_prefix = @exec_prefix@
+get_gcc_base_ver = @get_gcc_base_ver@
 glibcxx_MOFILES = @glibcxx_MOFILES@
 glibcxx_PCHFLAGS = @glibcxx_PCHFLAGS@
 glibcxx_POFILES = @glibcxx_POFILES@
@@ -363,7 +364,7 @@  toplevel_builddir = @toplevel_builddir@
 toplevel_srcdir = @toplevel_srcdir@
 
 # May be used by various substitution variables.
-gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
+gcc_version := $(shell @get_gcc_base_ver@ $(top_srcdir)/../gcc/BASE-VER)
 MAINT_CHARSET = latin1
 mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs
 PWD_COMMAND = $${PWDCMD-pwd}
--- libstdc++-v3/testsuite/Makefile.in.jj	2017-01-06 16:58:42.334611898 +0100
+++ libstdc++-v3/testsuite/Makefile.in	2017-01-09 18:08:36.633300195 +0100
@@ -234,6 +234,7 @@  dvidir = @dvidir@
 enable_shared = @enable_shared@
 enable_static = @enable_static@
 exec_prefix = @exec_prefix@
+get_gcc_base_ver = @get_gcc_base_ver@
 glibcxx_MOFILES = @glibcxx_MOFILES@
 glibcxx_PCHFLAGS = @glibcxx_PCHFLAGS@
 glibcxx_POFILES = @glibcxx_POFILES@
@@ -293,7 +294,7 @@  RUNTESTDEFAULTFLAGS = --tool $$tool --sr
 EXPECT = expect
 
 # May be used by various substitution variables.
-gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
+gcc_version := $(shell @get_gcc_base_ver@ $(top_srcdir)/../gcc/BASE-VER)
 MAINT_CHARSET = latin1
 mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs
 PWD_COMMAND = $${PWDCMD-pwd}
--- libstdc++-v3/src/Makefile.in.jj	2017-01-06 16:58:42.154614275 +0100
+++ libstdc++-v3/src/Makefile.in	2017-01-09 18:08:36.520301641 +0100
@@ -297,6 +297,7 @@  dvidir = @dvidir@
 enable_shared = @enable_shared@
 enable_static = @enable_static@
 exec_prefix = @exec_prefix@
+get_gcc_base_ver = @get_gcc_base_ver@
 glibcxx_MOFILES = @glibcxx_MOFILES@
 glibcxx_PCHFLAGS = @glibcxx_PCHFLAGS@
 glibcxx_POFILES = @glibcxx_POFILES@
@@ -353,7 +354,7 @@  toplevel_builddir = @toplevel_builddir@
 toplevel_srcdir = @toplevel_srcdir@
 
 # May be used by various substitution variables.
-gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
+gcc_version := $(shell @get_gcc_base_ver@ $(top_srcdir)/../gcc/BASE-VER)
 MAINT_CHARSET = latin1
 mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs
 PWD_COMMAND = $${PWDCMD-pwd}
--- libstdc++-v3/configure.jj	2017-01-09 16:47:09.670672076 +0100
+++ libstdc++-v3/configure	2017-01-09 18:30:07.173788521 +0100
@@ -602,6 +602,7 @@  ac_subst_vars='am__EXEEXT_FALSE
 am__EXEEXT_TRUE
 LTLIBOBJS
 LIBOBJS
+get_gcc_base_ver
 WARN_FLAGS
 OPTIMIZE_CXXFLAGS
 TOPLEVEL_INCLUDES
@@ -897,6 +898,7 @@  enable_libstdcxx_threads
 enable_libstdcxx_filesystem_ts
 with_gxx_include_dir
 enable_version_specific_runtime_libs
+with_gcc_major_version_only
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1616,6 +1618,8 @@  Optional Packages:
                           set the std::string ABI to use by default
   --with-gxx-include-dir=DIR
                           installation directory for include files
+  --with-gcc-major-version-only
+                          use only GCC major number in filesystem paths
 
 Some influential environment variables:
   CC          C compiler command
@@ -11597,7 +11601,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11600 "configure"
+#line 11604 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11703,7 +11707,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11706 "configure"
+#line 11710 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -15389,7 +15393,7 @@  $as_echo "$glibcxx_cv_atomic_long_long"
   # Fake what AC_TRY_COMPILE does.
 
     cat > conftest.$ac_ext << EOF
-#line 15392 "configure"
+#line 15396 "configure"
 int main()
 {
   typedef bool atomic_type;
@@ -15424,7 +15428,7 @@  $as_echo "$glibcxx_cv_atomic_bool" >&6;
     rm -f conftest*
 
     cat > conftest.$ac_ext << EOF
-#line 15427 "configure"
+#line 15431 "configure"
 int main()
 {
   typedef short atomic_type;
@@ -15459,7 +15463,7 @@  $as_echo "$glibcxx_cv_atomic_short" >&6;
     rm -f conftest*
 
     cat > conftest.$ac_ext << EOF
-#line 15462 "configure"
+#line 15466 "configure"
 int main()
 {
   // NB: _Atomic_word not necessarily int.
@@ -15495,7 +15499,7 @@  $as_echo "$glibcxx_cv_atomic_int" >&6; }
     rm -f conftest*
 
     cat > conftest.$ac_ext << EOF
-#line 15498 "configure"
+#line 15502 "configure"
 int main()
 {
   typedef long long atomic_type;
@@ -15576,7 +15580,7 @@  $as_echo "$as_me: WARNING: Performance o
   # unnecessary for this test.
 
     cat > conftest.$ac_ext << EOF
-#line 15579 "configure"
+#line 15583 "configure"
 int main()
 {
   _Decimal32 d1;
@@ -15618,7 +15622,7 @@  ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
   # unnecessary for this test.
 
     cat > conftest.$ac_ext << EOF
-#line 15621 "configure"
+#line 15625 "configure"
 template<typename T1, typename T2>
   struct same
   { typedef T2 type; };
@@ -15652,7 +15656,7 @@  $as_echo "$enable_int128" >&6; }
     rm -f conftest*
 
     cat > conftest.$ac_ext << EOF
-#line 15655 "configure"
+#line 15659 "configure"
 template<typename T1, typename T2>
   struct same
   { typedef T2 type; };
@@ -81575,6 +81579,21 @@  $as_echo "$gxx_include_dir" >&6; }
 
 
 
+# Determine what GCC version number to use in filesystem paths.
+
+  get_gcc_base_ver="cat"
+
+# Check whether --with-gcc-major-version-only was given.
+if test "${with_gcc_major_version_only+set}" = set; then :
+  withval=$with_gcc_major_version_only; if test x$with_gcc_major_version_only = xyes ; then
+        get_gcc_base_ver="sed -e 's/^\([0-9]*\).*\$\$/\1/'"
+      fi
+
+fi
+
+
+
+
 ac_config_files="$ac_config_files Makefile"
 
 ac_config_files="$ac_config_files scripts/testsuite_flags"
--- libstdc++-v3/Makefile.in.jj	2017-01-06 16:58:42.154614275 +0100
+++ libstdc++-v3/Makefile.in	2017-01-09 18:08:36.659299862 +0100
@@ -262,6 +262,7 @@  dvidir = @dvidir@
 enable_shared = @enable_shared@
 enable_static = @enable_static@
 exec_prefix = @exec_prefix@
+get_gcc_base_ver = @get_gcc_base_ver@
 glibcxx_MOFILES = @glibcxx_MOFILES@
 glibcxx_PCHFLAGS = @glibcxx_PCHFLAGS@
 glibcxx_POFILES = @glibcxx_POFILES@
@@ -318,7 +319,7 @@  toplevel_builddir = @toplevel_builddir@
 toplevel_srcdir = @toplevel_srcdir@
 
 # May be used by various substitution variables.
-gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
+gcc_version := $(shell @get_gcc_base_ver@ $(top_srcdir)/../gcc/BASE-VER)
 MAINT_CHARSET = latin1
 mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs
 PWD_COMMAND = $${PWDCMD-pwd}
--- libstdc++-v3/include/Makefile.in.jj	2017-01-06 16:58:42.310612215 +0100
+++ libstdc++-v3/include/Makefile.in	2017-01-09 18:08:36.385303368 +0100
@@ -234,6 +234,7 @@  dvidir = @dvidir@
 enable_shared = @enable_shared@
 enable_static = @enable_static@
 exec_prefix = @exec_prefix@
+get_gcc_base_ver = @get_gcc_base_ver@
 glibcxx_MOFILES = @glibcxx_MOFILES@
 glibcxx_PCHFLAGS = @glibcxx_PCHFLAGS@
 glibcxx_POFILES = @glibcxx_POFILES@
@@ -290,7 +291,7 @@  toplevel_builddir = @toplevel_builddir@
 toplevel_srcdir = @toplevel_srcdir@
 
 # May be used by various substitution variables.
-gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
+gcc_version := $(shell @get_gcc_base_ver@ $(top_srcdir)/../gcc/BASE-VER)
 MAINT_CHARSET = latin1
 mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs
 PWD_COMMAND = $${PWDCMD-pwd}
--- libstdc++-v3/doc/Makefile.in.jj	2017-01-06 16:58:42.298612373 +0100
+++ libstdc++-v3/doc/Makefile.in	2017-01-09 18:08:36.325304136 +0100
@@ -236,6 +236,7 @@  dvidir = @dvidir@
 enable_shared = @enable_shared@
 enable_static = @enable_static@
 exec_prefix = @exec_prefix@
+get_gcc_base_ver = @get_gcc_base_ver@
 glibcxx_MOFILES = @glibcxx_MOFILES@
 glibcxx_PCHFLAGS = @glibcxx_PCHFLAGS@
 glibcxx_POFILES = @glibcxx_POFILES@
@@ -300,7 +301,7 @@  toplevel_builddir = @toplevel_builddir@
 toplevel_srcdir = @toplevel_srcdir@
 
 # May be used by various substitution variables.
-gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
+gcc_version := $(shell @get_gcc_base_ver@ $(top_srcdir)/../gcc/BASE-VER)
 MAINT_CHARSET = latin1
 mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs
 PWD_COMMAND = $${PWDCMD-pwd}
--- libstdc++-v3/python/Makefile.in.jj	2017-01-06 16:58:42.140614460 +0100
+++ libstdc++-v3/python/Makefile.in	2017-01-09 18:08:36.485302089 +0100
@@ -264,6 +264,7 @@  dvidir = @dvidir@
 enable_shared = @enable_shared@
 enable_static = @enable_static@
 exec_prefix = @exec_prefix@
+get_gcc_base_ver = @get_gcc_base_ver@
 glibcxx_MOFILES = @glibcxx_MOFILES@
 glibcxx_PCHFLAGS = @glibcxx_PCHFLAGS@
 glibcxx_POFILES = @glibcxx_POFILES@
@@ -320,7 +321,7 @@  toplevel_builddir = @toplevel_builddir@
 toplevel_srcdir = @toplevel_srcdir@
 
 # May be used by various substitution variables.
-gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
+gcc_version := $(shell @get_gcc_base_ver@ $(top_srcdir)/../gcc/BASE-VER)
 MAINT_CHARSET = latin1
 mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs
 PWD_COMMAND = $${PWDCMD-pwd}
--- libstdc++-v3/src/c++11/Makefile.in.jj	2017-01-06 16:58:42.289612492 +0100
+++ libstdc++-v3/src/c++11/Makefile.in	2017-01-09 18:08:36.550301257 +0100
@@ -267,6 +267,7 @@  dvidir = @dvidir@
 enable_shared = @enable_shared@
 enable_static = @enable_static@
 exec_prefix = @exec_prefix@
+get_gcc_base_ver = @get_gcc_base_ver@
 glibcxx_MOFILES = @glibcxx_MOFILES@
 glibcxx_PCHFLAGS = @glibcxx_PCHFLAGS@
 glibcxx_POFILES = @glibcxx_POFILES@
@@ -323,7 +324,7 @@  toplevel_builddir = @toplevel_builddir@
 toplevel_srcdir = @toplevel_srcdir@
 
 # May be used by various substitution variables.
-gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
+gcc_version := $(shell @get_gcc_base_ver@ $(top_srcdir)/../gcc/BASE-VER)
 MAINT_CHARSET = latin1
 mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs
 PWD_COMMAND = $${PWDCMD-pwd}
--- libstdc++-v3/src/c++98/Makefile.in.jj	2017-01-06 16:58:42.284612558 +0100
+++ libstdc++-v3/src/c++98/Makefile.in	2017-01-09 18:08:36.582300847 +0100
@@ -268,6 +268,7 @@  dvidir = @dvidir@
 enable_shared = @enable_shared@
 enable_static = @enable_static@
 exec_prefix = @exec_prefix@
+get_gcc_base_ver = @get_gcc_base_ver@
 glibcxx_MOFILES = @glibcxx_MOFILES@
 glibcxx_PCHFLAGS = @glibcxx_PCHFLAGS@
 glibcxx_POFILES = @glibcxx_POFILES@
@@ -324,7 +325,7 @@  toplevel_builddir = @toplevel_builddir@
 toplevel_srcdir = @toplevel_srcdir@
 
 # May be used by various substitution variables.
-gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
+gcc_version := $(shell @get_gcc_base_ver@ $(top_srcdir)/../gcc/BASE-VER)
 MAINT_CHARSET = latin1
 mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs
 PWD_COMMAND = $${PWDCMD-pwd}
--- libstdc++-v3/src/filesystem/Makefile.in.jj	2017-01-06 16:58:42.155614262 +0100
+++ libstdc++-v3/src/filesystem/Makefile.in	2017-01-09 18:08:36.609300502 +0100
@@ -276,6 +276,7 @@  dvidir = @dvidir@
 enable_shared = @enable_shared@
 enable_static = @enable_static@
 exec_prefix = @exec_prefix@
+get_gcc_base_ver = @get_gcc_base_ver@
 glibcxx_MOFILES = @glibcxx_MOFILES@
 glibcxx_PCHFLAGS = @glibcxx_PCHFLAGS@
 glibcxx_POFILES = @glibcxx_POFILES@
@@ -332,7 +333,7 @@  toplevel_builddir = @toplevel_builddir@
 toplevel_srcdir = @toplevel_srcdir@
 
 # May be used by various substitution variables.
-gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
+gcc_version := $(shell @get_gcc_base_ver@ $(top_srcdir)/../gcc/BASE-VER)
 MAINT_CHARSET = latin1
 mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs
 PWD_COMMAND = $${PWDCMD-pwd}
--- libvtv/testsuite/Makefile.in.jj	2015-09-03 17:28:58.869566303 +0200
+++ libvtv/testsuite/Makefile.in	2017-01-09 18:08:44.986193295 +0100
@@ -174,6 +174,7 @@  dvidir = @dvidir@
 enable_shared = @enable_shared@
 enable_static = @enable_static@
 exec_prefix = @exec_prefix@
+get_gcc_base_ver = @get_gcc_base_ver@
 host = @host@
 host_alias = @host_alias@
 host_cpu = @host_cpu@
--- libvtv/configure.jj	2016-11-16 16:38:08.269236559 +0100
+++ libvtv/configure	2017-01-09 18:30:07.807780415 +0100
@@ -602,6 +602,7 @@  ac_subst_vars='am__EXEEXT_FALSE
 am__EXEEXT_TRUE
 LTLIBOBJS
 LIBOBJS
+get_gcc_base_ver
 VTV_NO_OBSTACK_FALSE
 VTV_NO_OBSTACK_TRUE
 VTV_CYGMIN_FALSE
@@ -759,6 +760,7 @@  with_pic
 enable_fast_install
 with_gnu_ld
 enable_libtool_lock
+with_gcc_major_version_only
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1409,6 +1411,8 @@  Optional Packages:
   --with-pic              try to use only PIC/non-PIC objects [default=use
                           both]
   --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
+  --with-gcc-major-version-only
+                          use only GCC major number in filesystem paths
 
 Some influential environment variables:
   CC          C compiler command
@@ -12062,7 +12066,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12065 "configure"
+#line 12069 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12168,7 +12172,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12171 "configure"
+#line 12175 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -15505,6 +15509,21 @@  else
 fi
 
 
+# Determine what GCC version number to use in filesystem paths.
+
+  get_gcc_base_ver="cat"
+
+# Check whether --with-gcc-major-version-only was given.
+if test "${with_gcc_major_version_only+set}" = set; then :
+  withval=$with_gcc_major_version_only; if test x$with_gcc_major_version_only = xyes ; then
+        get_gcc_base_ver="sed -e 's/^\([0-9]*\).*\$\$/\1/'"
+      fi
+
+fi
+
+
+
+
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
 # tests run on this system so they can be shared between configure
--- libvtv/Makefile.in.jj	2016-05-03 10:15:00.011141688 +0200
+++ libvtv/Makefile.in	2017-01-09 18:08:45.045192540 +0100
@@ -273,6 +273,7 @@  dvidir = @dvidir@
 enable_shared = @enable_shared@
 enable_static = @enable_static@
 exec_prefix = @exec_prefix@
+get_gcc_base_ver = @get_gcc_base_ver@
 host = @host@
 host_alias = @host_alias@
 host_cpu = @host_cpu@
@@ -320,7 +321,7 @@  toplevel_srcdir = @toplevel_srcdir@
 ACLOCAL_AMFLAGS = -I .. -I ../config
 
 # May be used by toolexeclibdir.
-gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
+gcc_version := $(shell @get_gcc_base_ver@ $(top_srcdir)/../gcc/BASE-VER)
 AM_CPPFLAGS = -I$(top_srcdir)/../include
 AM_CFLAGS = $(XCFLAGS)
 AM_CCASFLAGS = $(XCFLAGS)
--- lto-plugin/configure.jj	2016-11-16 16:38:07.528245871 +0100
+++ lto-plugin/configure	2017-01-09 18:30:08.368773242 +0100
@@ -619,6 +619,7 @@  LD
 FGREP
 SED
 LIBTOOL
+get_gcc_base_ver
 real_target_noncanonical
 accel_dir_suffix
 gcc_build_dir
@@ -733,6 +734,7 @@  enable_maintainer_mode
 with_libiberty
 enable_dependency_tracking
 enable_largefile
+with_gcc_major_version_only
 enable_shared
 enable_static
 with_pic
@@ -1386,6 +1388,8 @@  Optional Packages:
   --with-build-libsubdir=DIR  Directory where to find libraries for build system
   --with-libiberty=PATH   specify the directory where to find libiberty
                           [../libiberty]
+  --with-gcc-major-version-only
+                          use only GCC major number in filesystem paths
   --with-pic              try to use only PIC/non-PIC objects [default=use
                           both]
   --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
@@ -5376,6 +5380,21 @@  fi
 
 
 
+# Determine what GCC version number to use in filesystem paths.
+
+  get_gcc_base_ver="cat"
+
+# Check whether --with-gcc-major-version-only was given.
+if test "${with_gcc_major_version_only+set}" = set; then :
+  withval=$with_gcc_major_version_only; if test x$with_gcc_major_version_only = xyes ; then
+        get_gcc_base_ver="sed -e 's/^\([0-9]*\).*\$\$/\1/'"
+      fi
+
+fi
+
+
+
+
 case `pwd` in
   *\ * | *\	*)
     { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5
@@ -11450,7 +11469,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11453 "configure"
+#line 11472 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11556,7 +11575,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11559 "configure"
+#line 11578 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
--- lto-plugin/Makefile.in.jj	2015-05-13 16:37:00.084798375 +0200
+++ lto-plugin/Makefile.in	2017-01-09 18:08:52.417098195 +0100
@@ -214,6 +214,7 @@  docdir = @docdir@
 dvidir = @dvidir@
 exec_prefix = @exec_prefix@
 gcc_build_dir = @gcc_build_dir@
+get_gcc_base_ver = @get_gcc_base_ver@
 host = @host@
 host_alias = @host_alias@
 host_cpu = @host_cpu@
@@ -254,7 +255,7 @@  top_srcdir = @top_srcdir@
 with_libiberty = @with_libiberty@
 ACLOCAL_AMFLAGS = -I .. -I ../config
 AUTOMAKE_OPTIONS = no-dependencies
-gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
+gcc_version := $(shell @get_gcc_base_ver@ $(top_srcdir)/../gcc/BASE-VER)
 libexecsubdir := $(libexecdir)/gcc/$(real_target_noncanonical)/$(gcc_version)$(accel_dir_suffix)
 AM_CPPFLAGS = -I$(top_srcdir)/../include $(DEFS)
 AM_CFLAGS = @ac_lto_plugin_warn_cflags@