[gcc/devel/c++-modules] Add `--with-toolexeclibdir=' configuration option

Nathan Sidwell nathan@gcc.gnu.org
Fri Jan 24 14:43:00 GMT 2020


https://gcc.gnu.org/g:e8e66971cdc6d1390d47a227899e2e340ff44d66

commit e8e66971cdc6d1390d47a227899e2e340ff44d66
Author: Maciej W. Rozycki <macro@wdc.com>
Date:   Fri Jan 24 11:24:25 2020 +0000

    Add `--with-toolexeclibdir=' configuration option
    
    Provide means, in the form of a `--with-toolexeclibdir=' configuration
    option, to override the default installation directory for target
    libraries, otherwise known as $toolexeclibdir.  This is so that it is
    possible to get newly-built libraries, particularly the shared ones,
    installed in a common place, so that they can be readily used by the
    target system as their host libraries, possibly over NFS, without a need
    to manually copy them over from the currently hardcoded location they
    would otherwise be installed in.
    
    In the presence of the `--enable-version-specific-runtime-libs' option
    and for configurations building native GCC the option is ignored.
    
    	config/
    	* toolexeclibdir.m4: New file.
    
    	gcc/
    	* doc/install.texi (Cross-Compiler-Specific Options): Document
    	`--with-toolexeclibdir' option.
    
    	libada/
    	* Makefile.in (configure_deps): Add `toolexeclibdir.m4'.
    	* configure.ac: Handle `--with-toolexeclibdir='.
    	* configure: Regenerate.
    
    	libatomic/
    	* configure.ac: Handle `--with-toolexeclibdir='.
    	* Makefile.in: Regenerate.
    	* aclocal.m4: Regenerate.
    	* configure: Regenerate.
    	* testsuite/Makefile.in: Regenerate.
    
    	libffi/
    	* configure.ac: Handle `--with-toolexeclibdir='.
    	* Makefile.in: Regenerate.
    	* aclocal.m4: Regenerate.
    	* configure: Regenerate.
    	* include/Makefile.in: Regenerate.
    	* man/Makefile.in: Regenerate.
    	* testsuite/Makefile.in: Regenerate.
    
    	libgcc/
    	* Makefile.in (configure_deps): Add `toolexeclibdir.m4'.
    	* configure.ac: Handle `--with-toolexeclibdir='.
    	* configure: Regenerate.
    
    	libgfortran/
    	* configure.ac: Handle `--with-toolexeclibdir='.
    	* Makefile.in: Regenerate.
    	* aclocal.m4: Regenerate.
    	* configure: Regenerate.
    
    	libgomp/
    	* configure.ac: Handle `--with-toolexeclibdir='.
    	* Makefile.in: Regenerate.
    	* aclocal.m4: Regenerate.
    	* configure: Regenerate.
    	* testsuite/Makefile.in: Regenerate.
    
    	libhsail-rt/
    	* configure.ac: Handle `--with-toolexeclibdir='.
    	* Makefile.in: Regenerate.
    	* aclocal.m4: Regenerate.
    	* configure: Regenerate.
    
    	libitm/
    	* configure.ac: Handle `--with-toolexeclibdir='.
    	* Makefile.in: Regenerate.
    	* aclocal.m4: Regenerate.
    	* configure: Regenerate.
    	* testsuite/Makefile.in: Regenerate.
    
    	libobjc/
    	* Makefile.in (aclocal_deps): Add `toolexeclibdir.m4'.
    	* aclocal.m4: Include `toolexeclibdir.m4'.
    	* configure.ac: Handle `--with-toolexeclibdir='.
    	* configure: Regenerate.
    
    	liboffloadmic/
    	* plugin/configure.ac: Handle `--with-toolexeclibdir='.
    	* plugin/Makefile.in: Regenerate.
    	* plugin/aclocal.m4: Regenerate.
    	* plugin/configure: Regenerate.
    	* configure.ac: Handle `--with-toolexeclibdir='.
    	* Makefile.in: Regenerate.
    	* aclocal.m4: Regenerate.
    	* configure: Regenerate.
    
    	libphobos/
    	* m4/druntime.m4: Handle `--with-toolexeclibdir='.
    	* m4/Makefile.in: Regenerate.
    	* libdruntime/Makefile.in: Regenerate.
    	* src/Makefile.in: Regenerate.
    	* testsuite/Makefile.in: Regenerate.
    	* Makefile.in: Regenerate.
    	* aclocal.m4: Regenerate.
    	* configure: Regenerate.
    
    	libquadmath/
    	* configure.ac: Handle `--with-toolexeclibdir='.
    	* Makefile.in: Regenerate.
    	* aclocal.m4: Regenerate.
    	* configure: Regenerate.
    
    	libsanitizer/
    	* configure.ac: Handle `--with-toolexeclibdir='.
    	* Makefile.in: Regenerate.
    	* aclocal.m4: Regenerate.
    	* configure: Regenerate.
    	* asan/Makefile.in: Regenerate.
    	* interception/Makefile.in: Regenerate.
    	* libbacktrace/Makefile.in: Regenerate.
    	* lsan/Makefile.in: Regenerate.
    	* sanitizer_common/Makefile.in: Regenerate.
    	* tsan/Makefile.in: Regenerate.
    	* ubsan/Makefile.in: Regenerate.
    
    	libssp/
    	* configure.ac: Handle `--with-toolexeclibdir='.
    	* Makefile.in: Regenerate.
    	* aclocal.m4: Regenerate.
    	* configure: Regenerate.
    
    	libstdc++-v3/
    	* acinclude.m4: Handle `--with-toolexeclibdir='.
    	* Makefile.in: Regenerate.
    	* aclocal.m4: Regenerate.
    	* configure: Regenerate.
    	* doc/Makefile.in: Regenerate.
    	* include/Makefile.in: Regenerate.
    	* libsupc++/Makefile.in: Regenerate.
    	* po/Makefile.in: Regenerate.
    	* python/Makefile.in: Regenerate.
    	* src/Makefile.in: Regenerate.
    	* src/c++11/Makefile.in: Regenerate.
    	* src/c++17/Makefile.in: Regenerate.
    	* src/c++98/Makefile.in: Regenerate.
    	* src/filesystem/Makefile.in: Regenerate.
    	* testsuite/Makefile.in: Regenerate.
    
    	libvtv/
    	* configure.ac: Handle `--with-toolexeclibdir='.
    	* Makefile.in: Regenerate.
    	* aclocal.m4: Regenerate.
    	* configure: Regenerate.
    	* testsuite/Makefile.in: Regenerate.
    
    	zlib/
    	* configure.ac: Handle `--with-toolexeclibdir='.
    	* Makefile.in: Regenerate.
    	* aclocal.m4: Regenerate.
    	* configure: Regenerate.

Diff:
---
 config/ChangeLog                          |  4 +++
 config/toolexeclibdir.m4                  | 31 ++++++++++++++++++++
 gcc/ChangeLog                             |  5 ++++
 gcc/doc/install.texi                      |  4 +++
 libada/ChangeLog                          |  6 ++++
 libada/Makefile.in                        |  1 +
 libada/configure                          | 29 ++++++++++++++++++-
 libada/configure.ac                       | 12 +++++++-
 libatomic/ChangeLog                       |  8 ++++++
 libatomic/Makefile.in                     |  1 +
 libatomic/aclocal.m4                      |  1 +
 libatomic/configure                       | 33 ++++++++++++++++++++--
 libatomic/configure.ac                    | 11 +++++++-
 libatomic/testsuite/Makefile.in           |  1 +
 libffi/ChangeLog                          | 10 +++++++
 libffi/Makefile.in                        |  1 +
 libffi/aclocal.m4                         |  1 +
 libffi/configure                          | 33 ++++++++++++++++++++--
 libffi/configure.ac                       | 11 +++++++-
 libffi/include/Makefile.in                |  1 +
 libffi/man/Makefile.in                    |  1 +
 libffi/testsuite/Makefile.in              |  1 +
 libgcc/ChangeLog                          |  6 ++++
 libgcc/Makefile.in                        |  1 +
 libgcc/configure                          | 38 +++++++++++++++++++++++--
 libgcc/configure.ac                       | 25 +++++++++++++---
 libgfortran/ChangeLog                     |  7 +++++
 libgfortran/Makefile.in                   |  1 +
 libgfortran/aclocal.m4                    |  1 +
 libgfortran/configure                     | 33 ++++++++++++++++++++--
 libgfortran/configure.ac                  | 11 +++++++-
 libgomp/ChangeLog                         |  8 ++++++
 libgomp/Makefile.in                       | 10 ++++---
 libgomp/aclocal.m4                        |  1 +
 libgomp/configure                         | 33 ++++++++++++++++++++--
 libgomp/configure.ac                      | 11 +++++++-
 libgomp/testsuite/Makefile.in             | 10 ++++---
 libhsail-rt/ChangeLog                     |  7 +++++
 libhsail-rt/Makefile.in                   |  1 +
 libhsail-rt/aclocal.m4                    |  1 +
 libhsail-rt/configure                     | 33 ++++++++++++++++++++--
 libhsail-rt/configure.ac                  | 11 +++++++-
 libitm/ChangeLog                          |  8 ++++++
 libitm/Makefile.in                        |  1 +
 libitm/aclocal.m4                         |  1 +
 libitm/configure                          | 33 ++++++++++++++++++++--
 libitm/configure.ac                       | 11 +++++++-
 libitm/testsuite/Makefile.in              |  1 +
 libobjc/ChangeLog                         |  7 +++++
 libobjc/Makefile.in                       |  1 +
 libobjc/aclocal.m4                        |  1 +
 libobjc/configure                         | 33 ++++++++++++++++++++--
 libobjc/configure.ac                      | 11 +++++++-
 liboffloadmic/ChangeLog                   | 11 ++++++++
 liboffloadmic/Makefile.in                 |  1 +
 liboffloadmic/aclocal.m4                  |  1 +
 liboffloadmic/configure                   | 33 ++++++++++++++++++++--
 liboffloadmic/configure.ac                | 11 +++++++-
 liboffloadmic/plugin/Makefile.in          |  1 +
 liboffloadmic/plugin/aclocal.m4           |  1 +
 liboffloadmic/plugin/configure            | 33 ++++++++++++++++++++--
 liboffloadmic/plugin/configure.ac         | 11 +++++++-
 libphobos/ChangeLog                       | 11 ++++++++
 libphobos/Makefile.in                     |  1 +
 libphobos/aclocal.m4                      |  1 +
 libphobos/configure                       | 33 ++++++++++++++++++++--
 libphobos/libdruntime/Makefile.in         |  1 +
 libphobos/m4/druntime.m4                  | 11 +++++++-
 libphobos/src/Makefile.in                 |  1 +
 libphobos/testsuite/Makefile.in           |  1 +
 libquadmath/ChangeLog                     |  7 +++++
 libquadmath/Makefile.in                   |  1 +
 libquadmath/aclocal.m4                    |  1 +
 libquadmath/configure                     | 33 ++++++++++++++++++++--
 libquadmath/configure.ac                  | 11 +++++++-
 libsanitizer/ChangeLog                    | 14 +++++++++
 libsanitizer/Makefile.in                  |  1 +
 libsanitizer/aclocal.m4                   |  1 +
 libsanitizer/asan/Makefile.in             |  1 +
 libsanitizer/configure                    | 33 ++++++++++++++++++++--
 libsanitizer/configure.ac                 | 11 +++++++-
 libsanitizer/interception/Makefile.in     |  1 +
 libsanitizer/libbacktrace/Makefile.in     |  1 +
 libsanitizer/lsan/Makefile.in             |  1 +
 libsanitizer/sanitizer_common/Makefile.in |  1 +
 libsanitizer/tsan/Makefile.in             |  1 +
 libsanitizer/ubsan/Makefile.in            |  1 +
 libssp/ChangeLog                          |  7 +++++
 libssp/Makefile.in                        |  1 +
 libssp/aclocal.m4                         |  1 +
 libssp/configure                          | 33 ++++++++++++++++++++--
 libssp/configure.ac                       | 11 +++++++-
 libstdc++-v3/ChangeLog                    | 18 ++++++++++++
 libstdc++-v3/Makefile.in                  |  1 +
 libstdc++-v3/acinclude.m4                 | 11 +++++++-
 libstdc++-v3/aclocal.m4                   |  1 +
 libstdc++-v3/configure                    | 47 ++++++++++++++++++++++++-------
 libstdc++-v3/doc/Makefile.in              |  1 +
 libstdc++-v3/include/Makefile.in          |  1 +
 libstdc++-v3/libsupc++/Makefile.in        |  1 +
 libstdc++-v3/po/Makefile.in               |  1 +
 libstdc++-v3/python/Makefile.in           |  1 +
 libstdc++-v3/src/Makefile.in              |  1 +
 libstdc++-v3/src/c++11/Makefile.in        |  1 +
 libstdc++-v3/src/c++17/Makefile.in        |  1 +
 libstdc++-v3/src/c++98/Makefile.in        |  1 +
 libstdc++-v3/src/filesystem/Makefile.in   |  1 +
 libstdc++-v3/testsuite/Makefile.in        |  1 +
 libvtv/ChangeLog                          |  8 ++++++
 libvtv/Makefile.in                        |  1 +
 libvtv/aclocal.m4                         |  1 +
 libvtv/configure                          | 33 ++++++++++++++++++++--
 libvtv/configure.ac                       | 11 +++++++-
 libvtv/testsuite/Makefile.in              |  1 +
 zlib/ChangeLog.gcj                        |  7 +++++
 zlib/Makefile.in                          |  1 +
 zlib/aclocal.m4                           |  1 +
 zlib/configure                            | 33 ++++++++++++++++++++--
 zlib/configure.ac                         | 11 +++++++-
 119 files changed, 1009 insertions(+), 87 deletions(-)

diff --git a/config/ChangeLog b/config/ChangeLog
index 792e280..9c8e40a 100644
--- a/config/ChangeLog
+++ b/config/ChangeLog
@@ -1,3 +1,7 @@
+2020-01-24  Maciej W. Rozycki  <macro@wdc.com>
+
+	* toolexeclibdir.m4: New file.
+
 2019-09-10  Christophe Lyon  <christophe.lyon@st.com>
 
 	* futex.m4: Handle *-uclinux*.
diff --git a/config/toolexeclibdir.m4 b/config/toolexeclibdir.m4
new file mode 100644
index 0000000..5dd8978
--- /dev/null
+++ b/config/toolexeclibdir.m4
@@ -0,0 +1,31 @@
+dnl toolexeclibdir override support.
+dnl Copyright (C) 2020  Free Software Foundation, Inc.
+dnl
+dnl This program is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 3, or (at your option)
+dnl any later version.
+dnl
+dnl This program is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+dnl GNU General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with this program; see the file COPYING3.  If not see
+dnl <http://www.gnu.org/licenses/>.
+
+AC_DEFUN([GCC_WITH_TOOLEXECLIBDIR],
+[AC_ARG_WITH(toolexeclibdir,
+  [AS_HELP_STRING([--with-toolexeclibdir=DIR],
+		  [install libraries built with a cross compiler within DIR])],
+  [dnl
+case ${with_toolexeclibdir} in
+  /)
+    ;;
+  */)
+    with_toolexeclibdir=`echo $with_toolexeclibdir | sed 's,/$,,'`
+    ;;
+esac],
+  [with_toolexeclibdir=no])
+])
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1c77013..f15f03a 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2020-01-24  Maciej W. Rozycki  <macro@wdc.com>
+
+	* doc/install.texi (Cross-Compiler-Specific Options): Document
+	`--with-toolexeclibdir' option.
+
 2020-01-24  Hans-Peter Nilsson  <hp@axis.com>
 
 	* target.def (flags_regnum): Also mention effect on delay slot filling.
diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
index 643f3bb..6ffafac 100644
--- a/gcc/doc/install.texi
+++ b/gcc/doc/install.texi
@@ -2207,6 +2207,10 @@ target if target binutils supported.
 The following options only apply to building cross compilers.
 
 @table @code
+@item --with-toolexeclibdir=@var{dir}
+Specify the installation directory for libraries built with a cross compiler.
+The default is @option{$@{gcc_tooldir@}/lib}.
+
 @item --with-sysroot
 @itemx --with-sysroot=@var{dir}
 Tells GCC to consider @var{dir} as the root of a tree that contains
diff --git a/libada/ChangeLog b/libada/ChangeLog
index 32aaeac..8eda1eb 100644
--- a/libada/ChangeLog
+++ b/libada/ChangeLog
@@ -1,3 +1,9 @@
+2020-01-24  Maciej W. Rozycki  <macro@wdc.com>
+
+	* Makefile.in (configure_deps): Add `toolexeclibdir.m4'.
+	* configure.ac: Handle `--with-toolexeclibdir='.
+	* configure: Regenerate.
+
 2020-01-01  Jakub Jelinek  <jakub@redhat.com>
 
 	Update copyright years.
diff --git a/libada/Makefile.in b/libada/Makefile.in
index 6e0a3c5..e6347a5 100644
--- a/libada/Makefile.in
+++ b/libada/Makefile.in
@@ -186,6 +186,7 @@ configure_deps = \
 	$(srcdir)/../config/multi.m4 \
 	$(srcdir)/../config/override.m4 \
 	$(srcdir)/../config/picflag.m4 \
+	$(srcdir)/../config/toolexeclibdir.m4 \
 	$(srcdir)/../config/unwind_ipinfo.m4
 
 $(srcdir)/configure: @MAINT@ $(configure_deps)
diff --git a/libada/configure b/libada/configure
index a28be40..162d973 100755
--- a/libada/configure
+++ b/libada/configure
@@ -704,6 +704,7 @@ enable_option_checking
 with_build_libsubdir
 enable_version_specific_runtime_libs
 enable_maintainer_mode
+with_toolexeclibdir
 enable_multilib
 enable_shared
 with_system_libunwind
@@ -1339,6 +1340,9 @@ Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
   --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
   --with-build-libsubdir=DIR  Directory where to find libraries for build system
+  --with-toolexeclibdir=DIR
+                          install libraries built with a cross compiler within
+                          DIR
   --with-system-libunwind use installed libunwind
   --with-gcc-major-version-only
                           use only GCC major number in filesystem paths
@@ -2249,6 +2253,22 @@ else
 fi
 
 
+
+# Check whether --with-toolexeclibdir was given.
+if test "${with_toolexeclibdir+set}" = set; then :
+  withval=$with_toolexeclibdir; case ${with_toolexeclibdir} in
+  /)
+    ;;
+  */)
+    with_toolexeclibdir=`echo $with_toolexeclibdir | sed 's,/$,,'`
+    ;;
+esac
+else
+  with_toolexeclibdir=no
+fi
+
+
+
 # Default to --enable-multilib
 # Check whether --enable-multilib was given.
 if test "${enable_multilib+set}" = set; then :
@@ -2301,7 +2321,14 @@ case ${enable_version_specific_runtime_libs} in
        test x"$with_cross_host" != x"no"; then
       # Install a library built with a cross compiler in tooldir, not libdir.
       toolexecdir='$(exec_prefix)/$(target_alias)'
-      toolexeclibdir='$(toolexecdir)/lib'
+      case ${with_toolexeclibdir} in
+	no)
+	  toolexeclibdir='$(toolexecdir)/lib'
+	  ;;
+	*)
+	  toolexeclibdir=${with_toolexeclibdir}
+	  ;;
+      esac
     else
       toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
       toolexeclibdir='$(libdir)'
diff --git a/libada/configure.ac b/libada/configure.ac
index 09c2c45..2810fe1 100644
--- a/libada/configure.ac
+++ b/libada/configure.ac
@@ -19,6 +19,7 @@ sinclude(../config/acx.m4)
 sinclude(../config/multi.m4)
 sinclude(../config/override.m4)
 sinclude(../config/picflag.m4)
+sinclude(../config/toolexeclibdir.m4)
 sinclude(../config/unwind_ipinfo.m4)
 
 AC_INIT
@@ -67,6 +68,8 @@ AC_ARG_ENABLE([maintainer-mode],
   [MAINT='#'])
 AC_SUBST([MAINT])dnl
 
+GCC_WITH_TOOLEXECLIBDIR
+
 AM_ENABLE_MULTILIB(, ..)
 # Calculate toolexeclibdir
 # Also toolexecdir, though it's only used in toolexeclibdir
@@ -83,7 +86,14 @@ case ${enable_version_specific_runtime_libs} in
        test x"$with_cross_host" != x"no"; then
       # Install a library built with a cross compiler in tooldir, not libdir.
       toolexecdir='$(exec_prefix)/$(target_alias)'
-      toolexeclibdir='$(toolexecdir)/lib'
+      case ${with_toolexeclibdir} in
+	no)
+	  toolexeclibdir='$(toolexecdir)/lib'
+	  ;;
+	*)
+	  toolexeclibdir=${with_toolexeclibdir}
+	  ;;
+      esac
     else
       toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
       toolexeclibdir='$(libdir)'
diff --git a/libatomic/ChangeLog b/libatomic/ChangeLog
index d034429..4aeaadb 100644
--- a/libatomic/ChangeLog
+++ b/libatomic/ChangeLog
@@ -1,3 +1,11 @@
+2020-01-24  Maciej W. Rozycki  <macro@wdc.com>
+
+	* configure.ac: Handle `--with-toolexeclibdir='.
+	* Makefile.in: Regenerate.
+	* aclocal.m4: Regenerate.
+	* configure: Regenerate.
+	* testsuite/Makefile.in: Regenerate.
+
 2020-01-01  Jakub Jelinek  <jakub@redhat.com>
 
 	Update copyright years.
diff --git a/libatomic/Makefile.in b/libatomic/Makefile.in
index 29324e3..acf8839 100644
--- a/libatomic/Makefile.in
+++ b/libatomic/Makefile.in
@@ -106,6 +106,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
 	$(top_srcdir)/../config/multi.m4 \
 	$(top_srcdir)/../config/override.m4 \
 	$(top_srcdir)/../config/stdint.m4 \
+	$(top_srcdir)/../config/toolexeclibdir.m4 \
 	$(top_srcdir)/../config/warnings.m4 \
 	$(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
 	$(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
diff --git a/libatomic/aclocal.m4 b/libatomic/aclocal.m4
index f73c97c..80e2421 100644
--- a/libatomic/aclocal.m4
+++ b/libatomic/aclocal.m4
@@ -1194,6 +1194,7 @@ m4_include([../config/lthostflags.m4])
 m4_include([../config/multi.m4])
 m4_include([../config/override.m4])
 m4_include([../config/stdint.m4])
+m4_include([../config/toolexeclibdir.m4])
 m4_include([../config/warnings.m4])
 m4_include([../ltoptions.m4])
 m4_include([../ltsugar.m4])
diff --git a/libatomic/configure b/libatomic/configure
index 6e16b0c..8cad97e 100755
--- a/libatomic/configure
+++ b/libatomic/configure
@@ -794,6 +794,7 @@ enable_version_specific_runtime_libs
 enable_generated_files_in_srcdir
 enable_silent_rules
 enable_multilib
+with_toolexeclibdir
 enable_dependency_tracking
 enable_shared
 enable_static
@@ -1459,6 +1460,9 @@ Optional Features:
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
   --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
+  --with-toolexeclibdir=DIR
+                          install libraries built with a cross compiler within
+                          DIR
   --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]
@@ -3343,6 +3347,22 @@ fi
 ac_config_commands="$ac_config_commands default-1"
 
 
+
+# Check whether --with-toolexeclibdir was given.
+if test "${with_toolexeclibdir+set}" = set; then :
+  withval=$with_toolexeclibdir; case ${with_toolexeclibdir} in
+  /)
+    ;;
+  */)
+    with_toolexeclibdir=`echo $with_toolexeclibdir | sed 's,/$,,'`
+    ;;
+esac
+else
+  with_toolexeclibdir=no
+fi
+
+
+
 # Calculate toolexeclibdir
 # Also toolexecdir, though it's only used in toolexeclibdir
 case ${enable_version_specific_runtime_libs} in
@@ -3358,7 +3378,14 @@ case ${enable_version_specific_runtime_libs} in
        test x"$with_cross_host" != x"no"; then
       # Install a library built with a cross compiler in tooldir, not libdir.
       toolexecdir='$(exec_prefix)/$(target_alias)'
-      toolexeclibdir='$(toolexecdir)/lib'
+      case ${with_toolexeclibdir} in
+	no)
+	  toolexeclibdir='$(toolexecdir)/lib'
+	  ;;
+	*)
+	  toolexeclibdir=${with_toolexeclibdir}
+	  ;;
+      esac
     else
       toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
       toolexeclibdir='$(libdir)'
@@ -11360,7 +11387,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11363 "configure"
+#line 11390 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11466,7 +11493,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11469 "configure"
+#line 11496 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
diff --git a/libatomic/configure.ac b/libatomic/configure.ac
index dc297f4..b8df11b 100644
--- a/libatomic/configure.ac
+++ b/libatomic/configure.ac
@@ -84,6 +84,8 @@ target_alias=${target_alias-$host_alias}
 AM_INIT_AUTOMAKE([1.9.0 foreign no-dist -Wall -Wno-portability -Wno-override])
 AM_ENABLE_MULTILIB(, ..)
 
+GCC_WITH_TOOLEXECLIBDIR
+
 # Calculate toolexeclibdir
 # Also toolexecdir, though it's only used in toolexeclibdir
 case ${enable_version_specific_runtime_libs} in
@@ -99,7 +101,14 @@ case ${enable_version_specific_runtime_libs} in
        test x"$with_cross_host" != x"no"; then
       # Install a library built with a cross compiler in tooldir, not libdir.
       toolexecdir='$(exec_prefix)/$(target_alias)'
-      toolexeclibdir='$(toolexecdir)/lib'
+      case ${with_toolexeclibdir} in
+	no)
+	  toolexeclibdir='$(toolexecdir)/lib'
+	  ;;
+	*)
+	  toolexeclibdir=${with_toolexeclibdir}
+	  ;;
+      esac
     else
       toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
       toolexeclibdir='$(libdir)'
diff --git a/libatomic/testsuite/Makefile.in b/libatomic/testsuite/Makefile.in
index 73b9d52..15bb3a4 100644
--- a/libatomic/testsuite/Makefile.in
+++ b/libatomic/testsuite/Makefile.in
@@ -97,6 +97,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
 	$(top_srcdir)/../config/multi.m4 \
 	$(top_srcdir)/../config/override.m4 \
 	$(top_srcdir)/../config/stdint.m4 \
+	$(top_srcdir)/../config/toolexeclibdir.m4 \
 	$(top_srcdir)/../config/warnings.m4 \
 	$(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
 	$(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
diff --git a/libffi/ChangeLog b/libffi/ChangeLog
index d6c5ec2..47648d3 100644
--- a/libffi/ChangeLog
+++ b/libffi/ChangeLog
@@ -1,3 +1,13 @@
+2020-01-24  Maciej W. Rozycki  <macro@wdc.com>
+
+	* configure.ac: Handle `--with-toolexeclibdir='.
+	* Makefile.in: Regenerate.
+	* aclocal.m4: Regenerate.
+	* configure: Regenerate.
+	* include/Makefile.in: Regenerate.
+	* man/Makefile.in: Regenerate.
+	* testsuite/Makefile.in: Regenerate.
+
 2019-09-27  Maciej W. Rozycki  <macro@wdc.com>
 
 	* configure: Regenerate.
diff --git a/libffi/Makefile.in b/libffi/Makefile.in
index 72f8678..f7786ff 100644
--- a/libffi/Makefile.in
+++ b/libffi/Makefile.in
@@ -103,6 +103,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
 	$(top_srcdir)/../config/lead-dot.m4 \
 	$(top_srcdir)/../config/multi.m4 \
 	$(top_srcdir)/../config/override.m4 \
+	$(top_srcdir)/../config/toolexeclibdir.m4 \
 	$(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
 	$(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
 	$(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \
diff --git a/libffi/aclocal.m4 b/libffi/aclocal.m4
index 19a5166..9c8c88f 100644
--- a/libffi/aclocal.m4
+++ b/libffi/aclocal.m4
@@ -1193,6 +1193,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/toolexeclibdir.m4])
 m4_include([../libtool.m4])
 m4_include([../ltoptions.m4])
 m4_include([../ltsugar.m4])
diff --git a/libffi/configure b/libffi/configure
index 77e91a1..ca0a296 100755
--- a/libffi/configure
+++ b/libffi/configure
@@ -813,6 +813,7 @@ enable_debug
 enable_structs
 enable_raw_api
 enable_purify_safety
+with_toolexeclibdir
 enable_symvers
 with_gcc_major_version_only
 '
@@ -1476,6 +1477,9 @@ 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-toolexeclibdir=DIR
+                          install libraries built with a cross compiler within
+                          DIR
   --with-gcc-major-version-only
                           use only GCC major number in filesystem paths
 
@@ -11557,7 +11561,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11560 "configure"
+#line 11564 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11663,7 +11667,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11666 "configure"
+#line 11670 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -16177,10 +16181,33 @@ $as_echo "#define USING_PURIFY 1" >>confdefs.h
 fi
 
 
+
+# Check whether --with-toolexeclibdir was given.
+if test "${with_toolexeclibdir+set}" = set; then :
+  withval=$with_toolexeclibdir; case ${with_toolexeclibdir} in
+  /)
+    ;;
+  */)
+    with_toolexeclibdir=`echo $with_toolexeclibdir | sed 's,/$,,'`
+    ;;
+esac
+else
+  with_toolexeclibdir=no
+fi
+
+
+
 if test -n "$with_cross_host" &&
    test x"$with_cross_host" != x"no"; then
   toolexecdir='$(exec_prefix)/$(target_alias)'
-  toolexeclibdir='$(toolexecdir)/lib'
+  case ${with_toolexeclibdir} in
+    no)
+      toolexeclibdir='$(toolexecdir)/lib'
+      ;;
+    *)
+      toolexeclibdir=${with_toolexeclibdir}
+      ;;
+  esac
 else
   toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
   toolexeclibdir='$(libdir)'
diff --git a/libffi/configure.ac b/libffi/configure.ac
index d28981b..93e6558 100644
--- a/libffi/configure.ac
+++ b/libffi/configure.ac
@@ -332,10 +332,19 @@ AC_ARG_ENABLE(purify-safety,
     AC_DEFINE(USING_PURIFY, 1, [Define this if you are using Purify and want to suppress spurious messages.])
   fi)
 
+GCC_WITH_TOOLEXECLIBDIR
+
 if test -n "$with_cross_host" &&
    test x"$with_cross_host" != x"no"; then
   toolexecdir='$(exec_prefix)/$(target_alias)'
-  toolexeclibdir='$(toolexecdir)/lib'
+  case ${with_toolexeclibdir} in
+    no)
+      toolexeclibdir='$(toolexecdir)/lib'
+      ;;
+    *)
+      toolexeclibdir=${with_toolexeclibdir}
+      ;;
+  esac
 else
   toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
   toolexeclibdir='$(libdir)'
diff --git a/libffi/include/Makefile.in b/libffi/include/Makefile.in
index 5dabdff..99da841 100644
--- a/libffi/include/Makefile.in
+++ b/libffi/include/Makefile.in
@@ -97,6 +97,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
 	$(top_srcdir)/../config/lead-dot.m4 \
 	$(top_srcdir)/../config/multi.m4 \
 	$(top_srcdir)/../config/override.m4 \
+	$(top_srcdir)/../config/toolexeclibdir.m4 \
 	$(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
 	$(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
 	$(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \
diff --git a/libffi/man/Makefile.in b/libffi/man/Makefile.in
index 1a21f38..7546910 100644
--- a/libffi/man/Makefile.in
+++ b/libffi/man/Makefile.in
@@ -96,6 +96,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
 	$(top_srcdir)/../config/lead-dot.m4 \
 	$(top_srcdir)/../config/multi.m4 \
 	$(top_srcdir)/../config/override.m4 \
+	$(top_srcdir)/../config/toolexeclibdir.m4 \
 	$(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
 	$(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
 	$(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \
diff --git a/libffi/testsuite/Makefile.in b/libffi/testsuite/Makefile.in
index 59f09bb..31e9cf5 100644
--- a/libffi/testsuite/Makefile.in
+++ b/libffi/testsuite/Makefile.in
@@ -96,6 +96,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
 	$(top_srcdir)/../config/lead-dot.m4 \
 	$(top_srcdir)/../config/multi.m4 \
 	$(top_srcdir)/../config/override.m4 \
+	$(top_srcdir)/../config/toolexeclibdir.m4 \
 	$(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
 	$(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
 	$(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \
diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog
index bea77b2..0920265 100644
--- a/libgcc/ChangeLog
+++ b/libgcc/ChangeLog
@@ -1,3 +1,9 @@
+2020-01-24  Maciej W. Rozycki  <macro@wdc.com>
+
+	* Makefile.in (configure_deps): Add `toolexeclibdir.m4'.
+	* configure.ac: Handle `--with-toolexeclibdir='.
+	* configure: Regenerate.
+
 2020-01-23  Dragan Mladjenovic  <dmladjenovic@wavecomp.com>
 
 	* config/mips/gnustack.h: Check for TARGET_LIBC_GNUSTACK also.
diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in
index 43bad01..851e765 100644
--- a/libgcc/Makefile.in
+++ b/libgcc/Makefile.in
@@ -165,6 +165,7 @@ AUTOCONF = autoconf
 configure_deps = \
 	$(srcdir)/../config/enable.m4 \
 	$(srcdir)/../config/tls.m4 \
+	$(srcdir)/../config/toolexeclibdir.m4 \
 	$(srcdir)/../config/acx.m4 \
 	$(srcdir)/../config/no-executables.m4 \
 	$(srcdir)/../config/lib-ld.m4 \
diff --git a/libgcc/configure b/libgcc/configure
index 97cbad3..ab8d471 100755
--- a/libgcc/configure
+++ b/libgcc/configure
@@ -705,6 +705,7 @@ enable_gcov
 enable_vtable_verify
 with_aix_soname
 enable_version_specific_runtime_libs
+with_toolexeclibdir
 with_slibdir
 enable_maintainer_mode
 with_build_libsubdir
@@ -1369,6 +1370,9 @@ Optional Packages:
   --with-aix-soname=aix|svr4|both
                           shared library versioning (aka "SONAME") variant to
                           provide on AIX
+  --with-toolexeclibdir=DIR
+                          install libraries built with a cross compiler within
+                          DIR
   --with-slibdir=DIR      shared libraries in DIR LIBDIR
   --with-build-libsubdir=DIR  Directory where to find libraries for build system
   --with-system-libunwind use installed libunwind
@@ -2464,6 +2468,22 @@ fi
 $as_echo "$version_specific_libs" >&6; }
 
 
+# Check whether --with-toolexeclibdir was given.
+if test "${with_toolexeclibdir+set}" = set; then :
+  withval=$with_toolexeclibdir; case ${with_toolexeclibdir} in
+  /)
+    ;;
+  */)
+    with_toolexeclibdir=`echo $with_toolexeclibdir | sed 's,/$,,'`
+    ;;
+esac
+else
+  with_toolexeclibdir=no
+fi
+
+
+
+
 # Check whether --with-slibdir was given.
 if test "${with_slibdir+set}" = set; then :
   withval=$with_slibdir; slibdir="$with_slibdir"
@@ -2471,7 +2491,14 @@ else
   if test "${version_specific_libs}" = yes; then
   slibdir='$(libsubdir)'
 elif test -n "$with_cross_host" && test x"$with_cross_host" != x"no"; then
-  slibdir='$(exec_prefix)/$(host_noncanonical)/lib'
+  case ${with_toolexeclibdir} in
+    no)
+      slibdir='$(exec_prefix)/$(host_noncanonical)/lib'
+      ;;
+    *)
+      slibdir=${with_toolexeclibdir}
+      ;;
+  esac
 else
   slibdir='$(libdir)'
 fi
@@ -2701,7 +2728,14 @@ case ${version_specific_libs} in
        test x"$with_cross_host" != x"no"; then
       # Install a library built with a cross compiler in tooldir, not libdir.
       toolexecdir='$(exec_prefix)/$(target_noncanonical)'
-      toolexeclibdir='$(toolexecdir)/lib'
+      case ${with_toolexeclibdir} in
+	no)
+	  toolexeclibdir='$(toolexecdir)/lib'
+	  ;;
+	*)
+	  toolexeclibdir=${with_toolexeclibdir}
+	  ;;
+      esac
     else
       toolexecdir='$(libdir)/gcc-lib/$(target_noncanonical)'
       toolexeclibdir='$(libdir)'
diff --git a/libgcc/configure.ac b/libgcc/configure.ac
index 2d22f05..85979da9 100644
--- a/libgcc/configure.ac
+++ b/libgcc/configure.ac
@@ -2,6 +2,7 @@ dnl Process this file with autoconf to produce a configure script.
 
 sinclude(../config/enable.m4)
 sinclude(../config/tls.m4)
+sinclude(../config/toolexeclibdir.m4)
 sinclude(../config/acx.m4)
 sinclude(../config/no-executables.m4)
 sinclude(../config/lib-ld.m4)
@@ -113,16 +114,25 @@ AC_ARG_ENABLE(version-specific-runtime-libs,
 [version_specific_libs=no])
 AC_MSG_RESULT($version_specific_libs)
 
+GCC_WITH_TOOLEXECLIBDIR
+
 AC_ARG_WITH(slibdir,
 [  --with-slibdir=DIR      shared libraries in DIR [LIBDIR]],
 slibdir="$with_slibdir",
-if test "${version_specific_libs}" = yes; then
+[if test "${version_specific_libs}" = yes; then
   slibdir='$(libsubdir)'
 elif test -n "$with_cross_host" && test x"$with_cross_host" != x"no"; then
-  slibdir='$(exec_prefix)/$(host_noncanonical)/lib'
+  case ${with_toolexeclibdir} in
+    no)
+      slibdir='$(exec_prefix)/$(host_noncanonical)/lib'
+      ;;
+    *)
+      slibdir=${with_toolexeclibdir}
+      ;;
+  esac
 else
   slibdir='$(libdir)'
-fi)
+fi])
 AC_SUBST(slibdir)
 
 # Command-line options.
@@ -168,7 +178,14 @@ case ${version_specific_libs} in
        test x"$with_cross_host" != x"no"; then
       # Install a library built with a cross compiler in tooldir, not libdir.
       toolexecdir='$(exec_prefix)/$(target_noncanonical)'
-      toolexeclibdir='$(toolexecdir)/lib'
+      case ${with_toolexeclibdir} in
+	no)
+	  toolexeclibdir='$(toolexecdir)/lib'
+	  ;;
+	*)
+	  toolexeclibdir=${with_toolexeclibdir}
+	  ;;
+      esac
     else
       toolexecdir='$(libdir)/gcc-lib/$(target_noncanonical)'
       toolexeclibdir='$(libdir)'
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index f546ef8..fe7e480 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,10 @@
+2020-01-24  Maciej W. Rozycki  <macro@wdc.com>
+
+	* configure.ac: Handle `--with-toolexeclibdir='.
+	* Makefile.in: Regenerate.
+	* aclocal.m4: Regenerate.
+	* configure: Regenerate.
+
 2020-01-17  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
 
 	PR libfortran/93234
diff --git a/libgfortran/Makefile.in b/libgfortran/Makefile.in
index 954f9fe..a6804c1 100644
--- a/libgfortran/Makefile.in
+++ b/libgfortran/Makefile.in
@@ -167,6 +167,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/depstand.m4 \
 	$(top_srcdir)/../config/multi.m4 \
 	$(top_srcdir)/../config/override.m4 \
 	$(top_srcdir)/../config/stdint.m4 \
+	$(top_srcdir)/../config/toolexeclibdir.m4 \
 	$(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
 	$(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
 	$(top_srcdir)/acinclude.m4 $(top_srcdir)/../config/acx.m4 \
diff --git a/libgfortran/aclocal.m4 b/libgfortran/aclocal.m4
index 7604f56..89e5496 100644
--- a/libgfortran/aclocal.m4
+++ b/libgfortran/aclocal.m4
@@ -1174,6 +1174,7 @@ m4_include([../config/lthostflags.m4])
 m4_include([../config/multi.m4])
 m4_include([../config/override.m4])
 m4_include([../config/stdint.m4])
+m4_include([../config/toolexeclibdir.m4])
 m4_include([../ltoptions.m4])
 m4_include([../ltsugar.m4])
 m4_include([../ltversion.m4])
diff --git a/libgfortran/configure b/libgfortran/configure
index 307da69..8ba6831 100755
--- a/libgfortran/configure
+++ b/libgfortran/configure
@@ -809,6 +809,7 @@ enable_silent_rules
 enable_maintainer_mode
 enable_multilib
 enable_dependency_tracking
+with_toolexeclibdir
 enable_cet
 enable_symvers
 with_gnu_ld
@@ -1480,6 +1481,9 @@ Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
   --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
   --with-build-libsubdir=DIR  Directory where to find libraries for build system
+  --with-toolexeclibdir=DIR
+                          install libraries built with a cross compiler within
+                          DIR
   --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]
@@ -5173,6 +5177,22 @@ $as_echo "$ac_cv_safe_to_define___extensions__" >&6; }
 
 
 
+
+# Check whether --with-toolexeclibdir was given.
+if test "${with_toolexeclibdir+set}" = set; then :
+  withval=$with_toolexeclibdir; case ${with_toolexeclibdir} in
+  /)
+    ;;
+  */)
+    with_toolexeclibdir=`echo $with_toolexeclibdir | sed 's,/$,,'`
+    ;;
+esac
+else
+  with_toolexeclibdir=no
+fi
+
+
+
 # Calculate toolexeclibdir
 # Also toolexecdir, though it's only used in toolexeclibdir
 case ${version_specific_libs} in
@@ -5188,7 +5208,14 @@ case ${version_specific_libs} in
        test x"$with_cross_host" != x"no"; then
       # Install a library built with a cross compiler in tooldir, not libdir.
       toolexecdir='$(exec_prefix)/$(target_alias)'
-      toolexeclibdir='$(toolexecdir)/lib'
+      case ${with_toolexeclibdir} in
+	no)
+	  toolexeclibdir='$(toolexecdir)/lib'
+	  ;;
+	*)
+	  toolexeclibdir=${with_toolexeclibdir}
+	  ;;
+      esac
     else
       toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
       toolexeclibdir='$(libdir)'
@@ -12692,7 +12719,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12695 "configure"
+#line 12722 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12798,7 +12825,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12801 "configure"
+#line 12828 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
diff --git a/libgfortran/configure.ac b/libgfortran/configure.ac
index 8dcc860..b2b9ee9 100644
--- a/libgfortran/configure.ac
+++ b/libgfortran/configure.ac
@@ -86,6 +86,8 @@ fi
 
 AC_USE_SYSTEM_EXTENSIONS
 
+GCC_WITH_TOOLEXECLIBDIR
+
 # Calculate toolexeclibdir
 # Also toolexecdir, though it's only used in toolexeclibdir
 case ${version_specific_libs} in
@@ -101,7 +103,14 @@ case ${version_specific_libs} in
        test x"$with_cross_host" != x"no"; then
       # Install a library built with a cross compiler in tooldir, not libdir.
       toolexecdir='$(exec_prefix)/$(target_alias)'
-      toolexeclibdir='$(toolexecdir)/lib'
+      case ${with_toolexeclibdir} in
+	no)
+	  toolexeclibdir='$(toolexecdir)/lib'
+	  ;;
+	*)
+	  toolexeclibdir=${with_toolexeclibdir}
+	  ;;
+      esac
     else
       toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
       toolexeclibdir='$(libdir)'
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index 7216270..b8fa7d4 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,3 +1,11 @@
+2020-01-24  Maciej W. Rozycki  <macro@wdc.com>
+
+	* configure.ac: Handle `--with-toolexeclibdir='.
+	* Makefile.in: Regenerate.
+	* aclocal.m4: Regenerate.
+	* configure: Regenerate.
+	* testsuite/Makefile.in: Regenerate.
+
 2020-01-24  Frederik Harwath  <frederik@codesourcery.com>
 
 	* testsuite/libgomp.oacc-c-c++-common/acc_get_property-aux.c
diff --git a/libgomp/Makefile.in b/libgomp/Makefile.in
index 3d772ee..7c426ca 100644
--- a/libgomp/Makefile.in
+++ b/libgomp/Makefile.in
@@ -133,10 +133,12 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
 	$(top_srcdir)/../config/lthostflags.m4 \
 	$(top_srcdir)/../config/multi.m4 \
 	$(top_srcdir)/../config/override.m4 \
-	$(top_srcdir)/../config/tls.m4 $(top_srcdir)/../ltoptions.m4 \
-	$(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
-	$(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \
-	$(top_srcdir)/../libtool.m4 $(top_srcdir)/../config/cet.m4 \
+	$(top_srcdir)/../config/tls.m4 \
+	$(top_srcdir)/../config/toolexeclibdir.m4 \
+	$(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
+	$(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
+	$(top_srcdir)/acinclude.m4 $(top_srcdir)/../libtool.m4 \
+	$(top_srcdir)/../config/cet.m4 \
 	$(top_srcdir)/plugin/configfrag.ac $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
diff --git a/libgomp/aclocal.m4 b/libgomp/aclocal.m4
index 1212599..55d9d71 100644
--- a/libgomp/aclocal.m4
+++ b/libgomp/aclocal.m4
@@ -1177,6 +1177,7 @@ m4_include([../config/lthostflags.m4])
 m4_include([../config/multi.m4])
 m4_include([../config/override.m4])
 m4_include([../config/tls.m4])
+m4_include([../config/toolexeclibdir.m4])
 m4_include([../ltoptions.m4])
 m4_include([../ltsugar.m4])
 m4_include([../ltversion.m4])
diff --git a/libgomp/configure b/libgomp/configure
index 04a6fd9..06fb40b 100755
--- a/libgomp/configure
+++ b/libgomp/configure
@@ -826,6 +826,7 @@ enable_version_specific_runtime_libs
 enable_generated_files_in_srcdir
 enable_silent_rules
 enable_multilib
+with_toolexeclibdir
 enable_dependency_tracking
 enable_shared
 enable_static
@@ -1505,6 +1506,9 @@ Optional Features:
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
   --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
+  --with-toolexeclibdir=DIR
+                          install libraries built with a cross compiler within
+                          DIR
   --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]
@@ -3501,6 +3505,22 @@ fi
 ac_config_commands="$ac_config_commands default-1"
 
 
+
+# Check whether --with-toolexeclibdir was given.
+if test "${with_toolexeclibdir+set}" = set; then :
+  withval=$with_toolexeclibdir; case ${with_toolexeclibdir} in
+  /)
+    ;;
+  */)
+    with_toolexeclibdir=`echo $with_toolexeclibdir | sed 's,/$,,'`
+    ;;
+esac
+else
+  with_toolexeclibdir=no
+fi
+
+
+
 # Calculate toolexeclibdir
 # Also toolexecdir, though it's only used in toolexeclibdir
 case ${enable_version_specific_runtime_libs} in
@@ -3516,7 +3536,14 @@ case ${enable_version_specific_runtime_libs} in
        test x"$with_cross_host" != x"no"; then
       # Install a library built with a cross compiler in tooldir, not libdir.
       toolexecdir='$(exec_prefix)/$(target_alias)'
-      toolexeclibdir='$(toolexecdir)/lib'
+      case ${with_toolexeclibdir} in
+	no)
+	  toolexeclibdir='$(toolexecdir)/lib'
+	  ;;
+	*)
+	  toolexeclibdir=${with_toolexeclibdir}
+	  ;;
+      esac
     else
       toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
       toolexeclibdir='$(libdir)'
@@ -11405,7 +11432,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11408 "configure"
+#line 11435 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11511,7 +11538,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11514 "configure"
+#line 11541 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
diff --git a/libgomp/configure.ac b/libgomp/configure.ac
index 725f3bf..be53881 100644
--- a/libgomp/configure.ac
+++ b/libgomp/configure.ac
@@ -64,6 +64,8 @@ target_alias=${target_alias-$host_alias}
 AM_INIT_AUTOMAKE([1.9.0 foreign no-dist -Wall -Wno-portability -Wno-override])
 AM_ENABLE_MULTILIB(, ..)
 
+GCC_WITH_TOOLEXECLIBDIR
+
 # Calculate toolexeclibdir
 # Also toolexecdir, though it's only used in toolexeclibdir
 case ${enable_version_specific_runtime_libs} in
@@ -79,7 +81,14 @@ case ${enable_version_specific_runtime_libs} in
        test x"$with_cross_host" != x"no"; then
       # Install a library built with a cross compiler in tooldir, not libdir.
       toolexecdir='$(exec_prefix)/$(target_alias)'
-      toolexeclibdir='$(toolexecdir)/lib'
+      case ${with_toolexeclibdir} in
+	no)
+	  toolexeclibdir='$(toolexecdir)/lib'
+	  ;;
+	*)
+	  toolexeclibdir=${with_toolexeclibdir}
+	  ;;
+      esac
     else
       toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
       toolexeclibdir='$(libdir)'
diff --git a/libgomp/testsuite/Makefile.in b/libgomp/testsuite/Makefile.in
index f0da16d..bf17761 100644
--- a/libgomp/testsuite/Makefile.in
+++ b/libgomp/testsuite/Makefile.in
@@ -99,10 +99,12 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
 	$(top_srcdir)/../config/lthostflags.m4 \
 	$(top_srcdir)/../config/multi.m4 \
 	$(top_srcdir)/../config/override.m4 \
-	$(top_srcdir)/../config/tls.m4 $(top_srcdir)/../ltoptions.m4 \
-	$(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
-	$(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \
-	$(top_srcdir)/../libtool.m4 $(top_srcdir)/../config/cet.m4 \
+	$(top_srcdir)/../config/tls.m4 \
+	$(top_srcdir)/../config/toolexeclibdir.m4 \
+	$(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
+	$(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
+	$(top_srcdir)/acinclude.m4 $(top_srcdir)/../libtool.m4 \
+	$(top_srcdir)/../config/cet.m4 \
 	$(top_srcdir)/plugin/configfrag.ac $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
diff --git a/libhsail-rt/ChangeLog b/libhsail-rt/ChangeLog
index 6bb9d04..5f32d42 100644
--- a/libhsail-rt/ChangeLog
+++ b/libhsail-rt/ChangeLog
@@ -1,3 +1,10 @@
+2020-01-24  Maciej W. Rozycki  <macro@wdc.com>
+
+	* configure.ac: Handle `--with-toolexeclibdir='.
+	* Makefile.in: Regenerate.
+	* aclocal.m4: Regenerate.
+	* configure: Regenerate.
+
 2020-01-01  Jakub Jelinek  <jakub@redhat.com>
 
 	Update copyright years.
diff --git a/libhsail-rt/Makefile.in b/libhsail-rt/Makefile.in
index 31ed36e7..84ad412 100644
--- a/libhsail-rt/Makefile.in
+++ b/libhsail-rt/Makefile.in
@@ -139,6 +139,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
 	$(top_srcdir)/../config/depstand.m4 \
 	$(top_srcdir)/../config/lead-dot.m4 \
 	$(top_srcdir)/../config/override.m4 \
+	$(top_srcdir)/../config/toolexeclibdir.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
diff --git a/libhsail-rt/aclocal.m4 b/libhsail-rt/aclocal.m4
index 45e16bb..0e98ed6 100644
--- a/libhsail-rt/aclocal.m4
+++ b/libhsail-rt/aclocal.m4
@@ -1171,6 +1171,7 @@ m4_include([../config/acx.m4])
 m4_include([../config/depstand.m4])
 m4_include([../config/lead-dot.m4])
 m4_include([../config/override.m4])
+m4_include([../config/toolexeclibdir.m4])
 m4_include([../libtool.m4])
 m4_include([../ltoptions.m4])
 m4_include([../ltsugar.m4])
diff --git a/libhsail-rt/configure b/libhsail-rt/configure
index b03ab72..49d529c 100755
--- a/libhsail-rt/configure
+++ b/libhsail-rt/configure
@@ -773,6 +773,7 @@ enable_silent_rules
 enable_maintainer_mode
 enable_dependency_tracking
 enable_version_specific_runtime_libs
+with_toolexeclibdir
 enable_shared
 enable_static
 with_pic
@@ -1435,6 +1436,9 @@ Optional Features:
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
   --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
+  --with-toolexeclibdir=DIR
+                          install libraries built with a cross compiler within
+                          DIR
   --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]
@@ -4653,6 +4657,22 @@ fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_version_specific_runtime_libs" >&5
 $as_echo "$enable_version_specific_runtime_libs" >&6; }
 
+
+# Check whether --with-toolexeclibdir was given.
+if test "${with_toolexeclibdir+set}" = set; then :
+  withval=$with_toolexeclibdir; case ${with_toolexeclibdir} in
+  /)
+    ;;
+  */)
+    with_toolexeclibdir=`echo $with_toolexeclibdir | sed 's,/$,,'`
+    ;;
+esac
+else
+  with_toolexeclibdir=no
+fi
+
+
+
 # Calculate toolexeclibdir
 # Also toolexecdir, though it's only used in toolexeclibdir
 case ${enable_version_specific_runtime_libs} in
@@ -4668,7 +4688,14 @@ case ${enable_version_specific_runtime_libs} in
        test x"$with_cross_host" != x"no"; then
       # Install a library built with a cross compiler in tooldir, not libdir.
       toolexecdir='$(exec_prefix)/$(target_alias)'
-      toolexeclibdir='$(toolexecdir)/lib'
+      case ${with_toolexeclibdir} in
+	no)
+	  toolexeclibdir='$(toolexecdir)/lib'
+	  ;;
+	*)
+	  toolexeclibdir=${with_toolexeclibdir}
+	  ;;
+      esac
     else
       toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
       toolexeclibdir='$(libdir)'
@@ -11212,7 +11239,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11215 "configure"
+#line 11242 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11318,7 +11345,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11321 "configure"
+#line 11348 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
diff --git a/libhsail-rt/configure.ac b/libhsail-rt/configure.ac
index 86bf6dd..f024b64 100644
--- a/libhsail-rt/configure.ac
+++ b/libhsail-rt/configure.ac
@@ -69,6 +69,8 @@ ler-specific directory]),
   [enable_version_specific_runtime_libs=no])
 AC_MSG_RESULT($enable_version_specific_runtime_libs)
 
+GCC_WITH_TOOLEXECLIBDIR
+
 # Calculate toolexeclibdir
 # Also toolexecdir, though it's only used in toolexeclibdir
 case ${enable_version_specific_runtime_libs} in
@@ -84,7 +86,14 @@ case ${enable_version_specific_runtime_libs} in
        test x"$with_cross_host" != x"no"; then
       # Install a library built with a cross compiler in tooldir, not libdir.
       toolexecdir='$(exec_prefix)/$(target_alias)'
-      toolexeclibdir='$(toolexecdir)/lib'
+      case ${with_toolexeclibdir} in
+	no)
+	  toolexeclibdir='$(toolexecdir)/lib'
+	  ;;
+	*)
+	  toolexeclibdir=${with_toolexeclibdir}
+	  ;;
+      esac
     else
       toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
       toolexeclibdir='$(libdir)'
diff --git a/libitm/ChangeLog b/libitm/ChangeLog
index b1313d7..feccd16 100644
--- a/libitm/ChangeLog
+++ b/libitm/ChangeLog
@@ -1,3 +1,11 @@
+2020-01-24  Maciej W. Rozycki  <macro@wdc.com>
+
+	* configure.ac: Handle `--with-toolexeclibdir='.
+	* Makefile.in: Regenerate.
+	* aclocal.m4: Regenerate.
+	* configure: Regenerate.
+	* testsuite/Makefile.in: Regenerate.
+
 2020-01-01  Jakub Jelinek  <jakub@redhat.com>
 
 	Update copyright years.
diff --git a/libitm/Makefile.in b/libitm/Makefile.in
index 6f77755..7f53ea9 100644
--- a/libitm/Makefile.in
+++ b/libitm/Makefile.in
@@ -107,6 +107,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
 	$(top_srcdir)/../config/override.m4 \
 	$(top_srcdir)/../config/stdint.m4 \
 	$(top_srcdir)/../config/tls.m4 \
+	$(top_srcdir)/../config/toolexeclibdir.m4 \
 	$(top_srcdir)/../config/weakref.m4 \
 	$(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
 	$(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
diff --git a/libitm/aclocal.m4 b/libitm/aclocal.m4
index 26748bf..4f65f69 100644
--- a/libitm/aclocal.m4
+++ b/libitm/aclocal.m4
@@ -1199,6 +1199,7 @@ m4_include([../config/multi.m4])
 m4_include([../config/override.m4])
 m4_include([../config/stdint.m4])
 m4_include([../config/tls.m4])
+m4_include([../config/toolexeclibdir.m4])
 m4_include([../config/weakref.m4])
 m4_include([../ltoptions.m4])
 m4_include([../ltsugar.m4])
diff --git a/libitm/configure b/libitm/configure
index 6342c58..97db1bc 100644
--- a/libitm/configure
+++ b/libitm/configure
@@ -802,6 +802,7 @@ enable_version_specific_runtime_libs
 enable_generated_files_in_srcdir
 enable_silent_rules
 enable_multilib
+with_toolexeclibdir
 enable_dependency_tracking
 enable_shared
 enable_static
@@ -1472,6 +1473,9 @@ Optional Features:
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
   --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
+  --with-toolexeclibdir=DIR
+                          install libraries built with a cross compiler within
+                          DIR
   --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]
@@ -3527,6 +3531,22 @@ fi
 ac_config_commands="$ac_config_commands default-1"
 
 
+
+# Check whether --with-toolexeclibdir was given.
+if test "${with_toolexeclibdir+set}" = set; then :
+  withval=$with_toolexeclibdir; case ${with_toolexeclibdir} in
+  /)
+    ;;
+  */)
+    with_toolexeclibdir=`echo $with_toolexeclibdir | sed 's,/$,,'`
+    ;;
+esac
+else
+  with_toolexeclibdir=no
+fi
+
+
+
 # Calculate toolexeclibdir
 # Also toolexecdir, though it's only used in toolexeclibdir
 case ${enable_version_specific_runtime_libs} in
@@ -3542,7 +3562,14 @@ case ${enable_version_specific_runtime_libs} in
        test x"$with_cross_host" != x"no"; then
       # Install a library built with a cross compiler in tooldir, not libdir.
       toolexecdir='$(exec_prefix)/$(target_alias)'
-      toolexeclibdir='$(toolexecdir)/lib'
+      case ${with_toolexeclibdir} in
+	no)
+	  toolexeclibdir='$(toolexecdir)/lib'
+	  ;;
+	*)
+	  toolexeclibdir=${with_toolexeclibdir}
+	  ;;
+      esac
     else
       toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
       toolexeclibdir='$(libdir)'
@@ -12037,7 +12064,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12040 "configure"
+#line 12067 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12143,7 +12170,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12146 "configure"
+#line 12173 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
diff --git a/libitm/configure.ac b/libitm/configure.ac
index ca66033..9422889 100644
--- a/libitm/configure.ac
+++ b/libitm/configure.ac
@@ -78,6 +78,8 @@ target_alias=${target_alias-$host_alias}
 AM_INIT_AUTOMAKE([1.9.0 foreign no-dist -Wall -Wno-portability -Wno-override])
 AM_ENABLE_MULTILIB(, ..)
 
+GCC_WITH_TOOLEXECLIBDIR
+
 # Calculate toolexeclibdir
 # Also toolexecdir, though it's only used in toolexeclibdir
 case ${enable_version_specific_runtime_libs} in
@@ -93,7 +95,14 @@ case ${enable_version_specific_runtime_libs} in
        test x"$with_cross_host" != x"no"; then
       # Install a library built with a cross compiler in tooldir, not libdir.
       toolexecdir='$(exec_prefix)/$(target_alias)'
-      toolexeclibdir='$(toolexecdir)/lib'
+      case ${with_toolexeclibdir} in
+	no)
+	  toolexeclibdir='$(toolexecdir)/lib'
+	  ;;
+	*)
+	  toolexeclibdir=${with_toolexeclibdir}
+	  ;;
+      esac
     else
       toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
       toolexeclibdir='$(libdir)'
diff --git a/libitm/testsuite/Makefile.in b/libitm/testsuite/Makefile.in
index 991f02c..120696d 100644
--- a/libitm/testsuite/Makefile.in
+++ b/libitm/testsuite/Makefile.in
@@ -102,6 +102,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
 	$(top_srcdir)/../config/override.m4 \
 	$(top_srcdir)/../config/stdint.m4 \
 	$(top_srcdir)/../config/tls.m4 \
+	$(top_srcdir)/../config/toolexeclibdir.m4 \
 	$(top_srcdir)/../config/weakref.m4 \
 	$(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
 	$(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
diff --git a/libobjc/ChangeLog b/libobjc/ChangeLog
index b8ebab2..db7fce7 100644
--- a/libobjc/ChangeLog
+++ b/libobjc/ChangeLog
@@ -1,3 +1,10 @@
+2020-01-24  Maciej W. Rozycki  <macro@wdc.com>
+
+	* Makefile.in (aclocal_deps): Add `toolexeclibdir.m4'.
+	* aclocal.m4: Include `toolexeclibdir.m4'.
+	* configure.ac: Handle `--with-toolexeclibdir='.
+	* configure: Regenerate.
+
 2020-01-01  Andrew Pinski  <pinskia@gmail.com>
 
 	PR libobjc/93099
diff --git a/libobjc/Makefile.in b/libobjc/Makefile.in
index 0f7cdcb..46c8540 100644
--- a/libobjc/Makefile.in
+++ b/libobjc/Makefile.in
@@ -293,6 +293,7 @@ aclocal_deps = \
 	$(srcdir)/../config/multi.m4 \
 	$(srcdir)/../config/override.m4 \
 	$(srcdir)/../config/proginstall.m4 \
+	$(srcdir)/../config/toolexeclibdir.m4 \
 	$(srcdir)/../ltoptions.m4 \
 	$(srcdir)/../ltsugar.m4 \
 	$(srcdir)/../ltversion.m4 \
diff --git a/libobjc/aclocal.m4 b/libobjc/aclocal.m4
index 942b617..9ac0f64 100644
--- a/libobjc/aclocal.m4
+++ b/libobjc/aclocal.m4
@@ -153,4 +153,5 @@ m4_include([../config/cet.m4])
 m4_include([../config/lthostflags.m4])
 m4_include([../config/multi.m4])
 m4_include([../config/override.m4])
+m4_include([../config/toolexeclibdir.m4])
 m4_include([acinclude.m4])
diff --git a/libobjc/configure b/libobjc/configure
index f7ea2e1..46124b2 100755
--- a/libobjc/configure
+++ b/libobjc/configure
@@ -746,6 +746,7 @@ with_target_subdir
 with_cross_host
 enable_version_specific_runtime_libs
 enable_multilib
+with_toolexeclibdir
 enable_cet
 enable_maintainer_mode
 enable_shared
@@ -1402,6 +1403,9 @@ Optional Packages:
   --with-target-subdir=SUBDIR
                            configuring in a subdirectory
   --with-cross-host=HOST  configuring with a cross compiler
+  --with-toolexeclibdir=DIR
+                          install libraries built with a cross compiler within
+                          DIR
   --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]
@@ -2502,6 +2506,22 @@ case $srcdir in
 esac
 
 
+
+# Check whether --with-toolexeclibdir was given.
+if test "${with_toolexeclibdir+set}" = set; then :
+  withval=$with_toolexeclibdir; case ${with_toolexeclibdir} in
+  /)
+    ;;
+  */)
+    with_toolexeclibdir=`echo $with_toolexeclibdir | sed 's,/$,,'`
+    ;;
+esac
+else
+  with_toolexeclibdir=no
+fi
+
+
+
 # Calculate toolexeclibdir
 # Also toolexecdir, though it's only used in toolexeclibdir
 case ${version_specific_libs} in
@@ -2517,7 +2537,14 @@ case ${version_specific_libs} in
        test x"$with_cross_host" != x"no"; then
       # Install a library built with a cross compiler in tooldir, not libdir.
       toolexecdir='$(exec_prefix)/$(target_noncanonical)'
-      toolexeclibdir='$(toolexecdir)/lib'
+      case ${with_toolexeclibdir} in
+	no)
+	  toolexeclibdir='$(toolexecdir)/lib'
+	  ;;
+	*)
+	  toolexeclibdir=${with_toolexeclibdir}
+	  ;;
+      esac
     else
       toolexecdir='$(libdir)/gcc-lib/$(target_noncanonical)'
       toolexeclibdir='$(libdir)'
@@ -10748,7 +10775,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10751 "configure"
+#line 10778 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -10854,7 +10881,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10857 "configure"
+#line 10884 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
diff --git a/libobjc/configure.ac b/libobjc/configure.ac
index 716dc67..9c8aa82 100644
--- a/libobjc/configure.ac
+++ b/libobjc/configure.ac
@@ -76,6 +76,8 @@ case $srcdir in
 esac
 AC_SUBST(glibcpp_srcdir)
 
+GCC_WITH_TOOLEXECLIBDIR
+
 # Calculate toolexeclibdir
 # Also toolexecdir, though it's only used in toolexeclibdir
 case ${version_specific_libs} in
@@ -91,7 +93,14 @@ case ${version_specific_libs} in
        test x"$with_cross_host" != x"no"; then
       # Install a library built with a cross compiler in tooldir, not libdir.
       toolexecdir='$(exec_prefix)/$(target_noncanonical)'
-      toolexeclibdir='$(toolexecdir)/lib'
+      case ${with_toolexeclibdir} in
+	no)
+	  toolexeclibdir='$(toolexecdir)/lib'
+	  ;;
+	*)
+	  toolexeclibdir=${with_toolexeclibdir}
+	  ;;
+      esac
     else
       toolexecdir='$(libdir)/gcc-lib/$(target_noncanonical)'
       toolexeclibdir='$(libdir)'
diff --git a/liboffloadmic/ChangeLog b/liboffloadmic/ChangeLog
index eba5100..2c3cfff 100644
--- a/liboffloadmic/ChangeLog
+++ b/liboffloadmic/ChangeLog
@@ -1,3 +1,14 @@
+2020-01-24  Maciej W. Rozycki  <macro@wdc.com>
+
+	* plugin/configure.ac: Handle `--with-toolexeclibdir='.
+	* plugin/Makefile.in: Regenerate.
+	* plugin/aclocal.m4: Regenerate.
+	* plugin/configure: Regenerate.
+	* configure.ac: Handle `--with-toolexeclibdir='.
+	* Makefile.in: Regenerate.
+	* aclocal.m4: Regenerate.
+	* configure: Regenerate.
+
 2020-01-10  Thomas Schwinge  <thomas@codesourcery.com>
 
 	* plugin/libgomp-plugin-intelmic.cpp (GOMP_OFFLOAD_get_property):
diff --git a/liboffloadmic/Makefile.in b/liboffloadmic/Makefile.in
index 52673bc..43abc5a 100644
--- a/liboffloadmic/Makefile.in
+++ b/liboffloadmic/Makefile.in
@@ -126,6 +126,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
 	$(top_srcdir)/../config/lead-dot.m4 \
 	$(top_srcdir)/../config/multi.m4 \
 	$(top_srcdir)/../config/override.m4 \
+	$(top_srcdir)/../config/toolexeclibdir.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
diff --git a/liboffloadmic/aclocal.m4 b/liboffloadmic/aclocal.m4
index e3a3163..31a2695 100644
--- a/liboffloadmic/aclocal.m4
+++ b/liboffloadmic/aclocal.m4
@@ -1172,6 +1172,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/toolexeclibdir.m4])
 m4_include([../libtool.m4])
 m4_include([../ltoptions.m4])
 m4_include([../ltsugar.m4])
diff --git a/liboffloadmic/configure b/liboffloadmic/configure
index 3d99ffd..cd01179 100644
--- a/liboffloadmic/configure
+++ b/liboffloadmic/configure
@@ -775,6 +775,7 @@ enable_maintainer_mode
 enable_dependency_tracking
 enable_multilib
 enable_version_specific_runtime_libs
+with_toolexeclibdir
 enable_shared
 enable_static
 with_pic
@@ -1437,6 +1438,9 @@ Optional Features:
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
   --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
+  --with-toolexeclibdir=DIR
+                          install libraries built with a cross compiler within
+                          DIR
   --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]
@@ -5293,6 +5297,22 @@ else
 fi
 
 
+
+# Check whether --with-toolexeclibdir was given.
+if test "${with_toolexeclibdir+set}" = set; then :
+  withval=$with_toolexeclibdir; case ${with_toolexeclibdir} in
+  /)
+    ;;
+  */)
+    with_toolexeclibdir=`echo $with_toolexeclibdir | sed 's,/$,,'`
+    ;;
+esac
+else
+  with_toolexeclibdir=no
+fi
+
+
+
 # Calculate toolexeclibdir.
 # Also toolexecdir, though it's only used in toolexeclibdir.
 case ${enable_version_specific_runtime_libs} in
@@ -5308,7 +5328,14 @@ case ${enable_version_specific_runtime_libs} in
        test x"$with_cross_host" != x"no"; then
       # Install a library built with a cross compiler in tooldir, not libdir.
       toolexecdir='$(exec_prefix)/$(target_alias)'
-      toolexeclibdir='$(toolexecdir)/lib'
+      case ${with_toolexeclibdir} in
+	no)
+	  toolexeclibdir='$(toolexecdir)/lib'
+	  ;;
+	*)
+	  toolexeclibdir=${with_toolexeclibdir}
+	  ;;
+      esac
     else
       toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
       toolexeclibdir='$(libdir)'
@@ -11403,7 +11430,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11406 "configure"
+#line 11433 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11509,7 +11536,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11512 "configure"
+#line 11539 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
diff --git a/liboffloadmic/configure.ac b/liboffloadmic/configure.ac
index 5ee943a..f64f182 100644
--- a/liboffloadmic/configure.ac
+++ b/liboffloadmic/configure.ac
@@ -79,6 +79,8 @@ case "$enable_liboffloadmic" in
 esac
 AM_CONDITIONAL(LIBOFFLOADMIC_HOST, [test x"$enable_liboffloadmic" = xhost])
 
+GCC_WITH_TOOLEXECLIBDIR
+
 # Calculate toolexeclibdir.
 # Also toolexecdir, though it's only used in toolexeclibdir.
 case ${enable_version_specific_runtime_libs} in
@@ -94,7 +96,14 @@ case ${enable_version_specific_runtime_libs} in
        test x"$with_cross_host" != x"no"; then
       # Install a library built with a cross compiler in tooldir, not libdir.
       toolexecdir='$(exec_prefix)/$(target_alias)'
-      toolexeclibdir='$(toolexecdir)/lib'
+      case ${with_toolexeclibdir} in
+	no)
+	  toolexeclibdir='$(toolexecdir)/lib'
+	  ;;
+	*)
+	  toolexeclibdir=${with_toolexeclibdir}
+	  ;;
+      esac
     else
       toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
       toolexeclibdir='$(libdir)'
diff --git a/liboffloadmic/plugin/Makefile.in b/liboffloadmic/plugin/Makefile.in
index 3a1c768..8d5ad00 100644
--- a/liboffloadmic/plugin/Makefile.in
+++ b/liboffloadmic/plugin/Makefile.in
@@ -123,6 +123,7 @@ subdir = .
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/../../config/acx.m4 \
 	$(top_srcdir)/../../config/depstand.m4 \
+	$(top_srcdir)/../../config/toolexeclibdir.m4 \
 	$(top_srcdir)/../../config/lead-dot.m4 \
 	$(top_srcdir)/../../config/multi.m4 \
 	$(top_srcdir)/../../config/override.m4 \
diff --git a/liboffloadmic/plugin/aclocal.m4 b/liboffloadmic/plugin/aclocal.m4
index 2cdbf54..9fa1d12 100644
--- a/liboffloadmic/plugin/aclocal.m4
+++ b/liboffloadmic/plugin/aclocal.m4
@@ -1169,6 +1169,7 @@ AC_SUBST([am__untar])
 
 m4_include([../../config/acx.m4])
 m4_include([../../config/depstand.m4])
+m4_include([../../config/toolexeclibdir.m4])
 m4_include([../../config/lead-dot.m4])
 m4_include([../../config/multi.m4])
 m4_include([../../config/override.m4])
diff --git a/liboffloadmic/plugin/configure b/liboffloadmic/plugin/configure
index 1ad6455..cf48522 100644
--- a/liboffloadmic/plugin/configure
+++ b/liboffloadmic/plugin/configure
@@ -771,6 +771,7 @@ enable_maintainer_mode
 enable_dependency_tracking
 enable_multilib
 enable_version_specific_runtime_libs
+with_toolexeclibdir
 enable_shared
 enable_static
 with_pic
@@ -1434,6 +1435,9 @@ Optional Features:
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
   --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
+  --with-toolexeclibdir=DIR
+                          install libraries built with a cross compiler within
+                          DIR
   --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]
@@ -4542,6 +4546,22 @@ fi
 $as_echo "$enable_version_specific_runtime_libs" >&6; }
 
 
+
+# Check whether --with-toolexeclibdir was given.
+if test "${with_toolexeclibdir+set}" = set; then :
+  withval=$with_toolexeclibdir; case ${with_toolexeclibdir} in
+  /)
+    ;;
+  */)
+    with_toolexeclibdir=`echo $with_toolexeclibdir | sed 's,/$,,'`
+    ;;
+esac
+else
+  with_toolexeclibdir=no
+fi
+
+
+
 # Calculate toolexeclibdir.
 # Also toolexecdir, though it's only used in toolexeclibdir.
 case ${enable_version_specific_runtime_libs} in
@@ -4557,7 +4577,14 @@ case ${enable_version_specific_runtime_libs} in
        test x"$with_cross_host" != x"no"; then
       # Install a library built with a cross compiler in tooldir, not libdir.
       toolexecdir='$(exec_prefix)/$(target_alias)'
-      toolexeclibdir='$(toolexecdir)/lib'
+      case ${with_toolexeclibdir} in
+	no)
+	  toolexeclibdir='$(toolexecdir)/lib'
+	  ;;
+	*)
+	  toolexeclibdir=${with_toolexeclibdir}
+	  ;;
+      esac
     else
       toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
       toolexeclibdir='$(libdir)'
@@ -11050,7 +11077,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11053 "configure"
+#line 11080 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11156,7 +11183,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11159 "configure"
+#line 11186 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
diff --git a/liboffloadmic/plugin/configure.ac b/liboffloadmic/plugin/configure.ac
index 8fa56bf..cbcd013 100644
--- a/liboffloadmic/plugin/configure.ac
+++ b/liboffloadmic/plugin/configure.ac
@@ -95,6 +95,8 @@ AC_ARG_ENABLE([version-specific-runtime-libs],
 AC_MSG_RESULT($enable_version_specific_runtime_libs)
 
 
+GCC_WITH_TOOLEXECLIBDIR
+
 # Calculate toolexeclibdir.
 # Also toolexecdir, though it's only used in toolexeclibdir.
 case ${enable_version_specific_runtime_libs} in
@@ -110,7 +112,14 @@ case ${enable_version_specific_runtime_libs} in
        test x"$with_cross_host" != x"no"; then
       # Install a library built with a cross compiler in tooldir, not libdir.
       toolexecdir='$(exec_prefix)/$(target_alias)'
-      toolexeclibdir='$(toolexecdir)/lib'
+      case ${with_toolexeclibdir} in
+	no)
+	  toolexeclibdir='$(toolexecdir)/lib'
+	  ;;
+	*)
+	  toolexeclibdir=${with_toolexeclibdir}
+	  ;;
+      esac
     else
       toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
       toolexeclibdir='$(libdir)'
diff --git a/libphobos/ChangeLog b/libphobos/ChangeLog
index e5063e8..285dfa5 100644
--- a/libphobos/ChangeLog
+++ b/libphobos/ChangeLog
@@ -1,3 +1,14 @@
+2020-01-24  Maciej W. Rozycki  <macro@wdc.com>
+
+	* m4/druntime.m4: Handle `--with-toolexeclibdir='.
+	* m4/Makefile.in: Regenerate.
+	* libdruntime/Makefile.in: Regenerate.
+	* src/Makefile.in: Regenerate.
+	* testsuite/Makefile.in: Regenerate.
+	* Makefile.in: Regenerate.
+	* aclocal.m4: Regenerate.
+	* configure: Regenerate.
+
 2020-01-01  Jakub Jelinek  <jakub@redhat.com>
 
 	Update copyright years.
diff --git a/libphobos/Makefile.in b/libphobos/Makefile.in
index 58368c9..4e6d044 100644
--- a/libphobos/Makefile.in
+++ b/libphobos/Makefile.in
@@ -111,6 +111,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
 	$(top_srcdir)/../config/lead-dot.m4 \
 	$(top_srcdir)/../config/multi.m4 \
 	$(top_srcdir)/../config/override.m4 \
+	$(top_srcdir)/../config/toolexeclibdir.m4 \
 	$(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
 	$(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
 	$(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \
diff --git a/libphobos/aclocal.m4 b/libphobos/aclocal.m4
index dc5595b..899592d 100644
--- a/libphobos/aclocal.m4
+++ b/libphobos/aclocal.m4
@@ -876,6 +876,7 @@ m4_include([../config/acx.m4])
 m4_include([../config/lead-dot.m4])
 m4_include([../config/multi.m4])
 m4_include([../config/override.m4])
+m4_include([../config/toolexeclibdir.m4])
 m4_include([../libtool.m4])
 m4_include([../ltoptions.m4])
 m4_include([../ltsugar.m4])
diff --git a/libphobos/configure b/libphobos/configure
index fde2af9..741e23e 100755
--- a/libphobos/configure
+++ b/libphobos/configure
@@ -837,6 +837,7 @@ with_libbacktrace
 with_target_system_zlib
 with_cross_host
 enable_version_specific_runtime_libs
+with_toolexeclibdir
 enable_libphobos
 '
       ac_precious_vars='build_alias
@@ -1504,6 +1505,9 @@ Optional Packages:
   --with-target-system-zlib={yes,no,auto}
                           use installed libz (default: no)
   --with-cross-host=HOST  configuring with a cross compiler
+  --with-toolexeclibdir=DIR
+                          install libraries built with a cross compiler within
+                          DIR
 
 Some influential environment variables:
   CC          C compiler command
@@ -11640,7 +11644,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11643 "configure"
+#line 11647 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11746,7 +11750,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11749 "configure"
+#line 11753 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -15237,6 +15241,22 @@ fi
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $version_specific_libs" >&5
 $as_echo "$version_specific_libs" >&6; }
 
+
+# Check whether --with-toolexeclibdir was given.
+if test "${with_toolexeclibdir+set}" = set; then :
+  withval=$with_toolexeclibdir; case ${with_toolexeclibdir} in
+  /)
+    ;;
+  */)
+    with_toolexeclibdir=`echo $with_toolexeclibdir | sed 's,/$,,'`
+    ;;
+esac
+else
+  with_toolexeclibdir=no
+fi
+
+
+
   # Version-specific runtime libs processing.
   if test $version_specific_libs = yes; then
     libphobos_toolexecdir='${libdir}/gcc/${host_alias}'
@@ -15246,7 +15266,14 @@ $as_echo "$version_specific_libs" >&6; }
     # Install a library built with a cross compiler in tooldir, not libdir.
     if test -n "$with_cross_host" && test x"$with_cross_host" != x"no"; then
       libphobos_toolexecdir='${exec_prefix}/${host_alias}'
-      libphobos_toolexeclibdir='${toolexecdir}/lib'
+      case ${with_toolexeclibdir} in
+	no)
+	  libphobos_toolexeclibdir='${toolexecdir}/lib'
+	  ;;
+	*)
+	  libphobos_toolexeclibdir=${with_toolexeclibdir}
+	  ;;
+      esac
     else
       libphobos_toolexecdir='${libdir}/gcc/${host_alias}'
       libphobos_toolexeclibdir='${libdir}'
diff --git a/libphobos/libdruntime/Makefile.in b/libphobos/libdruntime/Makefile.in
index aaf05b5..6342230 100644
--- a/libphobos/libdruntime/Makefile.in
+++ b/libphobos/libdruntime/Makefile.in
@@ -136,6 +136,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
 	$(top_srcdir)/../config/lead-dot.m4 \
 	$(top_srcdir)/../config/multi.m4 \
 	$(top_srcdir)/../config/override.m4 \
+	$(top_srcdir)/../config/toolexeclibdir.m4 \
 	$(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
 	$(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
 	$(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \
diff --git a/libphobos/m4/druntime.m4 b/libphobos/m4/druntime.m4
index 978c5fe..3b6e474 100644
--- a/libphobos/m4/druntime.m4
+++ b/libphobos/m4/druntime.m4
@@ -80,6 +80,8 @@ AC_DEFUN([DRUNTIME_INSTALL_DIRECTORIES],
     [version_specific_libs=no])
   AC_MSG_RESULT($version_specific_libs)
 
+  GCC_WITH_TOOLEXECLIBDIR
+
   # Version-specific runtime libs processing.
   if test $version_specific_libs = yes; then
     libphobos_toolexecdir='${libdir}/gcc/${host_alias}'
@@ -89,7 +91,14 @@ AC_DEFUN([DRUNTIME_INSTALL_DIRECTORIES],
     # Install a library built with a cross compiler in tooldir, not libdir.
     if test -n "$with_cross_host" && test x"$with_cross_host" != x"no"; then
       libphobos_toolexecdir='${exec_prefix}/${host_alias}'
-      libphobos_toolexeclibdir='${toolexecdir}/lib'
+      case ${with_toolexeclibdir} in
+	no)
+	  libphobos_toolexeclibdir='${toolexecdir}/lib'
+	  ;;
+	*)
+	  libphobos_toolexeclibdir=${with_toolexeclibdir}
+	  ;;
+      esac
     else
       libphobos_toolexecdir='${libdir}/gcc/${host_alias}'
       libphobos_toolexeclibdir='${libdir}'
diff --git a/libphobos/src/Makefile.in b/libphobos/src/Makefile.in
index 5a46cb9..c30b66d 100644
--- a/libphobos/src/Makefile.in
+++ b/libphobos/src/Makefile.in
@@ -96,6 +96,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
 	$(top_srcdir)/../config/lead-dot.m4 \
 	$(top_srcdir)/../config/multi.m4 \
 	$(top_srcdir)/../config/override.m4 \
+	$(top_srcdir)/../config/toolexeclibdir.m4 \
 	$(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
 	$(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
 	$(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \
diff --git a/libphobos/testsuite/Makefile.in b/libphobos/testsuite/Makefile.in
index efbd884..72e6d04 100644
--- a/libphobos/testsuite/Makefile.in
+++ b/libphobos/testsuite/Makefile.in
@@ -96,6 +96,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
 	$(top_srcdir)/../config/lead-dot.m4 \
 	$(top_srcdir)/../config/multi.m4 \
 	$(top_srcdir)/../config/override.m4 \
+	$(top_srcdir)/../config/toolexeclibdir.m4 \
 	$(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
 	$(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
 	$(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \
diff --git a/libquadmath/ChangeLog b/libquadmath/ChangeLog
index 9b159b5..0b1db14 100644
--- a/libquadmath/ChangeLog
+++ b/libquadmath/ChangeLog
@@ -1,3 +1,10 @@
+2020-01-24  Maciej W. Rozycki  <macro@wdc.com>
+
+	* configure.ac: Handle `--with-toolexeclibdir='.
+	* Makefile.in: Regenerate.
+	* aclocal.m4: Regenerate.
+	* configure: Regenerate.
+
 2020-01-01  Jakub Jelinek  <jakub@redhat.com>
 
 	Update copyright years.
diff --git a/libquadmath/Makefile.in b/libquadmath/Makefile.in
index 32cf509..8c01121 100644
--- a/libquadmath/Makefile.in
+++ b/libquadmath/Makefile.in
@@ -100,6 +100,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
 	$(top_srcdir)/../config/multi.m4 \
 	$(top_srcdir)/../config/no-executables.m4 \
 	$(top_srcdir)/../config/override.m4 \
+	$(top_srcdir)/../config/toolexeclibdir.m4 \
 	$(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
 	$(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
 	$(top_srcdir)/acinclude.m4 $(top_srcdir)/../libtool.m4 \
diff --git a/libquadmath/aclocal.m4 b/libquadmath/aclocal.m4
index 42c0880..f15cc0b 100644
--- a/libquadmath/aclocal.m4
+++ b/libquadmath/aclocal.m4
@@ -1174,6 +1174,7 @@ m4_include([../config/lthostflags.m4])
 m4_include([../config/multi.m4])
 m4_include([../config/no-executables.m4])
 m4_include([../config/override.m4])
+m4_include([../config/toolexeclibdir.m4])
 m4_include([../ltoptions.m4])
 m4_include([../ltsugar.m4])
 m4_include([../ltversion.m4])
diff --git a/libquadmath/configure b/libquadmath/configure
index 053d8de..339e809 100755
--- a/libquadmath/configure
+++ b/libquadmath/configure
@@ -786,6 +786,7 @@ enable_fast_install
 with_gnu_ld
 enable_libtool_lock
 enable_maintainer_mode
+with_toolexeclibdir
 enable_symvers
 enable_cet
 enable_generated_files_in_srcdir
@@ -1451,6 +1452,9 @@ 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-toolexeclibdir=DIR
+                          install libraries built with a cross compiler within
+                          DIR
   --with-gcc-major-version-only
                           use only GCC major number in filesystem paths
 
@@ -10810,7 +10814,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10813 "configure"
+#line 10817 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -10916,7 +10920,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10919 "configure"
+#line 10923 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12088,6 +12092,22 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
+
+# Check whether --with-toolexeclibdir was given.
+if test "${with_toolexeclibdir+set}" = set; then :
+  withval=$with_toolexeclibdir; case ${with_toolexeclibdir} in
+  /)
+    ;;
+  */)
+    with_toolexeclibdir=`echo $with_toolexeclibdir | sed 's,/$,,'`
+    ;;
+esac
+else
+  with_toolexeclibdir=no
+fi
+
+
+
 # Calculate toolexeclibdir
 # Also toolexecdir, though it's only used in toolexeclibdir
 case ${version_specific_libs} in
@@ -12103,7 +12123,14 @@ case ${version_specific_libs} in
        test x"$with_cross_host" != x"no"; then
       # Install a library built with a cross compiler in tooldir, not libdir.
       toolexecdir='$(exec_prefix)/$(target_alias)'
-      toolexeclibdir='$(toolexecdir)/lib'
+      case ${with_toolexeclibdir} in
+	no)
+	  toolexeclibdir='$(toolexecdir)/lib'
+	  ;;
+	*)
+	  toolexeclibdir=${with_toolexeclibdir}
+	  ;;
+      esac
     else
       toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
       toolexeclibdir='$(libdir)'
diff --git a/libquadmath/configure.ac b/libquadmath/configure.ac
index b75465b..f9d745e 100644
--- a/libquadmath/configure.ac
+++ b/libquadmath/configure.ac
@@ -82,6 +82,8 @@ if test "x$GCC" != "xyes"; then
 fi
 AC_PROG_CPP
 
+GCC_WITH_TOOLEXECLIBDIR
+
 # Calculate toolexeclibdir
 # Also toolexecdir, though it's only used in toolexeclibdir
 case ${version_specific_libs} in
@@ -97,7 +99,14 @@ case ${version_specific_libs} in
        test x"$with_cross_host" != x"no"; then
       # Install a library built with a cross compiler in tooldir, not libdir.
       toolexecdir='$(exec_prefix)/$(target_alias)'
-      toolexeclibdir='$(toolexecdir)/lib'
+      case ${with_toolexeclibdir} in
+	no)
+	  toolexeclibdir='$(toolexecdir)/lib'
+	  ;;
+	*)
+	  toolexeclibdir=${with_toolexeclibdir}
+	  ;;
+      esac
     else
       toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
       toolexeclibdir='$(libdir)'
diff --git a/libsanitizer/ChangeLog b/libsanitizer/ChangeLog
index f2a07ad..16b45a4 100644
--- a/libsanitizer/ChangeLog
+++ b/libsanitizer/ChangeLog
@@ -1,3 +1,17 @@
+2020-01-24  Maciej W. Rozycki  <macro@wdc.com>
+
+	* configure.ac: Handle `--with-toolexeclibdir='.
+	* Makefile.in: Regenerate.
+	* aclocal.m4: Regenerate.
+	* configure: Regenerate.
+	* asan/Makefile.in: Regenerate.
+	* interception/Makefile.in: Regenerate.
+	* libbacktrace/Makefile.in: Regenerate.
+	* lsan/Makefile.in: Regenerate.
+	* sanitizer_common/Makefile.in: Regenerate.
+	* tsan/Makefile.in: Regenerate.
+	* ubsan/Makefile.in: Regenerate.
+
 2019-11-26  Jakub Jelinek  <jakub@redhat.com>
 
 	PR sanitizer/92154
diff --git a/libsanitizer/Makefile.in b/libsanitizer/Makefile.in
index 0d789b3..02c7f70 100644
--- a/libsanitizer/Makefile.in
+++ b/libsanitizer/Makefile.in
@@ -105,6 +105,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
 	$(top_srcdir)/../config/multi.m4 \
 	$(top_srcdir)/../config/override.m4 \
 	$(top_srcdir)/../config/stdint.m4 \
+	$(top_srcdir)/../config/toolexeclibdir.m4 \
 	$(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
 	$(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
 	$(top_srcdir)/acinclude.m4 $(top_srcdir)/../libtool.m4 \
diff --git a/libsanitizer/aclocal.m4 b/libsanitizer/aclocal.m4
index dba8277..85f72c2 100644
--- a/libsanitizer/aclocal.m4
+++ b/libsanitizer/aclocal.m4
@@ -1194,6 +1194,7 @@ m4_include([../config/libstdc++-raw-cxx.m4])
 m4_include([../config/multi.m4])
 m4_include([../config/override.m4])
 m4_include([../config/stdint.m4])
+m4_include([../config/toolexeclibdir.m4])
 m4_include([../ltoptions.m4])
 m4_include([../ltsugar.m4])
 m4_include([../ltversion.m4])
diff --git a/libsanitizer/asan/Makefile.in b/libsanitizer/asan/Makefile.in
index 00b6082..bad15b7 100644
--- a/libsanitizer/asan/Makefile.in
+++ b/libsanitizer/asan/Makefile.in
@@ -102,6 +102,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
 	$(top_srcdir)/../config/multi.m4 \
 	$(top_srcdir)/../config/override.m4 \
 	$(top_srcdir)/../config/stdint.m4 \
+	$(top_srcdir)/../config/toolexeclibdir.m4 \
 	$(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
 	$(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
 	$(top_srcdir)/acinclude.m4 $(top_srcdir)/../libtool.m4 \
diff --git a/libsanitizer/configure b/libsanitizer/configure
index 79b5c1e..0c56bdf 100755
--- a/libsanitizer/configure
+++ b/libsanitizer/configure
@@ -806,6 +806,7 @@ enable_version_specific_runtime_libs
 enable_dependency_tracking
 enable_silent_rules
 enable_maintainer_mode
+with_toolexeclibdir
 enable_shared
 enable_static
 with_pic
@@ -1470,6 +1471,9 @@ Optional Features:
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
   --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
+  --with-toolexeclibdir=DIR
+                          install libraries built with a cross compiler within
+                          DIR
   --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]
@@ -5012,6 +5016,22 @@ fi
 
 
 
+
+# Check whether --with-toolexeclibdir was given.
+if test "${with_toolexeclibdir+set}" = set; then :
+  withval=$with_toolexeclibdir; case ${with_toolexeclibdir} in
+  /)
+    ;;
+  */)
+    with_toolexeclibdir=`echo $with_toolexeclibdir | sed 's,/$,,'`
+    ;;
+esac
+else
+  with_toolexeclibdir=no
+fi
+
+
+
 # Calculate toolexeclibdir
 # Also toolexecdir, though it's only used in toolexeclibdir
 case ${version_specific_libs} in
@@ -5027,7 +5047,14 @@ case ${version_specific_libs} in
        test x"$with_cross_host" != x"no"; then
       # Install a library built with a cross compiler in tooldir, not libdir.
       toolexecdir='$(exec_prefix)/$(target_alias)'
-      toolexeclibdir='$(toolexecdir)/lib'
+      case ${with_toolexeclibdir} in
+	no)
+	  toolexeclibdir='$(toolexecdir)/lib'
+	  ;;
+	*)
+	  toolexeclibdir=${with_toolexeclibdir}
+	  ;;
+      esac
     else
       toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
       toolexeclibdir='$(libdir)'
@@ -12334,7 +12361,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12337 "configure"
+#line 12364 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12440,7 +12467,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12443 "configure"
+#line 12470 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
diff --git a/libsanitizer/configure.ac b/libsanitizer/configure.ac
index 8aac33c..a0950c29e 100644
--- a/libsanitizer/configure.ac
+++ b/libsanitizer/configure.ac
@@ -29,6 +29,8 @@ GCC_LIBSTDCXX_RAW_CXX_FLAGS
 AM_INIT_AUTOMAKE(foreign no-dist)
 AM_MAINTAINER_MODE
 
+GCC_WITH_TOOLEXECLIBDIR
+
 # Calculate toolexeclibdir
 # Also toolexecdir, though it's only used in toolexeclibdir
 case ${version_specific_libs} in
@@ -44,7 +46,14 @@ case ${version_specific_libs} in
        test x"$with_cross_host" != x"no"; then
       # Install a library built with a cross compiler in tooldir, not libdir.
       toolexecdir='$(exec_prefix)/$(target_alias)'
-      toolexeclibdir='$(toolexecdir)/lib'
+      case ${with_toolexeclibdir} in
+	no)
+	  toolexeclibdir='$(toolexecdir)/lib'
+	  ;;
+	*)
+	  toolexeclibdir=${with_toolexeclibdir}
+	  ;;
+      esac
     else
       toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
       toolexeclibdir='$(libdir)'
diff --git a/libsanitizer/interception/Makefile.in b/libsanitizer/interception/Makefile.in
index 358afe9..c8868fa 100644
--- a/libsanitizer/interception/Makefile.in
+++ b/libsanitizer/interception/Makefile.in
@@ -98,6 +98,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
 	$(top_srcdir)/../config/multi.m4 \
 	$(top_srcdir)/../config/override.m4 \
 	$(top_srcdir)/../config/stdint.m4 \
+	$(top_srcdir)/../config/toolexeclibdir.m4 \
 	$(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
 	$(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
 	$(top_srcdir)/acinclude.m4 $(top_srcdir)/../libtool.m4 \
diff --git a/libsanitizer/libbacktrace/Makefile.in b/libsanitizer/libbacktrace/Makefile.in
index f0e190a..8e65078 100644
--- a/libsanitizer/libbacktrace/Makefile.in
+++ b/libsanitizer/libbacktrace/Makefile.in
@@ -129,6 +129,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
 	$(top_srcdir)/../config/multi.m4 \
 	$(top_srcdir)/../config/override.m4 \
 	$(top_srcdir)/../config/stdint.m4 \
+	$(top_srcdir)/../config/toolexeclibdir.m4 \
 	$(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
 	$(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
 	$(top_srcdir)/acinclude.m4 $(top_srcdir)/../libtool.m4 \
diff --git a/libsanitizer/lsan/Makefile.in b/libsanitizer/lsan/Makefile.in
index 3ebf4ba..acc76ca 100644
--- a/libsanitizer/lsan/Makefile.in
+++ b/libsanitizer/lsan/Makefile.in
@@ -100,6 +100,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
 	$(top_srcdir)/../config/multi.m4 \
 	$(top_srcdir)/../config/override.m4 \
 	$(top_srcdir)/../config/stdint.m4 \
+	$(top_srcdir)/../config/toolexeclibdir.m4 \
 	$(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
 	$(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
 	$(top_srcdir)/acinclude.m4 $(top_srcdir)/../libtool.m4 \
diff --git a/libsanitizer/sanitizer_common/Makefile.in b/libsanitizer/sanitizer_common/Makefile.in
index 0fcebc8..450651b 100644
--- a/libsanitizer/sanitizer_common/Makefile.in
+++ b/libsanitizer/sanitizer_common/Makefile.in
@@ -104,6 +104,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
 	$(top_srcdir)/../config/multi.m4 \
 	$(top_srcdir)/../config/override.m4 \
 	$(top_srcdir)/../config/stdint.m4 \
+	$(top_srcdir)/../config/toolexeclibdir.m4 \
 	$(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
 	$(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
 	$(top_srcdir)/acinclude.m4 $(top_srcdir)/../libtool.m4 \
diff --git a/libsanitizer/tsan/Makefile.in b/libsanitizer/tsan/Makefile.in
index 3d1d956..7489642 100644
--- a/libsanitizer/tsan/Makefile.in
+++ b/libsanitizer/tsan/Makefile.in
@@ -101,6 +101,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
 	$(top_srcdir)/../config/multi.m4 \
 	$(top_srcdir)/../config/override.m4 \
 	$(top_srcdir)/../config/stdint.m4 \
+	$(top_srcdir)/../config/toolexeclibdir.m4 \
 	$(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
 	$(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
 	$(top_srcdir)/acinclude.m4 $(top_srcdir)/../libtool.m4 \
diff --git a/libsanitizer/ubsan/Makefile.in b/libsanitizer/ubsan/Makefile.in
index 71d2626..654cb64 100644
--- a/libsanitizer/ubsan/Makefile.in
+++ b/libsanitizer/ubsan/Makefile.in
@@ -100,6 +100,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
 	$(top_srcdir)/../config/multi.m4 \
 	$(top_srcdir)/../config/override.m4 \
 	$(top_srcdir)/../config/stdint.m4 \
+	$(top_srcdir)/../config/toolexeclibdir.m4 \
 	$(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
 	$(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
 	$(top_srcdir)/acinclude.m4 $(top_srcdir)/../libtool.m4 \
diff --git a/libssp/ChangeLog b/libssp/ChangeLog
index b0188d3..f1ccde4 100644
--- a/libssp/ChangeLog
+++ b/libssp/ChangeLog
@@ -1,3 +1,10 @@
+2020-01-24  Maciej W. Rozycki  <macro@wdc.com>
+
+	* configure.ac: Handle `--with-toolexeclibdir='.
+	* Makefile.in: Regenerate.
+	* aclocal.m4: Regenerate.
+	* configure: Regenerate.
+
 2020-01-01  Jakub Jelinek  <jakub@redhat.com>
 
 	Update copyright years.
diff --git a/libssp/Makefile.in b/libssp/Makefile.in
index c540450..bc8a0dc 100644
--- a/libssp/Makefile.in
+++ b/libssp/Makefile.in
@@ -101,6 +101,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
 	$(top_srcdir)/../config/multi.m4 \
 	$(top_srcdir)/../config/no-executables.m4 \
 	$(top_srcdir)/../config/override.m4 \
+	$(top_srcdir)/../config/toolexeclibdir.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
diff --git a/libssp/aclocal.m4 b/libssp/aclocal.m4
index 5b8192e..68fc0a4 100644
--- a/libssp/aclocal.m4
+++ b/libssp/aclocal.m4
@@ -1176,6 +1176,7 @@ m4_include([../config/lthostflags.m4])
 m4_include([../config/multi.m4])
 m4_include([../config/no-executables.m4])
 m4_include([../config/override.m4])
+m4_include([../config/toolexeclibdir.m4])
 m4_include([../libtool.m4])
 m4_include([../ltoptions.m4])
 m4_include([../ltsugar.m4])
diff --git a/libssp/configure b/libssp/configure
index dfdc5ca..5541cf9 100755
--- a/libssp/configure
+++ b/libssp/configure
@@ -781,6 +781,7 @@ with_pic
 enable_fast_install
 with_gnu_ld
 enable_libtool_lock
+with_toolexeclibdir
 with_gcc_major_version_only
 '
       ac_precious_vars='build_alias
@@ -1432,6 +1433,9 @@ 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-toolexeclibdir=DIR
+                          install libraries built with a cross compiler within
+                          DIR
   --with-gcc-major-version-only
                           use only GCC major number in filesystem paths
 
@@ -10992,7 +10996,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10995 "configure"
+#line 10999 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11098,7 +11102,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11101 "configure"
+#line 11105 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11360,6 +11364,22 @@ esac
 
 
 
+
+# Check whether --with-toolexeclibdir was given.
+if test "${with_toolexeclibdir+set}" = set; then :
+  withval=$with_toolexeclibdir; case ${with_toolexeclibdir} in
+  /)
+    ;;
+  */)
+    with_toolexeclibdir=`echo $with_toolexeclibdir | sed 's,/$,,'`
+    ;;
+esac
+else
+  with_toolexeclibdir=no
+fi
+
+
+
 # Calculate toolexeclibdir
 # Also toolexecdir, though it's only used in toolexeclibdir
 case ${version_specific_libs} in
@@ -11375,7 +11395,14 @@ case ${version_specific_libs} in
        test x"$with_cross_host" != x"no"; then
       # Install a library built with a cross compiler in tooldir, not libdir.
       toolexecdir='$(exec_prefix)/$(target_alias)'
-      toolexeclibdir='$(toolexecdir)/lib'
+      case ${with_toolexeclibdir} in
+	no)
+	  toolexeclibdir='$(toolexecdir)/lib'
+	  ;;
+	*)
+	  toolexeclibdir=${with_toolexeclibdir}
+	  ;;
+      esac
     else
       toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
       toolexeclibdir='$(libdir)'
diff --git a/libssp/configure.ac b/libssp/configure.ac
index 24e805a..f30f81c 100644
--- a/libssp/configure.ac
+++ b/libssp/configure.ac
@@ -163,6 +163,8 @@ ACX_LT_HOST_FLAGS
 AC_SUBST(enable_shared)
 AC_SUBST(enable_static)
 
+GCC_WITH_TOOLEXECLIBDIR
+
 # Calculate toolexeclibdir
 # Also toolexecdir, though it's only used in toolexeclibdir
 case ${version_specific_libs} in
@@ -178,7 +180,14 @@ case ${version_specific_libs} in
        test x"$with_cross_host" != x"no"; then
       # Install a library built with a cross compiler in tooldir, not libdir.
       toolexecdir='$(exec_prefix)/$(target_alias)'
-      toolexeclibdir='$(toolexecdir)/lib'
+      case ${with_toolexeclibdir} in
+	no)
+	  toolexeclibdir='$(toolexecdir)/lib'
+	  ;;
+	*)
+	  toolexeclibdir=${with_toolexeclibdir}
+	  ;;
+      esac
     else
       toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
       toolexeclibdir='$(libdir)'
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 61efaa5b..2e96d56 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,21 @@
+2020-01-24  Maciej W. Rozycki  <macro@wdc.com>
+
+	* acinclude.m4: Handle `--with-toolexeclibdir='.
+	* Makefile.in: Regenerate.
+	* aclocal.m4: Regenerate.
+	* configure: Regenerate.
+	* doc/Makefile.in: Regenerate.
+	* include/Makefile.in: Regenerate.
+	* libsupc++/Makefile.in: Regenerate.
+	* po/Makefile.in: Regenerate.
+	* python/Makefile.in: Regenerate.
+	* src/Makefile.in: Regenerate.
+	* src/c++11/Makefile.in: Regenerate.
+	* src/c++17/Makefile.in: Regenerate.
+	* src/c++98/Makefile.in: Regenerate.
+	* src/filesystem/Makefile.in: Regenerate.
+	* testsuite/Makefile.in: Regenerate.
+
 2020-01-23  Alexandre Oliva <oliva@adacore.com>
 
 	* crossconfig.m4 (GLIBCXX_CHECK_MATH_DECL): Reject macros.
diff --git a/libstdc++-v3/Makefile.in b/libstdc++-v3/Makefile.in
index bf8a7f2..8f11aaf 100644
--- a/libstdc++-v3/Makefile.in
+++ b/libstdc++-v3/Makefile.in
@@ -104,6 +104,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
 	$(top_srcdir)/../config/no-executables.m4 \
 	$(top_srcdir)/../config/override.m4 \
 	$(top_srcdir)/../config/stdint.m4 \
+	$(top_srcdir)/../config/toolexeclibdir.m4 \
 	$(top_srcdir)/../config/unwind_ipinfo.m4 \
 	$(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
 	$(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
index c537a26..3914791 100644
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -785,6 +785,8 @@ AC_DEFUN([GLIBCXX_EXPORT_INSTALL_INFO], [
     [version_specific_libs=no])
   AC_MSG_RESULT($version_specific_libs)
 
+  GCC_WITH_TOOLEXECLIBDIR
+
   # Default case for install directory for include files.
   if test $version_specific_libs = no && test $gxx_include_dir = no; then
     gxx_include_dir='include/c++/${gcc_version}'
@@ -815,7 +817,14 @@ AC_DEFUN([GLIBCXX_EXPORT_INSTALL_INFO], [
     if test -n "$with_cross_host" &&
        test x"$with_cross_host" != x"no"; then
       glibcxx_toolexecdir='${exec_prefix}/${host_alias}'
-      glibcxx_toolexeclibdir='${toolexecdir}/lib'
+      case ${with_toolexeclibdir} in
+	no)
+	  glibcxx_toolexeclibdir='${toolexecdir}/lib'
+	  ;;
+	*)
+	  glibcxx_toolexeclibdir=${with_toolexeclibdir}
+	  ;;
+      esac
     else
       glibcxx_toolexecdir='${libdir}/gcc/${host_alias}'
       glibcxx_toolexeclibdir='${libdir}'
diff --git a/libstdc++-v3/aclocal.m4 b/libstdc++-v3/aclocal.m4
index ce3f25e..b2f43aa 100644
--- a/libstdc++-v3/aclocal.m4
+++ b/libstdc++-v3/aclocal.m4
@@ -866,6 +866,7 @@ m4_include([../config/multi.m4])
 m4_include([../config/no-executables.m4])
 m4_include([../config/override.m4])
 m4_include([../config/stdint.m4])
+m4_include([../config/toolexeclibdir.m4])
 m4_include([../config/unwind_ipinfo.m4])
 m4_include([../libtool.m4])
 m4_include([../ltoptions.m4])
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index f3f2bdf..3af3dec 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -942,6 +942,7 @@ enable_libstdcxx_filesystem_ts
 enable_cet
 with_gxx_include_dir
 enable_version_specific_runtime_libs
+with_toolexeclibdir
 with_gcc_major_version_only
 '
       ac_precious_vars='build_alias
@@ -1669,6 +1670,9 @@ Optional Packages:
                           set the std::string ABI to use by default
   --with-gxx-include-dir=DIR
                           installation directory for include files
+  --with-toolexeclibdir=DIR
+                          install libraries built with a cross compiler within
+                          DIR
   --with-gcc-major-version-only
                           use only GCC major number in filesystem paths
 
@@ -12053,7 +12057,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12056 "configure"
+#line 12060 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12159,7 +12163,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12162 "configure"
+#line 12166 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -15851,7 +15855,7 @@ $as_echo "$glibcxx_cv_atomic_long_long" >&6; }
   # Fake what AC_TRY_COMPILE does.
 
     cat > conftest.$ac_ext << EOF
-#line 15854 "configure"
+#line 15858 "configure"
 int main()
 {
   typedef bool atomic_type;
@@ -15886,7 +15890,7 @@ $as_echo "$glibcxx_cv_atomic_bool" >&6; }
     rm -f conftest*
 
     cat > conftest.$ac_ext << EOF
-#line 15889 "configure"
+#line 15893 "configure"
 int main()
 {
   typedef short atomic_type;
@@ -15921,7 +15925,7 @@ $as_echo "$glibcxx_cv_atomic_short" >&6; }
     rm -f conftest*
 
     cat > conftest.$ac_ext << EOF
-#line 15924 "configure"
+#line 15928 "configure"
 int main()
 {
   // NB: _Atomic_word not necessarily int.
@@ -15957,7 +15961,7 @@ $as_echo "$glibcxx_cv_atomic_int" >&6; }
     rm -f conftest*
 
     cat > conftest.$ac_ext << EOF
-#line 15960 "configure"
+#line 15964 "configure"
 int main()
 {
   typedef long long atomic_type;
@@ -16110,7 +16114,7 @@ $as_echo "mutex" >&6; }
   # unnecessary for this test.
 
     cat > conftest.$ac_ext << EOF
-#line 16113 "configure"
+#line 16117 "configure"
 int main()
 {
   _Decimal32 d1;
@@ -16152,7 +16156,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
   # unnecessary for this test.
 
     cat > conftest.$ac_ext << EOF
-#line 16155 "configure"
+#line 16159 "configure"
 template<typename T1, typename T2>
   struct same
   { typedef T2 type; };
@@ -16186,7 +16190,7 @@ $as_echo "$enable_int128" >&6; }
     rm -f conftest*
 
     cat > conftest.$ac_ext << EOF
-#line 16189 "configure"
+#line 16193 "configure"
 template<typename T1, typename T2>
   struct same
   { typedef T2 type; };
@@ -77837,6 +77841,22 @@ fi
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $version_specific_libs" >&5
 $as_echo "$version_specific_libs" >&6; }
 
+
+# Check whether --with-toolexeclibdir was given.
+if test "${with_toolexeclibdir+set}" = set; then :
+  withval=$with_toolexeclibdir; case ${with_toolexeclibdir} in
+  /)
+    ;;
+  */)
+    with_toolexeclibdir=`echo $with_toolexeclibdir | sed 's,/$,,'`
+    ;;
+esac
+else
+  with_toolexeclibdir=no
+fi
+
+
+
   # Default case for install directory for include files.
   if test $version_specific_libs = no && test $gxx_include_dir = no; then
     gxx_include_dir='include/c++/${gcc_version}'
@@ -77867,7 +77887,14 @@ $as_echo "$version_specific_libs" >&6; }
     if test -n "$with_cross_host" &&
        test x"$with_cross_host" != x"no"; then
       glibcxx_toolexecdir='${exec_prefix}/${host_alias}'
-      glibcxx_toolexeclibdir='${toolexecdir}/lib'
+      case ${with_toolexeclibdir} in
+	no)
+	  glibcxx_toolexeclibdir='${toolexecdir}/lib'
+	  ;;
+	*)
+	  glibcxx_toolexeclibdir=${with_toolexeclibdir}
+	  ;;
+      esac
     else
       glibcxx_toolexecdir='${libdir}/gcc/${host_alias}'
       glibcxx_toolexeclibdir='${libdir}'
diff --git a/libstdc++-v3/doc/Makefile.in b/libstdc++-v3/doc/Makefile.in
index 6114bff..9134d66 100644
--- a/libstdc++-v3/doc/Makefile.in
+++ b/libstdc++-v3/doc/Makefile.in
@@ -104,6 +104,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
 	$(top_srcdir)/../config/no-executables.m4 \
 	$(top_srcdir)/../config/override.m4 \
 	$(top_srcdir)/../config/stdint.m4 \
+	$(top_srcdir)/../config/toolexeclibdir.m4 \
 	$(top_srcdir)/../config/unwind_ipinfo.m4 \
 	$(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
 	$(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
diff --git a/libstdc++-v3/include/Makefile.in b/libstdc++-v3/include/Makefile.in
index 57574c3..123d24b 100644
--- a/libstdc++-v3/include/Makefile.in
+++ b/libstdc++-v3/include/Makefile.in
@@ -104,6 +104,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
 	$(top_srcdir)/../config/no-executables.m4 \
 	$(top_srcdir)/../config/override.m4 \
 	$(top_srcdir)/../config/stdint.m4 \
+	$(top_srcdir)/../config/toolexeclibdir.m4 \
 	$(top_srcdir)/../config/unwind_ipinfo.m4 \
 	$(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
 	$(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
diff --git a/libstdc++-v3/libsupc++/Makefile.in b/libstdc++-v3/libsupc++/Makefile.in
index 38e34cb..a0a500e 100644
--- a/libstdc++-v3/libsupc++/Makefile.in
+++ b/libstdc++-v3/libsupc++/Makefile.in
@@ -106,6 +106,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
 	$(top_srcdir)/../config/no-executables.m4 \
 	$(top_srcdir)/../config/override.m4 \
 	$(top_srcdir)/../config/stdint.m4 \
+	$(top_srcdir)/../config/toolexeclibdir.m4 \
 	$(top_srcdir)/../config/unwind_ipinfo.m4 \
 	$(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
 	$(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
diff --git a/libstdc++-v3/po/Makefile.in b/libstdc++-v3/po/Makefile.in
index 64d0b44..a0f84b0 100644
--- a/libstdc++-v3/po/Makefile.in
+++ b/libstdc++-v3/po/Makefile.in
@@ -104,6 +104,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
 	$(top_srcdir)/../config/no-executables.m4 \
 	$(top_srcdir)/../config/override.m4 \
 	$(top_srcdir)/../config/stdint.m4 \
+	$(top_srcdir)/../config/toolexeclibdir.m4 \
 	$(top_srcdir)/../config/unwind_ipinfo.m4 \
 	$(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
 	$(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
diff --git a/libstdc++-v3/python/Makefile.in b/libstdc++-v3/python/Makefile.in
index 7b51946..1817b33 100644
--- a/libstdc++-v3/python/Makefile.in
+++ b/libstdc++-v3/python/Makefile.in
@@ -105,6 +105,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
 	$(top_srcdir)/../config/no-executables.m4 \
 	$(top_srcdir)/../config/override.m4 \
 	$(top_srcdir)/../config/stdint.m4 \
+	$(top_srcdir)/../config/toolexeclibdir.m4 \
 	$(top_srcdir)/../config/unwind_ipinfo.m4 \
 	$(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
 	$(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
diff --git a/libstdc++-v3/src/Makefile.in b/libstdc++-v3/src/Makefile.in
index d91f715..ea37a96 100644
--- a/libstdc++-v3/src/Makefile.in
+++ b/libstdc++-v3/src/Makefile.in
@@ -105,6 +105,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
 	$(top_srcdir)/../config/no-executables.m4 \
 	$(top_srcdir)/../config/override.m4 \
 	$(top_srcdir)/../config/stdint.m4 \
+	$(top_srcdir)/../config/toolexeclibdir.m4 \
 	$(top_srcdir)/../config/unwind_ipinfo.m4 \
 	$(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
 	$(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
diff --git a/libstdc++-v3/src/c++11/Makefile.in b/libstdc++-v3/src/c++11/Makefile.in
index 3c3719c..b15244d 100644
--- a/libstdc++-v3/src/c++11/Makefile.in
+++ b/libstdc++-v3/src/c++11/Makefile.in
@@ -105,6 +105,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
 	$(top_srcdir)/../config/no-executables.m4 \
 	$(top_srcdir)/../config/override.m4 \
 	$(top_srcdir)/../config/stdint.m4 \
+	$(top_srcdir)/../config/toolexeclibdir.m4 \
 	$(top_srcdir)/../config/unwind_ipinfo.m4 \
 	$(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
 	$(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
diff --git a/libstdc++-v3/src/c++17/Makefile.in b/libstdc++-v3/src/c++17/Makefile.in
index 26a4713..07a8875 100644
--- a/libstdc++-v3/src/c++17/Makefile.in
+++ b/libstdc++-v3/src/c++17/Makefile.in
@@ -105,6 +105,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
 	$(top_srcdir)/../config/no-executables.m4 \
 	$(top_srcdir)/../config/override.m4 \
 	$(top_srcdir)/../config/stdint.m4 \
+	$(top_srcdir)/../config/toolexeclibdir.m4 \
 	$(top_srcdir)/../config/unwind_ipinfo.m4 \
 	$(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
 	$(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
diff --git a/libstdc++-v3/src/c++98/Makefile.in b/libstdc++-v3/src/c++98/Makefile.in
index 7825b94..6895780 100644
--- a/libstdc++-v3/src/c++98/Makefile.in
+++ b/libstdc++-v3/src/c++98/Makefile.in
@@ -105,6 +105,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
 	$(top_srcdir)/../config/no-executables.m4 \
 	$(top_srcdir)/../config/override.m4 \
 	$(top_srcdir)/../config/stdint.m4 \
+	$(top_srcdir)/../config/toolexeclibdir.m4 \
 	$(top_srcdir)/../config/unwind_ipinfo.m4 \
 	$(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
 	$(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
diff --git a/libstdc++-v3/src/filesystem/Makefile.in b/libstdc++-v3/src/filesystem/Makefile.in
index f4b5c9b..0533587 100644
--- a/libstdc++-v3/src/filesystem/Makefile.in
+++ b/libstdc++-v3/src/filesystem/Makefile.in
@@ -105,6 +105,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
 	$(top_srcdir)/../config/no-executables.m4 \
 	$(top_srcdir)/../config/override.m4 \
 	$(top_srcdir)/../config/stdint.m4 \
+	$(top_srcdir)/../config/toolexeclibdir.m4 \
 	$(top_srcdir)/../config/unwind_ipinfo.m4 \
 	$(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
 	$(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
diff --git a/libstdc++-v3/testsuite/Makefile.in b/libstdc++-v3/testsuite/Makefile.in
index f68d627..2c248cf 100644
--- a/libstdc++-v3/testsuite/Makefile.in
+++ b/libstdc++-v3/testsuite/Makefile.in
@@ -104,6 +104,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
 	$(top_srcdir)/../config/no-executables.m4 \
 	$(top_srcdir)/../config/override.m4 \
 	$(top_srcdir)/../config/stdint.m4 \
+	$(top_srcdir)/../config/toolexeclibdir.m4 \
 	$(top_srcdir)/../config/unwind_ipinfo.m4 \
 	$(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
 	$(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
diff --git a/libvtv/ChangeLog b/libvtv/ChangeLog
index 251219d..c0b6878 100644
--- a/libvtv/ChangeLog
+++ b/libvtv/ChangeLog
@@ -1,3 +1,11 @@
+2020-01-24  Maciej W. Rozycki  <macro@wdc.com>
+
+	* configure.ac: Handle `--with-toolexeclibdir='.
+	* Makefile.in: Regenerate.
+	* aclocal.m4: Regenerate.
+	* configure: Regenerate.
+	* testsuite/Makefile.in: Regenerate.
+
 2020-01-01  Jakub Jelinek  <jakub@redhat.com>
 
 	Update copyright years.
diff --git a/libvtv/Makefile.in b/libvtv/Makefile.in
index 0a91551..70b4403 100644
--- a/libvtv/Makefile.in
+++ b/libvtv/Makefile.in
@@ -101,6 +101,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
 	$(top_srcdir)/../config/lthostflags.m4 \
 	$(top_srcdir)/../config/multi.m4 \
 	$(top_srcdir)/../config/override.m4 \
+	$(top_srcdir)/../config/toolexeclibdir.m4 \
 	$(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
 	$(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
 	$(top_srcdir)/acinclude.m4 $(top_srcdir)/../libtool.m4 \
diff --git a/libvtv/aclocal.m4 b/libvtv/aclocal.m4
index 80417d2..7da4c3a 100644
--- a/libvtv/aclocal.m4
+++ b/libvtv/aclocal.m4
@@ -1174,6 +1174,7 @@ m4_include([../config/libstdc++-raw-cxx.m4])
 m4_include([../config/lthostflags.m4])
 m4_include([../config/multi.m4])
 m4_include([../config/override.m4])
+m4_include([../config/toolexeclibdir.m4])
 m4_include([../ltoptions.m4])
 m4_include([../ltsugar.m4])
 m4_include([../ltversion.m4])
diff --git a/libvtv/configure b/libvtv/configure
index 990bd88..fc96952 100755
--- a/libvtv/configure
+++ b/libvtv/configure
@@ -790,6 +790,7 @@ enable_vtable_verify
 enable_dependency_tracking
 enable_silent_rules
 enable_maintainer_mode
+with_toolexeclibdir
 enable_shared
 enable_static
 with_pic
@@ -1450,6 +1451,9 @@ Optional Features:
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
   --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
+  --with-toolexeclibdir=DIR
+                          install libraries built with a cross compiler within
+                          DIR
   --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]
@@ -4807,6 +4811,22 @@ fi
 
 
 
+
+# Check whether --with-toolexeclibdir was given.
+if test "${with_toolexeclibdir+set}" = set; then :
+  withval=$with_toolexeclibdir; case ${with_toolexeclibdir} in
+  /)
+    ;;
+  */)
+    with_toolexeclibdir=`echo $with_toolexeclibdir | sed 's,/$,,'`
+    ;;
+esac
+else
+  with_toolexeclibdir=no
+fi
+
+
+
 # Calculate toolexeclibdir
 # Also toolexecdir, though it's only used in toolexeclibdir
 case ${version_specific_libs} in
@@ -4822,7 +4842,14 @@ case ${version_specific_libs} in
        test x"$with_cross_host" != x"no"; then
       # Install a library built with a cross compiler in tooldir, not libdir.
       toolexecdir='$(exec_prefix)/$(target_alias)'
-      toolexeclibdir='$(toolexecdir)/lib'
+      case ${with_toolexeclibdir} in
+	no)
+	  toolexeclibdir='$(toolexecdir)/lib'
+	  ;;
+	*)
+	  toolexeclibdir=${with_toolexeclibdir}
+	  ;;
+      esac
     else
       toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
       toolexeclibdir='$(libdir)'
@@ -12235,7 +12262,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12238 "configure"
+#line 12265 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12341,7 +12368,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12344 "configure"
+#line 12371 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
diff --git a/libvtv/configure.ac b/libvtv/configure.ac
index 6c321c1..f3b937e 100644
--- a/libvtv/configure.ac
+++ b/libvtv/configure.ac
@@ -78,6 +78,8 @@ AM_MAINTAINER_MODE
 
 LIBVTV_CONFIGURE
 
+GCC_WITH_TOOLEXECLIBDIR
+
 # Calculate toolexeclibdir
 # Also toolexecdir, though it's only used in toolexeclibdir
 case ${version_specific_libs} in
@@ -93,7 +95,14 @@ case ${version_specific_libs} in
        test x"$with_cross_host" != x"no"; then
       # Install a library built with a cross compiler in tooldir, not libdir.
       toolexecdir='$(exec_prefix)/$(target_alias)'
-      toolexeclibdir='$(toolexecdir)/lib'
+      case ${with_toolexeclibdir} in
+	no)
+	  toolexeclibdir='$(toolexecdir)/lib'
+	  ;;
+	*)
+	  toolexeclibdir=${with_toolexeclibdir}
+	  ;;
+      esac
     else
       toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
       toolexeclibdir='$(libdir)'
diff --git a/libvtv/testsuite/Makefile.in b/libvtv/testsuite/Makefile.in
index e104f62..cb804c4 100644
--- a/libvtv/testsuite/Makefile.in
+++ b/libvtv/testsuite/Makefile.in
@@ -97,6 +97,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
 	$(top_srcdir)/../config/lthostflags.m4 \
 	$(top_srcdir)/../config/multi.m4 \
 	$(top_srcdir)/../config/override.m4 \
+	$(top_srcdir)/../config/toolexeclibdir.m4 \
 	$(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
 	$(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
 	$(top_srcdir)/acinclude.m4 $(top_srcdir)/../libtool.m4 \
diff --git a/zlib/ChangeLog.gcj b/zlib/ChangeLog.gcj
index e4c1be7..60f0a1d 100644
--- a/zlib/ChangeLog.gcj
+++ b/zlib/ChangeLog.gcj
@@ -1,3 +1,10 @@
+2020-01-24  Maciej W. Rozycki  <macro@wdc.com>
+
+	* configure.ac: Handle `--with-toolexeclibdir='.
+	* Makefile.in: Regenerate.
+	* aclocal.m4: Regenerate.
+	* configure: Regenerate.
+
 2019-09-27  Maciej W. Rozycki  <macro@wdc.com>
 
 	* configure: Regenerate.
diff --git a/zlib/Makefile.in b/zlib/Makefile.in
index 7b99bd8..dce9ffc 100644
--- a/zlib/Makefile.in
+++ b/zlib/Makefile.in
@@ -96,6 +96,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/depstand.m4 \
 	$(top_srcdir)/../config/lead-dot.m4 \
 	$(top_srcdir)/../config/multi.m4 \
 	$(top_srcdir)/../config/override.m4 \
+	$(top_srcdir)/../config/toolexeclibdir.m4 \
 	$(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
 	$(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
 	$(top_srcdir)/acinclude.m4 \
diff --git a/zlib/aclocal.m4 b/zlib/aclocal.m4
index e5eed57..d319d09 100644
--- a/zlib/aclocal.m4
+++ b/zlib/aclocal.m4
@@ -1171,6 +1171,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/toolexeclibdir.m4])
 m4_include([../ltoptions.m4])
 m4_include([../ltsugar.m4])
 m4_include([../ltversion.m4])
diff --git a/zlib/configure b/zlib/configure
index c6d2674..484a493 100755
--- a/zlib/configure
+++ b/zlib/configure
@@ -774,6 +774,7 @@ with_pic
 enable_fast_install
 with_gnu_ld
 enable_libtool_lock
+with_toolexeclibdir
 enable_host_shared
 '
       ac_precious_vars='build_alias
@@ -1427,6 +1428,9 @@ 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-toolexeclibdir=DIR
+                          install libraries built with a cross compiler within
+                          DIR
 
 Some influential environment variables:
   CC          C compiler command
@@ -10648,7 +10652,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10651 "configure"
+#line 10655 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -10754,7 +10758,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10757 "configure"
+#line 10761 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11379,10 +11383,33 @@ fi
 done
 
 
+
+# Check whether --with-toolexeclibdir was given.
+if test "${with_toolexeclibdir+set}" = set; then :
+  withval=$with_toolexeclibdir; case ${with_toolexeclibdir} in
+  /)
+    ;;
+  */)
+    with_toolexeclibdir=`echo $with_toolexeclibdir | sed 's,/$,,'`
+    ;;
+esac
+else
+  with_toolexeclibdir=no
+fi
+
+
+
 if test -n "$with_cross_host" &&
    test x"$with_cross_host" != x"no"; then
   toolexecdir='$(exec_prefix)/$(target_alias)'
-  toolexeclibdir='$(toolexecdir)/lib'
+  case ${with_toolexeclibdir} in
+    no)
+      toolexeclibdir='$(toolexecdir)/lib'
+      ;;
+    *)
+      toolexeclibdir=${with_toolexeclibdir}
+      ;;
+  esac
 else
   toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
   toolexeclibdir='$(libdir)'
diff --git a/zlib/configure.ac b/zlib/configure.ac
index 69588f8..ad9ec73 100644
--- a/zlib/configure.ac
+++ b/zlib/configure.ac
@@ -81,10 +81,19 @@ fi
 
 AC_CHECK_HEADERS(unistd.h)
 
+GCC_WITH_TOOLEXECLIBDIR
+
 if test -n "$with_cross_host" &&
    test x"$with_cross_host" != x"no"; then
   toolexecdir='$(exec_prefix)/$(target_alias)'
-  toolexeclibdir='$(toolexecdir)/lib'
+  case ${with_toolexeclibdir} in
+    no)
+      toolexeclibdir='$(toolexecdir)/lib'
+      ;;
+    *)
+      toolexeclibdir=${with_toolexeclibdir}
+      ;;
+  esac
 else
   toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
   toolexeclibdir='$(libdir)'



More information about the Libstdc++-cvs mailing list