From patchwork Thu Nov 14 02:47:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Maciej W. Rozycki" X-Patchwork-Id: 1194537 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-513313-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="waYYbr8+"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.b="L5QG+H2g"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47D5WR4zNNz9sNT for ; Thu, 14 Nov 2019 13:48:02 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; q=dns; s=default; b=dkmG9M8JW6GfC0DGxSRLnTuEsE5SM6oI380tqsyHapa3jFDFj4 Yri9qwieveMjbkdXhi4b74tegsSGzGAQbDNDTUDddTQ80OT4+nKOLI779hTD/P4O CvMeW1P1usAuuT6LY/8Pl3ouxwvJzIHxu4FlMwSj5KnHyPAtFRc44V9MU= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; s= default; bh=yp5CeL3EpmT5opZ8stpXKIh65rc=; b=waYYbr8+NHCP9HI+L/2G Ax2zRL/LIfQdv2PKCVRJrikprUt1IkzQwT11aCTNq44+HrCbEEiBULiFL8bO5cIR 8fneIu1zMmwFQQkfmogvIjkvsTgxUNkdSBTrtJKXecUyIhLZ3gVDQAn8CENF28vf qNuk8K/SH+SI0Uehz2BgJ18= Received: (qmail 103829 invoked by alias); 14 Nov 2019 02:47:49 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 103814 invoked by uid 89); 14 Nov 2019 02:47:48 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-8.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS autolearn=ham version=3.3.1 spammy=7817, libphobos, sk:libphob, 8133 X-HELO: esa1.hgst.iphmx.com Received: from esa1.hgst.iphmx.com (HELO esa1.hgst.iphmx.com) (68.232.141.245) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 14 Nov 2019 02:47:38 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1573699658; x=1605235658; h=date:from:to:cc:subject:message-id:mime-version; bh=jj3PtHb5YrtE5izNrJ8nnoskJ0FiwMEIjxDxgKDmuBg=; b=L5QG+H2gYE/n85U9I0VGYuwOwHLmXeHzfvx7RLCkfV/7WLeXjRTh/rU2 zxmdmJKz9Dw0wogsJq04JRXvz6V7o+gImRsq5cs/NNVk5Gdw+n8FF1I+j kbLNRqESwqptUEh7QrwbUPh7zhkJ46tWH3NjN2gPcsXE1r0gQGjZJpR8V 1KVy981IuAA1d9ZRr9dpIlp64tgsSjf+o2qsdrDNUbPOVDEFngO/uZS/o zjcbhNQQtbh8ruHtvn+OlUnxEltPcFiJ7O1+qOxDAzefX9A9gJxZYf6/e XG451ppBD+OxdHQpLaz7Lz43HJeU2W891knvH+j0vvppKho3uC2ey+EbM w==; IronPort-SDR: IUhRj3dmaKWXqgZJgYdP1sX2GlM6REwUUV/qeiw+HXalmK4lRM9BcOC6YcuACSg/zg1UDKp9vz mjqmkIPRVkZ+ITYKegNbuR6DEE/VISm92vPQsg6DQ7MwU9okAWQAcyo04E1WgtaDY4iuxFTtvD 1SDKPCgcpZChOlUrTbVO5viyDCrx/sv00uFgR0CNr5133BP+djlJuIESNUZ/tVBwEON4FetojD VpTPG1uOsIBlH/OClsKTQtUyqqOZUOZYvao20pA8kmEEdC28IbRm0/HNTJ9IdZkj7MtZJIZbW3 C0U= Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 14 Nov 2019 10:47:36 +0800 IronPort-SDR: UqNQzRWJ17qLC7Wro1INW5i28cPsG+5NKqPVLvQrbJ0wU+Ysv+qkW294q55KqnMX7F9lwR+coS wCK6gxaBpMp3ooI8Ek6+lY2V1OoYIykp760S0muVJdOE8gLedfvw9noWtih9v/5Kta58VbBfji k8b99BdBh0Ib3M0Kegs7LIS08y6jwfxwYw8GUKDYJlxVdQnf3dz0mmi2hIU6hbIgULsIyrqNK8 dims3DWXKX/LDv6MS9rBEfdS7pbUkz1suOOYZ/XeQcfjLUx42R4fl3zHq8zh1GAvfAgdgVFbi5 TBAVeZuKNajeZ6r7Wv4jRyYs Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Nov 2019 18:42:36 -0800 IronPort-SDR: Tz0fBajIt1X5I8ym68UaEv26oSZANaq+SJNSP3/GUuI525dT/aNoLawFP+PBvmIaMhEPSuWYjA pQfaCZCL0iQGeMUOcaiF6ey+oE98k4ce0BvbULhJlViYsBMoiO3wrzoy6SoMY67od8DOtQzOBk MrARQDqQRWjFlLy6RObgqVM+HBk/lD90LWgEDwA2u822F7msqCIPpp6qaUGyUA+HDUtQFYxCNv m/0iu3n5FIm/pd3tupWMTSMw++qxPwzcunTgb9kgMtltrJQUcJ8vxQcOwbgZXRVF1BXNtlvtf0 FDA= WDCIronportException: Internal Received: from unknown (HELO redsun52) ([10.149.66.28]) by uls-op-cesaip01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Nov 2019 18:47:36 -0800 Date: Thu, 14 Nov 2019 02:47:29 +0000 (GMT) From: "Maciej W. Rozycki" To: gcc-patches@gcc.gnu.org cc: libffi-discuss@sourceware.org, golang-dev@googlegroups.com, zlib@gzip.org Subject: [PATCH] Add `--with-install-sysroot=' configuration option Message-ID: User-Agent: Alpine 2.21 (LFD 202 2017-01-01) MIME-Version: 1.0 Provide means, in the form of a `--with-install-sysroot=' 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 sysroot, 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. The name of the configuration option is chosen such as to give it a meaning, rather than referring to obscure $toolexeclibdir. Arguments are interpreted as with the `--with-sysroot=' option. The default is the current value of $toolexeclibdir, so in the absence of the option from the invocation of the `configure' script the installation location for target libraries remains unchanged from the current arrangement. In the presence of the `--enable-version-specific-runtime-libs' option and for configurations building native GCC the option is ignored. libada/ * configure.ac: Handle `--with-install-sysroot='. * configure: Regenerate. libatomic/ * configure.ac: Handle `--with-install-sysroot='. * configure: Regenerate. libffi/ * configure.ac: Handle `--with-install-sysroot='. * configure: Regenerate. libgcc/ * configure.ac: Handle `--with-install-sysroot='. * configure: Regenerate. libgfortran/ * configure.ac: Handle `--with-install-sysroot='. * configure: Regenerate. libgo/ * configure.ac: Handle `--with-install-sysroot='. * configure: Regenerate. libgomp/ * configure.ac: Handle `--with-install-sysroot='. * configure: Regenerate. libhsail-rt/ * configure.ac: Handle `--with-install-sysroot='. * configure: Regenerate. libitm/ * configure.ac: Handle `--with-install-sysroot='. * configure: Regenerate. libobjc/ * configure.ac: Handle `--with-install-sysroot='. * configure: Regenerate. liboffloadmic/ * plugin/configure.ac: Handle `--with-install-sysroot='. * plugin/configure: Regenerate. * configure.ac: Handle `--with-install-sysroot='. * configure: Regenerate. libphobos/ * m4/druntime.m4: Handle `--with-install-sysroot='. * configure: Regenerate. libquadmath/ * configure.ac: Handle `--with-install-sysroot='. * configure: Regenerate. libsanitizer/ * configure.ac: Handle `--with-install-sysroot='. * configure: Regenerate. libssp/ * configure.ac: Handle `--with-install-sysroot='. * configure: Regenerate. libstdc++-v3/ * acinclude.m4: Handle `--with-install-sysroot='. * configure: Regenerate. libvtv/ * configure.ac: Handle `--with-install-sysroot='. * configure: Regenerate. zlib/ * configure.ac: Handle `--with-install-sysroot='. * configure: Regenerate. --- Hi, It used to be a common problem throughout much of my toolchain development involvement that GCC target shared libraries are not installed in a common sysroot along with other shared libraries, such as ones coming from glibc built at an earlier stage in a multi-stage toolchain bootstrap. So far the common solution used to be copying the GCC target shared libraries manually with a separate build stage once `make install' has completed, but that can be error prone, requiring one to remember to run that extra stage if it is not run automatically for some reason, and also it requires tracking any changes in the installation, such as the addition of a new library. Also changes in the list of multilibs built may require a further attention. I have therefore decided to solve the problem at its source and add a configuration option to let one specify an alternative installation location for target shared libraries, rather than having $toolexeclibdir hardcoded to $toolexecdir/lib. Typically the value for the `--with-install-sysroot=' option will be the same as or correlated to the `--with-sysroot=' option, e.g. I use `--with-sysroot=/path/to/sysroot --with-install-sysroot=/path/to/sysroot/usr' with my `riscv64-linux-gnu' toolchain hosted on `x86_64-linux-gnu' for a good working result. I think it would be reasonable to apply this change throughout the tree in one commit, so that the option is interpreted consistently and also have it present across all the subdirectories, even those that (currently) only build as host libraries, so that the risk of having a library escape the new option in the future is minimised. This could be e.g. if a library is enabled to be built as a target library or a configuration script is copied to handle a newly-added library. Therefore I have decided to post this proposal as a single change, especially as the same pattern repeats thoroughout (with the exception of libgcc/ that has an extra part related to `--with-slibdir='), though I realise it may actually have to be split due to our code management policies. Questions, comments, OK to apply? Maciej --- libada/configure | 30 ++++++++++++++++++++++- libada/configure.ac | 25 +++++++++++++++++++ libatomic/configure | 34 ++++++++++++++++++++++++-- libatomic/configure.ac | 25 +++++++++++++++++++ libffi/configure | 34 ++++++++++++++++++++++++-- libffi/configure.ac | 25 +++++++++++++++++++ libgcc/configure | 39 +++++++++++++++++++++++++++++- libgcc/configure.ac | 38 ++++++++++++++++++++++++++---- libgfortran/configure | 34 ++++++++++++++++++++++++-- libgfortran/configure.ac | 25 +++++++++++++++++++ libgo/configure | 34 ++++++++++++++++++++++++-- libgo/configure.ac | 25 +++++++++++++++++++ libgomp/configure | 34 ++++++++++++++++++++++++-- libgomp/configure.ac | 25 +++++++++++++++++++ libhsail-rt/configure | 34 ++++++++++++++++++++++++-- libhsail-rt/configure.ac | 25 +++++++++++++++++++ libitm/configure | 34 ++++++++++++++++++++++++-- libitm/configure.ac | 25 +++++++++++++++++++ libobjc/configure | 34 ++++++++++++++++++++++++-- libobjc/configure.ac | 25 +++++++++++++++++++ liboffloadmic/configure | 34 ++++++++++++++++++++++++-- liboffloadmic/configure.ac | 25 +++++++++++++++++++ liboffloadmic/plugin/configure | 34 ++++++++++++++++++++++++-- liboffloadmic/plugin/configure.ac | 25 +++++++++++++++++++ libphobos/configure | 34 ++++++++++++++++++++++++-- libphobos/m4/druntime.m4 | 25 +++++++++++++++++++ libquadmath/configure | 34 ++++++++++++++++++++++++-- libquadmath/configure.ac | 25 +++++++++++++++++++ libsanitizer/configure | 34 ++++++++++++++++++++++++-- libsanitizer/configure.ac | 25 +++++++++++++++++++ libssp/configure | 34 ++++++++++++++++++++++++-- libssp/configure.ac | 25 +++++++++++++++++++ libstdc++-v3/acinclude.m4 | 25 +++++++++++++++++++ libstdc++-v3/configure | 48 ++++++++++++++++++++++++++++++-------- libvtv/configure | 34 ++++++++++++++++++++++++-- libvtv/configure.ac | 25 +++++++++++++++++++ zlib/configure | 34 ++++++++++++++++++++++++-- zlib/configure.ac | 25 +++++++++++++++++++ 38 files changed, 1066 insertions(+), 83 deletions(-) gcc-install-sysroot.diff Index: gcc/libada/configure =================================================================== --- gcc.orig/libada/configure +++ gcc/libada/configure @@ -704,6 +704,7 @@ enable_option_checking with_build_libsubdir enable_version_specific_runtime_libs enable_maintainer_mode +with_install_sysroot enable_multilib enable_shared with_system_libunwind @@ -1339,6 +1340,8 @@ if test -n "$ac_init_help"; then --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-install-sysroot=DIR + install libraries within DIR --with-system-libunwind use installed libunwind --with-gcc-major-version-only use only GCC major number in filesystem paths @@ -2249,6 +2252,24 @@ else fi + +# Check whether --with-install-sysroot was given. +if test "${with_install_sysroot+set}" = set; then : + withval=$with_install_sysroot; case ${with_install_sysroot} in + /) + ;; + */) + with_install_sysroot=`echo $with_install_sysroot | sed 's,/$,,'` + ;; + yes) + with_install_sysroot='$(exec_prefix)/$(target_alias)/sys-root' + ;; +esac +else + with_install_sysroot=no +fi + + # Default to --enable-multilib # Check whether --enable-multilib was given. if test "${enable_multilib+set}" = set; then : @@ -2301,7 +2322,14 @@ case ${enable_version_specific_runtime_l 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_install_sysroot} in + no) + toolexeclibdir='$(toolexecdir)/lib' + ;; + *) + toolexeclibdir=${with_install_sysroot}/lib + ;; + esac else toolexecdir='$(libdir)/gcc-lib/$(target_alias)' toolexeclibdir='$(libdir)' Index: gcc/libada/configure.ac =================================================================== --- gcc.orig/libada/configure.ac +++ gcc/libada/configure.ac @@ -67,6 +67,22 @@ AC_ARG_ENABLE([maintainer-mode], [MAINT='#']) AC_SUBST([MAINT])dnl +AC_ARG_WITH(install-sysroot, + [AS_HELP_STRING([--with-install-sysroot=DIR], + [install libraries within DIR])], + [dnl +case ${with_install_sysroot} in + /) + ;; + */) + with_install_sysroot=`echo $with_install_sysroot | sed 's,/$,,'` + ;; + yes) + with_install_sysroot='$(exec_prefix)/$(target_alias)/sys-root' + ;; +esac], + [with_install_sysroot=no]) + AM_ENABLE_MULTILIB(, ..) # Calculate toolexeclibdir # Also toolexecdir, though it's only used in toolexeclibdir @@ -83,7 +99,14 @@ case ${enable_version_specific_runtime_l 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_install_sysroot} in + no) + toolexeclibdir='$(toolexecdir)/lib' + ;; + *) + toolexeclibdir=${with_install_sysroot}/lib + ;; + esac else toolexecdir='$(libdir)/gcc-lib/$(target_alias)' toolexeclibdir='$(libdir)' Index: gcc/libatomic/configure =================================================================== --- gcc.orig/libatomic/configure +++ gcc/libatomic/configure @@ -794,6 +794,7 @@ enable_version_specific_runtime_libs enable_generated_files_in_srcdir enable_silent_rules enable_multilib +with_install_sysroot enable_dependency_tracking enable_shared enable_static @@ -1459,6 +1460,8 @@ if test -n "$ac_init_help"; then Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-install-sysroot=DIR + install libraries 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 +3346,24 @@ fi ac_config_commands="$ac_config_commands default-1" + +# Check whether --with-install-sysroot was given. +if test "${with_install_sysroot+set}" = set; then : + withval=$with_install_sysroot; case ${with_install_sysroot} in + /) + ;; + */) + with_install_sysroot=`echo $with_install_sysroot | sed 's,/$,,'` + ;; + yes) + with_install_sysroot='$(exec_prefix)/$(target_alias)/sys-root' + ;; +esac +else + with_install_sysroot=no +fi + + # Calculate toolexeclibdir # Also toolexecdir, though it's only used in toolexeclibdir case ${enable_version_specific_runtime_libs} in @@ -3358,7 +3379,14 @@ case ${enable_version_specific_runtime_l 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_install_sysroot} in + no) + toolexeclibdir='$(toolexecdir)/lib' + ;; + *) + toolexeclibdir=${with_install_sysroot}/lib + ;; + esac else toolexecdir='$(libdir)/gcc-lib/$(target_alias)' toolexeclibdir='$(libdir)' @@ -11360,7 +11388,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 11391 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11466,7 +11494,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 11497 "configure" #include "confdefs.h" #if HAVE_DLFCN_H Index: gcc/libatomic/configure.ac =================================================================== --- gcc.orig/libatomic/configure.ac +++ gcc/libatomic/configure.ac @@ -84,6 +84,22 @@ target_alias=${target_alias-$host_alias} AM_INIT_AUTOMAKE([1.9.0 foreign no-dist -Wall -Wno-portability -Wno-override]) AM_ENABLE_MULTILIB(, ..) +AC_ARG_WITH(install-sysroot, + [AS_HELP_STRING([--with-install-sysroot=DIR], + [install libraries within DIR])], + [dnl +case ${with_install_sysroot} in + /) + ;; + */) + with_install_sysroot=`echo $with_install_sysroot | sed 's,/$,,'` + ;; + yes) + with_install_sysroot='$(exec_prefix)/$(target_alias)/sys-root' + ;; +esac], + [with_install_sysroot=no]) + # Calculate toolexeclibdir # Also toolexecdir, though it's only used in toolexeclibdir case ${enable_version_specific_runtime_libs} in @@ -99,7 +115,14 @@ case ${enable_version_specific_runtime_l 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_install_sysroot} in + no) + toolexeclibdir='$(toolexecdir)/lib' + ;; + *) + toolexeclibdir=${with_install_sysroot}/lib + ;; + esac else toolexecdir='$(libdir)/gcc-lib/$(target_alias)' toolexeclibdir='$(libdir)' Index: gcc/libffi/configure =================================================================== --- gcc.orig/libffi/configure +++ gcc/libffi/configure @@ -813,6 +813,7 @@ enable_debug enable_structs enable_raw_api enable_purify_safety +with_install_sysroot enable_symvers with_gcc_major_version_only ' @@ -1476,6 +1477,8 @@ if test -n "$ac_init_help"; then --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-install-sysroot=DIR + install libraries within DIR --with-gcc-major-version-only use only GCC major number in filesystem paths @@ -11557,7 +11560,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 11563 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11663,7 +11666,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 11669 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -16177,10 +16180,35 @@ $as_echo "#define USING_PURIFY 1" >>conf fi + +# Check whether --with-install-sysroot was given. +if test "${with_install_sysroot+set}" = set; then : + withval=$with_install_sysroot; case ${with_install_sysroot} in + /) + ;; + */) + with_install_sysroot=`echo $with_install_sysroot | sed 's,/$,,'` + ;; + yes) + with_install_sysroot='$(exec_prefix)/$(target_alias)/sys-root' + ;; +esac +else + with_install_sysroot=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_install_sysroot} in + no) + toolexeclibdir='$(toolexecdir)/lib' + ;; + *) + toolexeclibdir=${with_install_sysroot}/lib + ;; + esac else toolexecdir='$(libdir)/gcc-lib/$(target_alias)' toolexeclibdir='$(libdir)' Index: gcc/libffi/configure.ac =================================================================== --- gcc.orig/libffi/configure.ac +++ gcc/libffi/configure.ac @@ -332,10 +332,33 @@ AC_ARG_ENABLE(purify-safety, AC_DEFINE(USING_PURIFY, 1, [Define this if you are using Purify and want to suppress spurious messages.]) fi) +AC_ARG_WITH(install-sysroot, + [AS_HELP_STRING([--with-install-sysroot=DIR], + [install libraries within DIR])], + [dnl +case ${with_install_sysroot} in + /) + ;; + */) + with_install_sysroot=`echo $with_install_sysroot | sed 's,/$,,'` + ;; + yes) + with_install_sysroot='$(exec_prefix)/$(target_alias)/sys-root' + ;; +esac], + [with_install_sysroot=no]) + if test -n "$with_cross_host" && test x"$with_cross_host" != x"no"; then toolexecdir='$(exec_prefix)/$(target_alias)' - toolexeclibdir='$(toolexecdir)/lib' + case ${with_install_sysroot} in + no) + toolexeclibdir='$(toolexecdir)/lib' + ;; + *) + toolexeclibdir=${with_install_sysroot}/lib + ;; + esac else toolexecdir='$(libdir)/gcc-lib/$(target_alias)' toolexeclibdir='$(libdir)' Index: gcc/libgcc/configure =================================================================== --- gcc.orig/libgcc/configure +++ gcc/libgcc/configure @@ -705,6 +705,7 @@ enable_gcov enable_vtable_verify with_aix_soname enable_version_specific_runtime_libs +with_install_sysroot with_slibdir enable_maintainer_mode with_build_libsubdir @@ -1369,6 +1370,8 @@ if test -n "$ac_init_help"; then --with-aix-soname=aix|svr4|both shared library versioning (aka "SONAME") variant to provide on AIX + --with-install-sysroot=DIR + install libraries 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 +2467,24 @@ fi $as_echo "$version_specific_libs" >&6; } +# Check whether --with-install-sysroot was given. +if test "${with_install_sysroot+set}" = set; then : + withval=$with_install_sysroot; case ${with_install_sysroot} in + /) + ;; + */) + with_install_sysroot=`echo $with_install_sysroot | sed 's,/$,,'` + ;; + yes) + with_install_sysroot='$(exec_prefix)/$(host_noncanonical)/sys-root' + ;; +esac +else + with_install_sysroot=no +fi + + + # Check whether --with-slibdir was given. if test "${with_slibdir+set}" = set; then : withval=$with_slibdir; slibdir="$with_slibdir" @@ -2471,7 +2492,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_install_sysroot} in + no) + slibdir='$(exec_prefix)/$(host_noncanonical)/lib' + ;; + *) + slibdir=${with_install_sysroot}/lib + ;; + esac else slibdir='$(libdir)' fi @@ -2701,7 +2729,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_install_sysroot} in + no) + toolexeclibdir='$(toolexecdir)/lib' + ;; + *) + toolexeclibdir=${with_install_sysroot}/lib + ;; + esac else toolexecdir='$(libdir)/gcc-lib/$(target_noncanonical)' toolexeclibdir='$(libdir)' Index: gcc/libgcc/configure.ac =================================================================== --- gcc.orig/libgcc/configure.ac +++ gcc/libgcc/configure.ac @@ -113,16 +113,39 @@ AC_ARG_ENABLE(version-specific-runtime-l [version_specific_libs=no]) AC_MSG_RESULT($version_specific_libs) +AC_ARG_WITH(install-sysroot, + [AS_HELP_STRING([--with-install-sysroot=DIR], + [install libraries within DIR])], + [dnl +case ${with_install_sysroot} in + /) + ;; + */) + with_install_sysroot=`echo $with_install_sysroot | sed 's,/$,,'` + ;; + yes) + with_install_sysroot='$(exec_prefix)/$(host_noncanonical)/sys-root' + ;; +esac], + [with_install_sysroot=no]) + 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_install_sysroot} in + no) + slibdir='$(exec_prefix)/$(host_noncanonical)/lib' + ;; + *) + slibdir=${with_install_sysroot}/lib + ;; + esac else slibdir='$(libdir)' -fi) +fi]) AC_SUBST(slibdir) # Command-line options. @@ -168,7 +191,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_install_sysroot} in + no) + toolexeclibdir='$(toolexecdir)/lib' + ;; + *) + toolexeclibdir=${with_install_sysroot}/lib + ;; + esac else toolexecdir='$(libdir)/gcc-lib/$(target_noncanonical)' toolexeclibdir='$(libdir)' Index: gcc/libgfortran/configure =================================================================== --- gcc.orig/libgfortran/configure +++ gcc/libgfortran/configure @@ -809,6 +809,7 @@ enable_silent_rules enable_maintainer_mode enable_multilib enable_dependency_tracking +with_install_sysroot enable_cet enable_symvers with_gnu_ld @@ -1480,6 +1481,8 @@ if test -n "$ac_init_help"; then --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-install-sysroot=DIR + install libraries 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 +5176,24 @@ $as_echo "$ac_cv_safe_to_define___extens + +# Check whether --with-install-sysroot was given. +if test "${with_install_sysroot+set}" = set; then : + withval=$with_install_sysroot; case ${with_install_sysroot} in + /) + ;; + */) + with_install_sysroot=`echo $with_install_sysroot | sed 's,/$,,'` + ;; + yes) + with_install_sysroot='$(exec_prefix)/$(target_alias)/sys-root' + ;; +esac +else + with_install_sysroot=no +fi + + # Calculate toolexeclibdir # Also toolexecdir, though it's only used in toolexeclibdir case ${version_specific_libs} in @@ -5188,7 +5209,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_install_sysroot} in + no) + toolexeclibdir='$(toolexecdir)/lib' + ;; + *) + toolexeclibdir=${with_install_sysroot}/lib + ;; + esac else toolexecdir='$(libdir)/gcc-lib/$(target_alias)' toolexeclibdir='$(libdir)' @@ -12692,7 +12720,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 12723 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -12798,7 +12826,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 12829 "configure" #include "confdefs.h" #if HAVE_DLFCN_H Index: gcc/libgfortran/configure.ac =================================================================== --- gcc.orig/libgfortran/configure.ac +++ gcc/libgfortran/configure.ac @@ -86,6 +86,22 @@ fi AC_USE_SYSTEM_EXTENSIONS +AC_ARG_WITH(install-sysroot, + [AS_HELP_STRING([--with-install-sysroot=DIR], + [install libraries within DIR])], + [dnl +case ${with_install_sysroot} in + /) + ;; + */) + with_install_sysroot=`echo $with_install_sysroot | sed 's,/$,,'` + ;; + yes) + with_install_sysroot='$(exec_prefix)/$(target_alias)/sys-root' + ;; +esac], + [with_install_sysroot=no]) + # Calculate toolexeclibdir # Also toolexecdir, though it's only used in toolexeclibdir case ${version_specific_libs} in @@ -101,7 +117,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_install_sysroot} in + no) + toolexeclibdir='$(toolexecdir)/lib' + ;; + *) + toolexeclibdir=${with_install_sysroot}/lib + ;; + esac else toolexecdir='$(libdir)/gcc-lib/$(target_alias)' toolexeclibdir='$(libdir)' Index: gcc/libgo/configure =================================================================== --- gcc.orig/libgo/configure +++ gcc/libgo/configure @@ -849,6 +849,7 @@ enable_fast_install enable_libtool_lock enable_werror enable_version_specific_runtime_libs +with_install_sysroot with_libffi with_libatomic with_system_libunwind @@ -1503,6 +1504,8 @@ if test -n "$ac_init_help"; then --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-pic try to use only PIC/non-PIC objects [default=use both] + --with-install-sysroot=DIR + install libraries within DIR --without-libffi don't use libffi --without-libatomic don't use libatomic --with-system-libunwind use installed libunwind @@ -11486,7 +11489,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11489 "configure" +#line 11492 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11592,7 +11595,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11595 "configure" +#line 11598 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -13800,6 +13803,24 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $version_specific_libs" >&5 $as_echo "$version_specific_libs" >&6; } + +# Check whether --with-install-sysroot was given. +if test "${with_install_sysroot+set}" = set; then : + withval=$with_install_sysroot; case ${with_install_sysroot} in + /) + ;; + */) + with_install_sysroot=`echo $with_install_sysroot | sed 's,/$,,'` + ;; + yes) + with_install_sysroot='$(exec_prefix)/$(target_alias)/sys-root' + ;; +esac +else + with_install_sysroot=no +fi + + # Version-specific runtime libs processing. if test $version_specific_libs = yes; then glibgo_toolexecdir='${libdir}/gcc/${host_alias}' @@ -13811,7 +13832,14 @@ fi if test -n "$with_cross_host" && test x"$with_cross_host" != x"no"; then nover_glibgo_toolexecdir='${exec_prefix}/${host_alias}' - nover_glibgo_toolexeclibdir='${toolexecdir}/lib' + case ${with_install_sysroot} in + no) + nover_glibgo_toolexeclibdir='${toolexecdir}/lib' + ;; + *) + nover_glibgo_toolexeclibdir=${with_install_sysroot}/lib + ;; + esac else nover_glibgo_toolexecdir='${libdir}/gcc/${host_alias}' nover_glibgo_toolexeclibdir='${libdir}' Index: gcc/libgo/configure.ac =================================================================== --- gcc.orig/libgo/configure.ac +++ gcc/libgo/configure.ac @@ -80,6 +80,22 @@ AC_ARG_ENABLE([version-specific-runtime- [version_specific_libs=no]) AC_MSG_RESULT($version_specific_libs) +AC_ARG_WITH(install-sysroot, + [AS_HELP_STRING([--with-install-sysroot=DIR], + [install libraries within DIR])], + [dnl +case ${with_install_sysroot} in + /) + ;; + */) + with_install_sysroot=`echo $with_install_sysroot | sed 's,/$,,'` + ;; + yes) + with_install_sysroot='$(exec_prefix)/$(target_alias)/sys-root' + ;; +esac], + [with_install_sysroot=no]) + # Version-specific runtime libs processing. if test $version_specific_libs = yes; then glibgo_toolexecdir='${libdir}/gcc/${host_alias}' @@ -91,7 +107,14 @@ fi if test -n "$with_cross_host" && test x"$with_cross_host" != x"no"; then nover_glibgo_toolexecdir='${exec_prefix}/${host_alias}' - nover_glibgo_toolexeclibdir='${toolexecdir}/lib' + case ${with_install_sysroot} in + no) + nover_glibgo_toolexeclibdir='${toolexecdir}/lib' + ;; + *) + nover_glibgo_toolexeclibdir=${with_install_sysroot}/lib + ;; + esac else nover_glibgo_toolexecdir='${libdir}/gcc/${host_alias}' nover_glibgo_toolexeclibdir='${libdir}' Index: gcc/libgomp/configure =================================================================== --- gcc.orig/libgomp/configure +++ gcc/libgomp/configure @@ -826,6 +826,7 @@ enable_version_specific_runtime_libs enable_generated_files_in_srcdir enable_silent_rules enable_multilib +with_install_sysroot enable_dependency_tracking enable_shared enable_static @@ -1505,6 +1506,8 @@ if test -n "$ac_init_help"; then Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-install-sysroot=DIR + install libraries 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 +3504,24 @@ fi ac_config_commands="$ac_config_commands default-1" + +# Check whether --with-install-sysroot was given. +if test "${with_install_sysroot+set}" = set; then : + withval=$with_install_sysroot; case ${with_install_sysroot} in + /) + ;; + */) + with_install_sysroot=`echo $with_install_sysroot | sed 's,/$,,'` + ;; + yes) + with_install_sysroot='$(exec_prefix)/$(target_alias)/sys-root' + ;; +esac +else + with_install_sysroot=no +fi + + # Calculate toolexeclibdir # Also toolexecdir, though it's only used in toolexeclibdir case ${enable_version_specific_runtime_libs} in @@ -3516,7 +3537,14 @@ case ${enable_version_specific_runtime_l 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_install_sysroot} in + no) + toolexeclibdir='$(toolexecdir)/lib' + ;; + *) + toolexeclibdir=${with_install_sysroot}/lib + ;; + esac else toolexecdir='$(libdir)/gcc-lib/$(target_alias)' toolexeclibdir='$(libdir)' @@ -11405,7 +11433,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 11436 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11511,7 +11539,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 11542 "configure" #include "confdefs.h" #if HAVE_DLFCN_H Index: gcc/libgomp/configure.ac =================================================================== --- gcc.orig/libgomp/configure.ac +++ gcc/libgomp/configure.ac @@ -64,6 +64,22 @@ target_alias=${target_alias-$host_alias} AM_INIT_AUTOMAKE([1.9.0 foreign no-dist -Wall -Wno-portability -Wno-override]) AM_ENABLE_MULTILIB(, ..) +AC_ARG_WITH(install-sysroot, + [AS_HELP_STRING([--with-install-sysroot=DIR], + [install libraries within DIR])], + [dnl +case ${with_install_sysroot} in + /) + ;; + */) + with_install_sysroot=`echo $with_install_sysroot | sed 's,/$,,'` + ;; + yes) + with_install_sysroot='$(exec_prefix)/$(target_alias)/sys-root' + ;; +esac], + [with_install_sysroot=no]) + # Calculate toolexeclibdir # Also toolexecdir, though it's only used in toolexeclibdir case ${enable_version_specific_runtime_libs} in @@ -79,7 +95,14 @@ case ${enable_version_specific_runtime_l 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_install_sysroot} in + no) + toolexeclibdir='$(toolexecdir)/lib' + ;; + *) + toolexeclibdir=${with_install_sysroot}/lib + ;; + esac else toolexecdir='$(libdir)/gcc-lib/$(target_alias)' toolexeclibdir='$(libdir)' Index: gcc/libhsail-rt/configure =================================================================== --- gcc.orig/libhsail-rt/configure +++ gcc/libhsail-rt/configure @@ -773,6 +773,7 @@ enable_silent_rules enable_maintainer_mode enable_dependency_tracking enable_version_specific_runtime_libs +with_install_sysroot enable_shared enable_static with_pic @@ -1435,6 +1436,8 @@ if test -n "$ac_init_help"; then Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-install-sysroot=DIR + install libraries 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 +4656,24 @@ 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-install-sysroot was given. +if test "${with_install_sysroot+set}" = set; then : + withval=$with_install_sysroot; case ${with_install_sysroot} in + /) + ;; + */) + with_install_sysroot=`echo $with_install_sysroot | sed 's,/$,,'` + ;; + yes) + with_install_sysroot='$(exec_prefix)/$(target_alias)/sys-root' + ;; +esac +else + with_install_sysroot=no +fi + + # Calculate toolexeclibdir # Also toolexecdir, though it's only used in toolexeclibdir case ${enable_version_specific_runtime_libs} in @@ -4668,7 +4689,14 @@ case ${enable_version_specific_runtime_l 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_install_sysroot} in + no) + toolexeclibdir='$(toolexecdir)/lib' + ;; + *) + toolexeclibdir=${with_install_sysroot}/lib + ;; + esac else toolexecdir='$(libdir)/gcc-lib/$(target_alias)' toolexeclibdir='$(libdir)' @@ -11212,7 +11240,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 11243 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11318,7 +11346,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 11349 "configure" #include "confdefs.h" #if HAVE_DLFCN_H Index: gcc/libhsail-rt/configure.ac =================================================================== --- gcc.orig/libhsail-rt/configure.ac +++ gcc/libhsail-rt/configure.ac @@ -69,6 +69,22 @@ ler-specific directory]), [enable_version_specific_runtime_libs=no]) AC_MSG_RESULT($enable_version_specific_runtime_libs) +AC_ARG_WITH(install-sysroot, + [AS_HELP_STRING([--with-install-sysroot=DIR], + [install libraries within DIR])], + [dnl +case ${with_install_sysroot} in + /) + ;; + */) + with_install_sysroot=`echo $with_install_sysroot | sed 's,/$,,'` + ;; + yes) + with_install_sysroot='$(exec_prefix)/$(target_alias)/sys-root' + ;; +esac], + [with_install_sysroot=no]) + # Calculate toolexeclibdir # Also toolexecdir, though it's only used in toolexeclibdir case ${enable_version_specific_runtime_libs} in @@ -84,7 +100,14 @@ case ${enable_version_specific_runtime_l 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_install_sysroot} in + no) + toolexeclibdir='$(toolexecdir)/lib' + ;; + *) + toolexeclibdir=${with_install_sysroot}/lib + ;; + esac else toolexecdir='$(libdir)/gcc-lib/$(target_alias)' toolexeclibdir='$(libdir)' Index: gcc/libitm/configure =================================================================== --- gcc.orig/libitm/configure +++ gcc/libitm/configure @@ -802,6 +802,7 @@ enable_version_specific_runtime_libs enable_generated_files_in_srcdir enable_silent_rules enable_multilib +with_install_sysroot enable_dependency_tracking enable_shared enable_static @@ -1472,6 +1473,8 @@ if test -n "$ac_init_help"; then Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-install-sysroot=DIR + install libraries 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 +3530,24 @@ fi ac_config_commands="$ac_config_commands default-1" + +# Check whether --with-install-sysroot was given. +if test "${with_install_sysroot+set}" = set; then : + withval=$with_install_sysroot; case ${with_install_sysroot} in + /) + ;; + */) + with_install_sysroot=`echo $with_install_sysroot | sed 's,/$,,'` + ;; + yes) + with_install_sysroot='$(exec_prefix)/$(target_alias)/sys-root' + ;; +esac +else + with_install_sysroot=no +fi + + # Calculate toolexeclibdir # Also toolexecdir, though it's only used in toolexeclibdir case ${enable_version_specific_runtime_libs} in @@ -3542,7 +3563,14 @@ case ${enable_version_specific_runtime_l 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_install_sysroot} in + no) + toolexeclibdir='$(toolexecdir)/lib' + ;; + *) + toolexeclibdir=${with_install_sysroot}/lib + ;; + esac else toolexecdir='$(libdir)/gcc-lib/$(target_alias)' toolexeclibdir='$(libdir)' @@ -12037,7 +12065,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 12068 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -12143,7 +12171,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 12174 "configure" #include "confdefs.h" #if HAVE_DLFCN_H Index: gcc/libitm/configure.ac =================================================================== --- gcc.orig/libitm/configure.ac +++ gcc/libitm/configure.ac @@ -78,6 +78,22 @@ target_alias=${target_alias-$host_alias} AM_INIT_AUTOMAKE([1.9.0 foreign no-dist -Wall -Wno-portability -Wno-override]) AM_ENABLE_MULTILIB(, ..) +AC_ARG_WITH(install-sysroot, + [AS_HELP_STRING([--with-install-sysroot=DIR], + [install libraries within DIR])], + [dnl +case ${with_install_sysroot} in + /) + ;; + */) + with_install_sysroot=`echo $with_install_sysroot | sed 's,/$,,'` + ;; + yes) + with_install_sysroot='$(exec_prefix)/$(target_alias)/sys-root' + ;; +esac], + [with_install_sysroot=no]) + # Calculate toolexeclibdir # Also toolexecdir, though it's only used in toolexeclibdir case ${enable_version_specific_runtime_libs} in @@ -93,7 +109,14 @@ case ${enable_version_specific_runtime_l 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_install_sysroot} in + no) + toolexeclibdir='$(toolexecdir)/lib' + ;; + *) + toolexeclibdir=${with_install_sysroot}/lib + ;; + esac else toolexecdir='$(libdir)/gcc-lib/$(target_alias)' toolexeclibdir='$(libdir)' Index: gcc/libobjc/configure =================================================================== --- gcc.orig/libobjc/configure +++ gcc/libobjc/configure @@ -746,6 +746,7 @@ with_target_subdir with_cross_host enable_version_specific_runtime_libs enable_multilib +with_install_sysroot enable_cet enable_maintainer_mode enable_shared @@ -1402,6 +1403,8 @@ if test -n "$ac_init_help"; then --with-target-subdir=SUBDIR configuring in a subdirectory --with-cross-host=HOST configuring with a cross compiler + --with-install-sysroot=DIR + install libraries 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 +2505,24 @@ case $srcdir in esac + +# Check whether --with-install-sysroot was given. +if test "${with_install_sysroot+set}" = set; then : + withval=$with_install_sysroot; case ${with_install_sysroot} in + /) + ;; + */) + with_install_sysroot=`echo $with_install_sysroot | sed 's,/$,,'` + ;; + yes) + with_install_sysroot='$(exec_prefix)/$(target_noncanonical)/sys-root' + ;; +esac +else + with_install_sysroot=no +fi + + # Calculate toolexeclibdir # Also toolexecdir, though it's only used in toolexeclibdir case ${version_specific_libs} in @@ -2517,7 +2538,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_install_sysroot} in + no) + toolexeclibdir='$(toolexecdir)/lib' + ;; + *) + toolexeclibdir=${with_install_sysroot}/lib + ;; + esac else toolexecdir='$(libdir)/gcc-lib/$(target_noncanonical)' toolexeclibdir='$(libdir)' @@ -10748,7 +10776,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 10779 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -10854,7 +10882,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 10885 "configure" #include "confdefs.h" #if HAVE_DLFCN_H Index: gcc/libobjc/configure.ac =================================================================== --- gcc.orig/libobjc/configure.ac +++ gcc/libobjc/configure.ac @@ -76,6 +76,22 @@ case $srcdir in esac AC_SUBST(glibcpp_srcdir) +AC_ARG_WITH(install-sysroot, + [AS_HELP_STRING([--with-install-sysroot=DIR], + [install libraries within DIR])], + [dnl +case ${with_install_sysroot} in + /) + ;; + */) + with_install_sysroot=`echo $with_install_sysroot | sed 's,/$,,'` + ;; + yes) + with_install_sysroot='$(exec_prefix)/$(target_noncanonical)/sys-root' + ;; +esac], + [with_install_sysroot=no]) + # Calculate toolexeclibdir # Also toolexecdir, though it's only used in toolexeclibdir case ${version_specific_libs} in @@ -91,7 +107,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_install_sysroot} in + no) + toolexeclibdir='$(toolexecdir)/lib' + ;; + *) + toolexeclibdir=${with_install_sysroot}/lib + ;; + esac else toolexecdir='$(libdir)/gcc-lib/$(target_noncanonical)' toolexeclibdir='$(libdir)' Index: gcc/liboffloadmic/configure =================================================================== --- gcc.orig/liboffloadmic/configure +++ gcc/liboffloadmic/configure @@ -775,6 +775,7 @@ enable_maintainer_mode enable_dependency_tracking enable_multilib enable_version_specific_runtime_libs +with_install_sysroot enable_shared enable_static with_pic @@ -1437,6 +1438,8 @@ if test -n "$ac_init_help"; then Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-install-sysroot=DIR + install libraries 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 +5296,24 @@ else fi + +# Check whether --with-install-sysroot was given. +if test "${with_install_sysroot+set}" = set; then : + withval=$with_install_sysroot; case ${with_install_sysroot} in + /) + ;; + */) + with_install_sysroot=`echo $with_install_sysroot | sed 's,/$,,'` + ;; + yes) + with_install_sysroot='$(exec_prefix)/$(target_alias)/sys-root' + ;; +esac +else + with_install_sysroot=no +fi + + # Calculate toolexeclibdir. # Also toolexecdir, though it's only used in toolexeclibdir. case ${enable_version_specific_runtime_libs} in @@ -5308,7 +5329,14 @@ case ${enable_version_specific_runtime_l 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_install_sysroot} in + no) + toolexeclibdir='$(toolexecdir)/lib' + ;; + *) + toolexeclibdir=${with_install_sysroot}/lib + ;; + esac else toolexecdir='$(libdir)/gcc-lib/$(target_alias)' toolexeclibdir='$(libdir)' @@ -11403,7 +11431,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 11434 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11509,7 +11537,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 11540 "configure" #include "confdefs.h" #if HAVE_DLFCN_H Index: gcc/liboffloadmic/configure.ac =================================================================== --- gcc.orig/liboffloadmic/configure.ac +++ gcc/liboffloadmic/configure.ac @@ -79,6 +79,22 @@ case "$enable_liboffloadmic" in esac AM_CONDITIONAL(LIBOFFLOADMIC_HOST, [test x"$enable_liboffloadmic" = xhost]) +AC_ARG_WITH(install-sysroot, + [AS_HELP_STRING([--with-install-sysroot=DIR], + [install libraries within DIR])], + [dnl +case ${with_install_sysroot} in + /) + ;; + */) + with_install_sysroot=`echo $with_install_sysroot | sed 's,/$,,'` + ;; + yes) + with_install_sysroot='$(exec_prefix)/$(target_alias)/sys-root' + ;; +esac], + [with_install_sysroot=no]) + # Calculate toolexeclibdir. # Also toolexecdir, though it's only used in toolexeclibdir. case ${enable_version_specific_runtime_libs} in @@ -94,7 +110,14 @@ case ${enable_version_specific_runtime_l 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_install_sysroot} in + no) + toolexeclibdir='$(toolexecdir)/lib' + ;; + *) + toolexeclibdir=${with_install_sysroot}/lib + ;; + esac else toolexecdir='$(libdir)/gcc-lib/$(target_alias)' toolexeclibdir='$(libdir)' Index: gcc/liboffloadmic/plugin/configure =================================================================== --- gcc.orig/liboffloadmic/plugin/configure +++ gcc/liboffloadmic/plugin/configure @@ -771,6 +771,7 @@ enable_maintainer_mode enable_dependency_tracking enable_multilib enable_version_specific_runtime_libs +with_install_sysroot enable_shared enable_static with_pic @@ -1434,6 +1435,8 @@ if test -n "$ac_init_help"; then Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-install-sysroot=DIR + install libraries 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 +4545,24 @@ fi $as_echo "$enable_version_specific_runtime_libs" >&6; } + +# Check whether --with-install-sysroot was given. +if test "${with_install_sysroot+set}" = set; then : + withval=$with_install_sysroot; case ${with_install_sysroot} in + /) + ;; + */) + with_install_sysroot=`echo $with_install_sysroot | sed 's,/$,,'` + ;; + yes) + with_install_sysroot='$(exec_prefix)/$(target_alias)/sys-root' + ;; +esac +else + with_install_sysroot=no +fi + + # Calculate toolexeclibdir. # Also toolexecdir, though it's only used in toolexeclibdir. case ${enable_version_specific_runtime_libs} in @@ -4557,7 +4578,14 @@ case ${enable_version_specific_runtime_l 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_install_sysroot} in + no) + toolexeclibdir='$(toolexecdir)/lib' + ;; + *) + toolexeclibdir=${with_install_sysroot}/lib + ;; + esac else toolexecdir='$(libdir)/gcc-lib/$(target_alias)' toolexeclibdir='$(libdir)' @@ -11050,7 +11078,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 11081 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11156,7 +11184,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 11187 "configure" #include "confdefs.h" #if HAVE_DLFCN_H Index: gcc/liboffloadmic/plugin/configure.ac =================================================================== --- gcc.orig/liboffloadmic/plugin/configure.ac +++ gcc/liboffloadmic/plugin/configure.ac @@ -95,6 +95,22 @@ AC_ARG_ENABLE([version-specific-runtime- AC_MSG_RESULT($enable_version_specific_runtime_libs) +AC_ARG_WITH(install-sysroot, + [AS_HELP_STRING([--with-install-sysroot=DIR], + [install libraries within DIR])], + [dnl +case ${with_install_sysroot} in + /) + ;; + */) + with_install_sysroot=`echo $with_install_sysroot | sed 's,/$,,'` + ;; + yes) + with_install_sysroot='$(exec_prefix)/$(target_alias)/sys-root' + ;; +esac], + [with_install_sysroot=no]) + # Calculate toolexeclibdir. # Also toolexecdir, though it's only used in toolexeclibdir. case ${enable_version_specific_runtime_libs} in @@ -110,7 +126,14 @@ case ${enable_version_specific_runtime_l 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_install_sysroot} in + no) + toolexeclibdir='$(toolexecdir)/lib' + ;; + *) + toolexeclibdir=${with_install_sysroot}/lib + ;; + esac else toolexecdir='$(libdir)/gcc-lib/$(target_alias)' toolexeclibdir='$(libdir)' Index: gcc/libphobos/configure =================================================================== --- gcc.orig/libphobos/configure +++ gcc/libphobos/configure @@ -837,6 +837,7 @@ with_libbacktrace with_target_system_zlib with_cross_host enable_version_specific_runtime_libs +with_install_sysroot enable_libphobos ' ac_precious_vars='build_alias @@ -1504,6 +1505,8 @@ if test -n "$ac_init_help"; then --with-target-system-zlib={yes,no,auto} use installed libz (default: no) --with-cross-host=HOST configuring with a cross compiler + --with-install-sysroot=DIR + install libraries within DIR Some influential environment variables: CC C compiler command @@ -11640,7 +11643,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 11646 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11746,7 +11749,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 11752 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -15237,6 +15240,24 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $version_specific_libs" >&5 $as_echo "$version_specific_libs" >&6; } + +# Check whether --with-install-sysroot was given. +if test "${with_install_sysroot+set}" = set; then : + withval=$with_install_sysroot; case ${with_install_sysroot} in + /) + ;; + */) + with_install_sysroot=`echo $with_install_sysroot | sed 's,/$,,'` + ;; + yes) + with_install_sysroot='${exec_prefix}/${host_alias}/sys-root' + ;; + esac +else + with_install_sysroot=no +fi + + # Version-specific runtime libs processing. if test $version_specific_libs = yes; then libphobos_toolexecdir='${libdir}/gcc/${host_alias}' @@ -15246,7 +15267,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_install_sysroot} in + no) + libphobos_toolexeclibdir='${toolexecdir}/lib' + ;; + *) + libphobos_toolexeclibdir=${with_install_sysroot}/lib + ;; + esac else libphobos_toolexecdir='${libdir}/gcc/${host_alias}' libphobos_toolexeclibdir='${libdir}' Index: gcc/libphobos/m4/druntime.m4 =================================================================== --- gcc.orig/libphobos/m4/druntime.m4 +++ gcc/libphobos/m4/druntime.m4 @@ -80,6 +80,22 @@ AC_DEFUN([DRUNTIME_INSTALL_DIRECTORIES], [version_specific_libs=no]) AC_MSG_RESULT($version_specific_libs) + AC_ARG_WITH(install-sysroot, + [AS_HELP_STRING([--with-install-sysroot=DIR], + [install libraries within DIR])], + [dnl + case ${with_install_sysroot} in + /) + ;; + */) + with_install_sysroot=`echo $with_install_sysroot | sed 's,/$,,'` + ;; + yes) + with_install_sysroot='${exec_prefix}/${host_alias}/sys-root' + ;; + esac], + [with_install_sysroot=no]) + # Version-specific runtime libs processing. if test $version_specific_libs = yes; then libphobos_toolexecdir='${libdir}/gcc/${host_alias}' @@ -89,7 +105,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_install_sysroot} in + no) + libphobos_toolexeclibdir='${toolexecdir}/lib' + ;; + *) + libphobos_toolexeclibdir=${with_install_sysroot}/lib + ;; + esac else libphobos_toolexecdir='${libdir}/gcc/${host_alias}' libphobos_toolexeclibdir='${libdir}' Index: gcc/libquadmath/configure =================================================================== --- gcc.orig/libquadmath/configure +++ gcc/libquadmath/configure @@ -786,6 +786,7 @@ enable_fast_install with_gnu_ld enable_libtool_lock enable_maintainer_mode +with_install_sysroot enable_symvers enable_cet enable_generated_files_in_srcdir @@ -1451,6 +1452,8 @@ if test -n "$ac_init_help"; then --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-install-sysroot=DIR + install libraries within DIR --with-gcc-major-version-only use only GCC major number in filesystem paths @@ -10810,7 +10813,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 10816 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -10916,7 +10919,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 10922 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -12088,6 +12091,24 @@ ac_link='$CC -o conftest$ac_exeext $CFLA ac_compiler_gnu=$ac_cv_c_compiler_gnu + +# Check whether --with-install-sysroot was given. +if test "${with_install_sysroot+set}" = set; then : + withval=$with_install_sysroot; case ${with_install_sysroot} in + /) + ;; + */) + with_install_sysroot=`echo $with_install_sysroot | sed 's,/$,,'` + ;; + yes) + with_install_sysroot='$(exec_prefix)/$(target_alias)/sys-root' + ;; +esac +else + with_install_sysroot=no +fi + + # Calculate toolexeclibdir # Also toolexecdir, though it's only used in toolexeclibdir case ${version_specific_libs} in @@ -12103,7 +12124,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_install_sysroot} in + no) + toolexeclibdir='$(toolexecdir)/lib' + ;; + *) + toolexeclibdir=${with_install_sysroot}/lib + ;; + esac else toolexecdir='$(libdir)/gcc-lib/$(target_alias)' toolexeclibdir='$(libdir)' Index: gcc/libquadmath/configure.ac =================================================================== --- gcc.orig/libquadmath/configure.ac +++ gcc/libquadmath/configure.ac @@ -82,6 +82,22 @@ if test "x$GCC" != "xyes"; then fi AC_PROG_CPP +AC_ARG_WITH(install-sysroot, + [AS_HELP_STRING([--with-install-sysroot=DIR], + [install libraries within DIR])], + [dnl +case ${with_install_sysroot} in + /) + ;; + */) + with_install_sysroot=`echo $with_install_sysroot | sed 's,/$,,'` + ;; + yes) + with_install_sysroot='$(exec_prefix)/$(target_alias)/sys-root' + ;; +esac], + [with_install_sysroot=no]) + # Calculate toolexeclibdir # Also toolexecdir, though it's only used in toolexeclibdir case ${version_specific_libs} in @@ -97,7 +113,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_install_sysroot} in + no) + toolexeclibdir='$(toolexecdir)/lib' + ;; + *) + toolexeclibdir=${with_install_sysroot}/lib + ;; + esac else toolexecdir='$(libdir)/gcc-lib/$(target_alias)' toolexeclibdir='$(libdir)' Index: gcc/libsanitizer/configure =================================================================== --- gcc.orig/libsanitizer/configure +++ gcc/libsanitizer/configure @@ -806,6 +806,7 @@ enable_version_specific_runtime_libs enable_dependency_tracking enable_silent_rules enable_maintainer_mode +with_install_sysroot enable_shared enable_static with_pic @@ -1470,6 +1471,8 @@ if test -n "$ac_init_help"; then Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-install-sysroot=DIR + install libraries 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 +5015,24 @@ fi + +# Check whether --with-install-sysroot was given. +if test "${with_install_sysroot+set}" = set; then : + withval=$with_install_sysroot; case ${with_install_sysroot} in + /) + ;; + */) + with_install_sysroot=`echo $with_install_sysroot | sed 's,/$,,'` + ;; + yes) + with_install_sysroot='$(exec_prefix)/$(target_alias)/sys-root' + ;; +esac +else + with_install_sysroot=no +fi + + # Calculate toolexeclibdir # Also toolexecdir, though it's only used in toolexeclibdir case ${version_specific_libs} in @@ -5027,7 +5048,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_install_sysroot} in + no) + toolexeclibdir='$(toolexecdir)/lib' + ;; + *) + toolexeclibdir=${with_install_sysroot}/lib + ;; + esac else toolexecdir='$(libdir)/gcc-lib/$(target_alias)' toolexeclibdir='$(libdir)' @@ -12334,7 +12362,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 12365 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -12440,7 +12468,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 12471 "configure" #include "confdefs.h" #if HAVE_DLFCN_H Index: gcc/libsanitizer/configure.ac =================================================================== --- gcc.orig/libsanitizer/configure.ac +++ gcc/libsanitizer/configure.ac @@ -29,6 +29,22 @@ GCC_LIBSTDCXX_RAW_CXX_FLAGS AM_INIT_AUTOMAKE(foreign no-dist) AM_MAINTAINER_MODE +AC_ARG_WITH(install-sysroot, + [AS_HELP_STRING([--with-install-sysroot=DIR], + [install libraries within DIR])], + [dnl +case ${with_install_sysroot} in + /) + ;; + */) + with_install_sysroot=`echo $with_install_sysroot | sed 's,/$,,'` + ;; + yes) + with_install_sysroot='$(exec_prefix)/$(target_alias)/sys-root' + ;; +esac], + [with_install_sysroot=no]) + # Calculate toolexeclibdir # Also toolexecdir, though it's only used in toolexeclibdir case ${version_specific_libs} in @@ -44,7 +60,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_install_sysroot} in + no) + toolexeclibdir='$(toolexecdir)/lib' + ;; + *) + toolexeclibdir=${with_install_sysroot}/lib + ;; + esac else toolexecdir='$(libdir)/gcc-lib/$(target_alias)' toolexeclibdir='$(libdir)' Index: gcc/libssp/configure =================================================================== --- gcc.orig/libssp/configure +++ gcc/libssp/configure @@ -781,6 +781,7 @@ with_pic enable_fast_install with_gnu_ld enable_libtool_lock +with_install_sysroot with_gcc_major_version_only ' ac_precious_vars='build_alias @@ -1432,6 +1433,8 @@ if test -n "$ac_init_help"; then --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-install-sysroot=DIR + install libraries within DIR --with-gcc-major-version-only use only GCC major number in filesystem paths @@ -10992,7 +10995,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 10998 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11098,7 +11101,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 11104 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11360,6 +11363,24 @@ esac + +# Check whether --with-install-sysroot was given. +if test "${with_install_sysroot+set}" = set; then : + withval=$with_install_sysroot; case ${with_install_sysroot} in + /) + ;; + */) + with_install_sysroot=`echo $with_install_sysroot | sed 's,/$,,'` + ;; + yes) + with_install_sysroot='$(exec_prefix)/$(target_alias)/sys-root' + ;; +esac +else + with_install_sysroot=no +fi + + # Calculate toolexeclibdir # Also toolexecdir, though it's only used in toolexeclibdir case ${version_specific_libs} in @@ -11375,7 +11396,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_install_sysroot} in + no) + toolexeclibdir='$(toolexecdir)/lib' + ;; + *) + toolexeclibdir=${with_install_sysroot}/lib + ;; + esac else toolexecdir='$(libdir)/gcc-lib/$(target_alias)' toolexeclibdir='$(libdir)' Index: gcc/libssp/configure.ac =================================================================== --- gcc.orig/libssp/configure.ac +++ gcc/libssp/configure.ac @@ -163,6 +163,22 @@ ACX_LT_HOST_FLAGS AC_SUBST(enable_shared) AC_SUBST(enable_static) +AC_ARG_WITH(install-sysroot, + [AS_HELP_STRING([--with-install-sysroot=DIR], + [install libraries within DIR])], + [dnl +case ${with_install_sysroot} in + /) + ;; + */) + with_install_sysroot=`echo $with_install_sysroot | sed 's,/$,,'` + ;; + yes) + with_install_sysroot='$(exec_prefix)/$(target_alias)/sys-root' + ;; +esac], + [with_install_sysroot=no]) + # Calculate toolexeclibdir # Also toolexecdir, though it's only used in toolexeclibdir case ${version_specific_libs} in @@ -178,7 +194,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_install_sysroot} in + no) + toolexeclibdir='$(toolexecdir)/lib' + ;; + *) + toolexeclibdir=${with_install_sysroot}/lib + ;; + esac else toolexecdir='$(libdir)/gcc-lib/$(target_alias)' toolexeclibdir='$(libdir)' Index: gcc/libstdc++-v3/acinclude.m4 =================================================================== --- gcc.orig/libstdc++-v3/acinclude.m4 +++ gcc/libstdc++-v3/acinclude.m4 @@ -782,6 +782,22 @@ AC_DEFUN([GLIBCXX_EXPORT_INSTALL_INFO], [version_specific_libs=no]) AC_MSG_RESULT($version_specific_libs) + AC_ARG_WITH(install-sysroot, + [AS_HELP_STRING([--with-install-sysroot=DIR], + [install libraries within DIR])], + [dnl + case ${with_install_sysroot} in + /) + ;; + */) + with_install_sysroot=`echo $with_install_sysroot | sed 's,/$,,'` + ;; + yes) + with_install_sysroot='${exec_prefix}/${host_alias}/sys-root' + ;; + esac], + [with_install_sysroot=no]) + # 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}' @@ -812,7 +828,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_install_sysroot} in + no) + glibcxx_toolexeclibdir='${toolexecdir}/lib' + ;; + *) + glibcxx_toolexeclibdir=${with_install_sysroot}/lib + ;; + esac else glibcxx_toolexecdir='${libdir}/gcc/${host_alias}' glibcxx_toolexeclibdir='${libdir}' Index: gcc/libstdc++-v3/configure =================================================================== --- gcc.orig/libstdc++-v3/configure +++ gcc/libstdc++-v3/configure @@ -942,6 +942,7 @@ enable_libstdcxx_filesystem_ts enable_cet with_gxx_include_dir enable_version_specific_runtime_libs +with_install_sysroot with_gcc_major_version_only ' ac_precious_vars='build_alias @@ -1669,6 +1670,8 @@ if test -n "$ac_init_help"; then set the std::string ABI to use by default --with-gxx-include-dir=DIR installation directory for include files + --with-install-sysroot=DIR + install libraries within DIR --with-gcc-major-version-only use only GCC major number in filesystem paths @@ -12053,7 +12056,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 12059 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -12159,7 +12162,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 12165 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -15851,7 +15854,7 @@ $as_echo "$glibcxx_cv_atomic_long_long" # Fake what AC_TRY_COMPILE does. cat > conftest.$ac_ext << EOF -#line 15854 "configure" +#line 15857 "configure" int main() { typedef bool atomic_type; @@ -15886,7 +15889,7 @@ $as_echo "$glibcxx_cv_atomic_bool" >&6; rm -f conftest* cat > conftest.$ac_ext << EOF -#line 15889 "configure" +#line 15892 "configure" int main() { typedef short atomic_type; @@ -15921,7 +15924,7 @@ $as_echo "$glibcxx_cv_atomic_short" >&6; rm -f conftest* cat > conftest.$ac_ext << EOF -#line 15924 "configure" +#line 15927 "configure" int main() { // NB: _Atomic_word not necessarily int. @@ -15957,7 +15960,7 @@ $as_echo "$glibcxx_cv_atomic_int" >&6; } rm -f conftest* cat > conftest.$ac_ext << EOF -#line 15960 "configure" +#line 15963 "configure" int main() { typedef long long atomic_type; @@ -16110,7 +16113,7 @@ $as_echo "mutex" >&6; } # unnecessary for this test. cat > conftest.$ac_ext << EOF -#line 16113 "configure" +#line 16116 "configure" int main() { _Decimal32 d1; @@ -16152,7 +16155,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu # unnecessary for this test. cat > conftest.$ac_ext << EOF -#line 16155 "configure" +#line 16158 "configure" template struct same { typedef T2 type; }; @@ -16186,7 +16189,7 @@ $as_echo "$enable_int128" >&6; } rm -f conftest* cat > conftest.$ac_ext << EOF -#line 16189 "configure" +#line 16192 "configure" template struct same { typedef T2 type; }; @@ -76493,6 +76496,24 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $version_specific_libs" >&5 $as_echo "$version_specific_libs" >&6; } + +# Check whether --with-install-sysroot was given. +if test "${with_install_sysroot+set}" = set; then : + withval=$with_install_sysroot; case ${with_install_sysroot} in + /) + ;; + */) + with_install_sysroot=`echo $with_install_sysroot | sed 's,/$,,'` + ;; + yes) + with_install_sysroot='${exec_prefix}/${host_alias}/sys-root' + ;; + esac +else + with_install_sysroot=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}' @@ -76523,7 +76544,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_install_sysroot} in + no) + glibcxx_toolexeclibdir='${toolexecdir}/lib' + ;; + *) + glibcxx_toolexeclibdir=${with_install_sysroot}/lib + ;; + esac else glibcxx_toolexecdir='${libdir}/gcc/${host_alias}' glibcxx_toolexeclibdir='${libdir}' Index: gcc/libvtv/configure =================================================================== --- gcc.orig/libvtv/configure +++ gcc/libvtv/configure @@ -790,6 +790,7 @@ enable_vtable_verify enable_dependency_tracking enable_silent_rules enable_maintainer_mode +with_install_sysroot enable_shared enable_static with_pic @@ -1450,6 +1451,8 @@ if test -n "$ac_init_help"; then Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-install-sysroot=DIR + install libraries 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 +4810,24 @@ fi + +# Check whether --with-install-sysroot was given. +if test "${with_install_sysroot+set}" = set; then : + withval=$with_install_sysroot; case ${with_install_sysroot} in + /) + ;; + */) + with_install_sysroot=`echo $with_install_sysroot | sed 's,/$,,'` + ;; + yes) + with_install_sysroot='$(exec_prefix)/$(target_alias)/sys-root' + ;; +esac +else + with_install_sysroot=no +fi + + # Calculate toolexeclibdir # Also toolexecdir, though it's only used in toolexeclibdir case ${version_specific_libs} in @@ -4822,7 +4843,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_install_sysroot} in + no) + toolexeclibdir='$(toolexecdir)/lib' + ;; + *) + toolexeclibdir=${with_install_sysroot}/lib + ;; + esac else toolexecdir='$(libdir)/gcc-lib/$(target_alias)' toolexeclibdir='$(libdir)' @@ -12235,7 +12263,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 12266 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -12341,7 +12369,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 12372 "configure" #include "confdefs.h" #if HAVE_DLFCN_H Index: gcc/libvtv/configure.ac =================================================================== --- gcc.orig/libvtv/configure.ac +++ gcc/libvtv/configure.ac @@ -78,6 +78,22 @@ AM_MAINTAINER_MODE LIBVTV_CONFIGURE +AC_ARG_WITH(install-sysroot, + [AS_HELP_STRING([--with-install-sysroot=DIR], + [install libraries within DIR])], + [dnl +case ${with_install_sysroot} in + /) + ;; + */) + with_install_sysroot=`echo $with_install_sysroot | sed 's,/$,,'` + ;; + yes) + with_install_sysroot='$(exec_prefix)/$(target_alias)/sys-root' + ;; +esac], + [with_install_sysroot=no]) + # Calculate toolexeclibdir # Also toolexecdir, though it's only used in toolexeclibdir case ${version_specific_libs} in @@ -93,7 +109,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_install_sysroot} in + no) + toolexeclibdir='$(toolexecdir)/lib' + ;; + *) + toolexeclibdir=${with_install_sysroot}/lib + ;; + esac else toolexecdir='$(libdir)/gcc-lib/$(target_alias)' toolexeclibdir='$(libdir)' Index: gcc/zlib/configure =================================================================== --- gcc.orig/zlib/configure +++ gcc/zlib/configure @@ -774,6 +774,7 @@ with_pic enable_fast_install with_gnu_ld enable_libtool_lock +with_install_sysroot enable_host_shared ' ac_precious_vars='build_alias @@ -1427,6 +1428,8 @@ if test -n "$ac_init_help"; then --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-install-sysroot=DIR + install libraries within DIR Some influential environment variables: CC C compiler command @@ -10648,7 +10651,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 10654 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -10754,7 +10757,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 10760 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11379,10 +11382,35 @@ fi done + +# Check whether --with-install-sysroot was given. +if test "${with_install_sysroot+set}" = set; then : + withval=$with_install_sysroot; case ${with_install_sysroot} in + /) + ;; + */) + with_install_sysroot=`echo $with_install_sysroot | sed 's,/$,,'` + ;; + yes) + with_install_sysroot='$(exec_prefix)/$(target_alias)/sys-root' + ;; +esac +else + with_install_sysroot=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_install_sysroot} in + no) + toolexeclibdir='$(toolexecdir)/lib' + ;; + *) + toolexeclibdir=${with_install_sysroot}/lib + ;; + esac else toolexecdir='$(libdir)/gcc-lib/$(target_alias)' toolexeclibdir='$(libdir)' Index: gcc/zlib/configure.ac =================================================================== --- gcc.orig/zlib/configure.ac +++ gcc/zlib/configure.ac @@ -81,10 +81,33 @@ fi AC_CHECK_HEADERS(unistd.h) +AC_ARG_WITH(install-sysroot, + [AS_HELP_STRING([--with-install-sysroot=DIR], + [install libraries within DIR])], + [dnl +case ${with_install_sysroot} in + /) + ;; + */) + with_install_sysroot=`echo $with_install_sysroot | sed 's,/$,,'` + ;; + yes) + with_install_sysroot='$(exec_prefix)/$(target_alias)/sys-root' + ;; +esac], + [with_install_sysroot=no]) + if test -n "$with_cross_host" && test x"$with_cross_host" != x"no"; then toolexecdir='$(exec_prefix)/$(target_alias)' - toolexeclibdir='$(toolexecdir)/lib' + case ${with_install_sysroot} in + no) + toolexeclibdir='$(toolexecdir)/lib' + ;; + *) + toolexeclibdir=${with_install_sysroot}/lib + ;; + esac else toolexecdir='$(libdir)/gcc-lib/$(target_alias)' toolexeclibdir='$(libdir)'