diff mbox series

Correct DLL Installation Path for x86_64-w64-mingw32 Multilib [PR115094]

Message ID LV3P223MB091661D0B3F268852BB9877DD6E32@LV3P223MB0916.NAMP223.PROD.OUTLOOK.COM
State New
Headers show
Series Correct DLL Installation Path for x86_64-w64-mingw32 Multilib [PR115094] | expand

Commit Message

unlvsur unlvsur May 14, 2024, 8:26 p.m. UTC
From: trcrsired <uwgghhbcad@gmail.com>

When building native GCC for the x86_64-w64-mingw32 host, the compiler copies its library DLLs to the `bin` directory. However, in the case of a multilib configuration, both 32-bit and 64-bit libraries end up in the same `bin` directory, leading to conflicts where 64-bit DLLs are overridden by their 32-bit counterparts.

This patch addresses the issue by adjusting the installation path for the libraries. Specifically, it installs the libraries to separate directories: `lib` for 64-bit and `lib32` for 32-bit. This behavior aligns with how libraries are installed when creating an x86_64-w64-mingw32 cross-compiler without copying them to the `bin` directory if it is a multilib build.
---
 gcc/configure           | 26 ++++++++++++++++++++++++++
 libatomic/configure     | 13 +++++++++++++
 libbacktrace/configure  | 13 +++++++++++++
 libcc1/configure        | 26 ++++++++++++++++++++++++++
 libffi/configure        | 26 ++++++++++++++++++++++++++
 libgfortran/configure   | 26 ++++++++++++++++++++++++++
 libgm2/configure        | 26 ++++++++++++++++++++++++++
 libgo/config/libtool.m4 | 13 +++++++++++++
 libgo/configure         | 13 +++++++++++++
 libgomp/configure       | 26 ++++++++++++++++++++++++++
 libgrust/configure      | 26 ++++++++++++++++++++++++++
 libitm/configure        | 26 ++++++++++++++++++++++++++
 libobjc/configure       | 13 +++++++++++++
 libphobos/configure     | 13 +++++++++++++
 libquadmath/configure   | 13 +++++++++++++
 libsanitizer/configure  | 26 ++++++++++++++++++++++++++
 libssp/configure        | 13 +++++++++++++
 libstdc++-v3/configure  | 26 ++++++++++++++++++++++++++
 libtool.m4              | 13 +++++++++++++
 libvtv/configure        | 26 ++++++++++++++++++++++++++
 lto-plugin/configure    | 13 +++++++++++++
 zlib/configure          | 13 +++++++++++++
 22 files changed, 429 insertions(+)

Comments

Richard Biener May 15, 2024, 7:46 a.m. UTC | #1
On Tue, May 14, 2024 at 10:27 PM trcrsired <unlvsur@live.com> wrote:
>
> From: trcrsired <uwgghhbcad@gmail.com>
>
> When building native GCC for the x86_64-w64-mingw32 host, the compiler copies its library DLLs to the `bin` directory. However, in the case of a multilib configuration, both 32-bit and 64-bit libraries end up in the same `bin` directory, leading to conflicts where 64-bit DLLs are overridden by their 32-bit counterparts.
>
> This patch addresses the issue by adjusting the installation path for the libraries. Specifically, it installs the libraries to separate directories: `lib` for 64-bit and `lib32` for 32-bit. This behavior aligns with how libraries are installed when creating an x86_64-w64-mingw32 cross-compiler without copying them to the `bin` directory if it is a multilib build.

You need to patch configure.ac, not only the generated files.

> ---
>  gcc/configure           | 26 ++++++++++++++++++++++++++
>  libatomic/configure     | 13 +++++++++++++
>  libbacktrace/configure  | 13 +++++++++++++
>  libcc1/configure        | 26 ++++++++++++++++++++++++++
>  libffi/configure        | 26 ++++++++++++++++++++++++++
>  libgfortran/configure   | 26 ++++++++++++++++++++++++++
>  libgm2/configure        | 26 ++++++++++++++++++++++++++
>  libgo/config/libtool.m4 | 13 +++++++++++++
>  libgo/configure         | 13 +++++++++++++
>  libgomp/configure       | 26 ++++++++++++++++++++++++++
>  libgrust/configure      | 26 ++++++++++++++++++++++++++
>  libitm/configure        | 26 ++++++++++++++++++++++++++
>  libobjc/configure       | 13 +++++++++++++
>  libphobos/configure     | 13 +++++++++++++
>  libquadmath/configure   | 13 +++++++++++++
>  libsanitizer/configure  | 26 ++++++++++++++++++++++++++
>  libssp/configure        | 13 +++++++++++++
>  libstdc++-v3/configure  | 26 ++++++++++++++++++++++++++
>  libtool.m4              | 13 +++++++++++++
>  libvtv/configure        | 26 ++++++++++++++++++++++++++
>  lto-plugin/configure    | 13 +++++++++++++
>  zlib/configure          | 13 +++++++++++++
>  22 files changed, 429 insertions(+)
>
> diff --git a/gcc/configure b/gcc/configure
> index aaf5899cc03..beab6df1878 100755
> --- a/gcc/configure
> +++ b/gcc/configure
> @@ -20472,6 +20472,18 @@ cygwin* | mingw* | pw32* | cegcc*)
>    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
>      library_names_spec='$libname.dll.a'
>      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> +    if test ${multilib} = yes; then
> +    postinstall_cmds='base_file=`basename \${file}`~
> +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> +      dldir=$destdir/`dirname \$dlpath`~
> +      $install_prog $dir/$dlname $destdir/$dlname~
> +      chmod a+x $destdir/$dlname~
> +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> +      fi'
> +    else
>      postinstall_cmds='base_file=`basename \${file}`~
>        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
>        dldir=$destdir/`dirname \$dlpath`~
> @@ -20481,6 +20493,7 @@ cygwin* | mingw* | pw32* | cegcc*)
>        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
>          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
>        fi'
> +    fi
>      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
>        dlpath=$dir/\$dldll~
>         $RM \$dlpath'
> @@ -24200,6 +24213,18 @@ cygwin* | mingw* | pw32* | cegcc*)
>    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
>      library_names_spec='$libname.dll.a'
>      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> +    if test ${multilib} = yes; then
> +    postinstall_cmds='base_file=`basename \${file}`~
> +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> +      dldir=$destdir/`dirname \$dlpath`~
> +      $install_prog $dir/$dlname $destdir/$dlname~
> +      chmod a+x $destdir/$dlname~
> +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> +      fi'
> +    else
>      postinstall_cmds='base_file=`basename \${file}`~
>        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
>        dldir=$destdir/`dirname \$dlpath`~
> @@ -24209,6 +24234,7 @@ cygwin* | mingw* | pw32* | cegcc*)
>        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
>          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
>        fi'
> +    fi
>      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
>        dlpath=$dir/\$dldll~
>         $RM \$dlpath'
> diff --git a/libatomic/configure b/libatomic/configure
> index 32cb3ecac26..cb17a863719 100755
> --- a/libatomic/configure
> +++ b/libatomic/configure
> @@ -10518,6 +10518,18 @@ cygwin* | mingw* | pw32* | cegcc*)
>    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
>      library_names_spec='$libname.dll.a'
>      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> +    if test ${multilib} = yes; then
> +    postinstall_cmds='base_file=`basename \${file}`~
> +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> +      dldir=$destdir/`dirname \$dlpath`~
> +      $install_prog $dir/$dlname $destdir/$dlname~
> +      chmod a+x $destdir/$dlname~
> +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> +      fi'
> +    else
>      postinstall_cmds='base_file=`basename \${file}`~
>        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
>        dldir=$destdir/`dirname \$dlpath`~
> @@ -10527,6 +10539,7 @@ cygwin* | mingw* | pw32* | cegcc*)
>        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
>          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
>        fi'
> +    fi
>      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
>        dlpath=$dir/\$dldll~
>         $RM \$dlpath'
> diff --git a/libbacktrace/configure b/libbacktrace/configure
> index ab94a85f45c..644d523c3cb 100755
> --- a/libbacktrace/configure
> +++ b/libbacktrace/configure
> @@ -10696,6 +10696,18 @@ cygwin* | mingw* | pw32* | cegcc*)
>    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
>      library_names_spec='$libname.dll.a'
>      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> +    if test ${multilib} = yes; then
> +    postinstall_cmds='base_file=`basename \${file}`~
> +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> +      dldir=$destdir/`dirname \$dlpath`~
> +      $install_prog $dir/$dlname $destdir/$dlname~
> +      chmod a+x $destdir/$dlname~
> +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> +      fi'
> +    else
>      postinstall_cmds='base_file=`basename \${file}`~
>        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
>        dldir=$destdir/`dirname \$dlpath`~
> @@ -10705,6 +10717,7 @@ cygwin* | mingw* | pw32* | cegcc*)
>        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
>          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
>        fi'
> +    fi
>      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
>        dlpath=$dir/\$dldll~
>         $RM \$dlpath'
> diff --git a/libcc1/configure b/libcc1/configure
> index ea689a353c8..8233251c6e9 100755
> --- a/libcc1/configure
> +++ b/libcc1/configure
> @@ -9952,6 +9952,18 @@ cygwin* | mingw* | pw32* | cegcc*)
>    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
>      library_names_spec='$libname.dll.a'
>      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> +    if test ${multilib} = yes; then
> +    postinstall_cmds='base_file=`basename \${file}`~
> +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> +      dldir=$destdir/`dirname \$dlpath`~
> +      $install_prog $dir/$dlname $destdir/$dlname~
> +      chmod a+x $destdir/$dlname~
> +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> +      fi'
> +    else
>      postinstall_cmds='base_file=`basename \${file}`~
>        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
>        dldir=$destdir/`dirname \$dlpath`~
> @@ -9961,6 +9973,7 @@ cygwin* | mingw* | pw32* | cegcc*)
>        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
>          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
>        fi'
> +    fi
>      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
>        dlpath=$dir/\$dldll~
>         $RM \$dlpath'
> @@ -14086,6 +14099,18 @@ cygwin* | mingw* | pw32* | cegcc*)
>    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
>      library_names_spec='$libname.dll.a'
>      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> +    if test ${multilib} = yes; then
> +    postinstall_cmds='base_file=`basename \${file}`~
> +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> +      dldir=$destdir/`dirname \$dlpath`~
> +      $install_prog $dir/$dlname $destdir/$dlname~
> +      chmod a+x $destdir/$dlname~
> +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> +      fi'
> +    else
>      postinstall_cmds='base_file=`basename \${file}`~
>        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
>        dldir=$destdir/`dirname \$dlpath`~
> @@ -14095,6 +14120,7 @@ cygwin* | mingw* | pw32* | cegcc*)
>        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
>          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
>        fi'
> +    fi
>      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
>        dlpath=$dir/\$dldll~
>         $RM \$dlpath'
> diff --git a/libffi/configure b/libffi/configure
> index f82a45b13bc..d5c3717803c 100755
> --- a/libffi/configure
> +++ b/libffi/configure
> @@ -10750,6 +10750,18 @@ cygwin* | mingw* | pw32* | cegcc*)
>    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
>      library_names_spec='$libname.dll.a'
>      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> +    if test ${multilib} = yes; then
> +    postinstall_cmds='base_file=`basename \${file}`~
> +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> +      dldir=$destdir/`dirname \$dlpath`~
> +      $install_prog $dir/$dlname $destdir/$dlname~
> +      chmod a+x $destdir/$dlname~
> +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> +      fi'
> +    else
>      postinstall_cmds='base_file=`basename \${file}`~
>        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
>        dldir=$destdir/`dirname \$dlpath`~
> @@ -10759,6 +10771,7 @@ cygwin* | mingw* | pw32* | cegcc*)
>        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
>          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
>        fi'
> +    fi
>      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
>        dlpath=$dir/\$dldll~
>         $RM \$dlpath'
> @@ -14478,6 +14491,18 @@ cygwin* | mingw* | pw32* | cegcc*)
>    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
>      library_names_spec='$libname.dll.a'
>      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> +    if test ${multilib} = yes; then
> +    postinstall_cmds='base_file=`basename \${file}`~
> +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> +      dldir=$destdir/`dirname \$dlpath`~
> +      $install_prog $dir/$dlname $destdir/$dlname~
> +      chmod a+x $destdir/$dlname~
> +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> +      fi'
> +    else
>      postinstall_cmds='base_file=`basename \${file}`~
>        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
>        dldir=$destdir/`dirname \$dlpath`~
> @@ -14487,6 +14512,7 @@ cygwin* | mingw* | pw32* | cegcc*)
>        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
>          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
>        fi'
> +    fi
>      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
>        dlpath=$dir/\$dldll~
>         $RM \$dlpath'
> diff --git a/libgfortran/configure b/libgfortran/configure
> index 774dd52fc95..b092ee0a75d 100755
> --- a/libgfortran/configure
> +++ b/libgfortran/configure
> @@ -11896,6 +11896,18 @@ cygwin* | mingw* | pw32* | cegcc*)
>    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
>      library_names_spec='$libname.dll.a'
>      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> +    if test ${multilib} = yes; then
> +    postinstall_cmds='base_file=`basename \${file}`~
> +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> +      dldir=$destdir/`dirname \$dlpath`~
> +      $install_prog $dir/$dlname $destdir/$dlname~
> +      chmod a+x $destdir/$dlname~
> +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> +      fi'
> +    else
>      postinstall_cmds='base_file=`basename \${file}`~
>        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
>        dldir=$destdir/`dirname \$dlpath`~
> @@ -11905,6 +11917,7 @@ cygwin* | mingw* | pw32* | cegcc*)
>        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
>          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
>        fi'
> +    fi
>      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
>        dlpath=$dir/\$dldll~
>         $RM \$dlpath'
> @@ -15742,6 +15755,18 @@ cygwin* | mingw* | pw32* | cegcc*)
>    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
>      library_names_spec='$libname.dll.a'
>      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> +    if test ${multilib} = yes; then
> +    postinstall_cmds='base_file=`basename \${file}`~
> +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> +      dldir=$destdir/`dirname \$dlpath`~
> +      $install_prog $dir/$dlname $destdir/$dlname~
> +      chmod a+x $destdir/$dlname~
> +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> +      fi'
> +    else
>      postinstall_cmds='base_file=`basename \${file}`~
>        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
>        dldir=$destdir/`dirname \$dlpath`~
> @@ -15751,6 +15776,7 @@ cygwin* | mingw* | pw32* | cegcc*)
>        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
>          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
>        fi'
> +    fi
>      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
>        dlpath=$dir/\$dldll~
>         $RM \$dlpath'
> diff --git a/libgm2/configure b/libgm2/configure
> index 13861f0ff93..0b1471187ff 100755
> --- a/libgm2/configure
> +++ b/libgm2/configure
> @@ -13588,6 +13588,18 @@ cygwin* | mingw* | pw32* | cegcc*)
>    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
>      library_names_spec='$libname.dll.a'
>      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> +    if test ${multilib} = yes; then
> +    postinstall_cmds='base_file=`basename \${file}`~
> +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> +      dldir=$destdir/`dirname \$dlpath`~
> +      $install_prog $dir/$dlname $destdir/$dlname~
> +      chmod a+x $destdir/$dlname~
> +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> +      fi'
> +    else
>      postinstall_cmds='base_file=`basename \${file}`~
>        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
>        dldir=$destdir/`dirname \$dlpath`~
> @@ -13597,6 +13609,7 @@ cygwin* | mingw* | pw32* | cegcc*)
>        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
>          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
>        fi'
> +    fi
>      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
>        dlpath=$dir/\$dldll~
>         $RM \$dlpath'
> @@ -17340,6 +17353,18 @@ cygwin* | mingw* | pw32* | cegcc*)
>    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
>      library_names_spec='$libname.dll.a'
>      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> +    if test ${multilib} = yes; then
> +    postinstall_cmds='base_file=`basename \${file}`~
> +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> +      dldir=$destdir/`dirname \$dlpath`~
> +      $install_prog $dir/$dlname $destdir/$dlname~
> +      chmod a+x $destdir/$dlname~
> +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> +      fi'
> +    else
>      postinstall_cmds='base_file=`basename \${file}`~
>        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
>        dldir=$destdir/`dirname \$dlpath`~
> @@ -17349,6 +17374,7 @@ cygwin* | mingw* | pw32* | cegcc*)
>        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
>          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
>        fi'
> +    fi
>      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
>        dlpath=$dir/\$dldll~
>         $RM \$dlpath'
> diff --git a/libgo/config/libtool.m4 b/libgo/config/libtool.m4
> index 4ca90ee71bc..25436f1187c 100644
> --- a/libgo/config/libtool.m4
> +++ b/libgo/config/libtool.m4
> @@ -2219,6 +2219,18 @@ cygwin* | mingw* | pw32* | cegcc*)
>    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
>      library_names_spec='$libname.dll.a'
>      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> +    if test ${multilib} = yes; then
> +    postinstall_cmds='base_file=`basename \${file}`~
> +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> +      dldir=$destdir/`dirname \$dlpath`~
> +      $install_prog $dir/$dlname $destdir/$dlname~
> +      chmod a+x $destdir/$dlname~
> +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> +      fi'
> +    else
>      postinstall_cmds='base_file=`basename \${file}`~
>        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
>        dldir=$destdir/`dirname \$dlpath`~
> @@ -2228,6 +2240,7 @@ cygwin* | mingw* | pw32* | cegcc*)
>        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
>          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
>        fi'
> +    fi
>      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
>        dlpath=$dir/\$dldll~
>         $RM \$dlpath'
> diff --git a/libgo/configure b/libgo/configure
> index c0d0a1560f5..d39bb637c5f 100755
> --- a/libgo/configure
> +++ b/libgo/configure
> @@ -10633,6 +10633,18 @@ cygwin* | mingw* | pw32* | cegcc*)
>    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
>      library_names_spec='$libname.dll.a'
>      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> +    if test ${multilib} = yes; then
> +    postinstall_cmds='base_file=`basename \${file}`~
> +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> +      dldir=$destdir/`dirname \$dlpath`~
> +      $install_prog $dir/$dlname $destdir/$dlname~
> +      chmod a+x $destdir/$dlname~
> +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> +      fi'
> +    else
>      postinstall_cmds='base_file=`basename \${file}`~
>        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
>        dldir=$destdir/`dirname \$dlpath`~
> @@ -10642,6 +10654,7 @@ cygwin* | mingw* | pw32* | cegcc*)
>        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
>          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
>        fi'
> +    fi
>      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
>        dlpath=$dir/\$dldll~
>         $RM \$dlpath'
> diff --git a/libgomp/configure b/libgomp/configure
> index ad245b47dff..22f879046a5 100755
> --- a/libgomp/configure
> +++ b/libgomp/configure
> @@ -10531,6 +10531,18 @@ cygwin* | mingw* | pw32* | cegcc*)
>    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
>      library_names_spec='$libname.dll.a'
>      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> +    if test ${multilib} = yes; then
> +    postinstall_cmds='base_file=`basename \${file}`~
> +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> +      dldir=$destdir/`dirname \$dlpath`~
> +      $install_prog $dir/$dlname $destdir/$dlname~
> +      chmod a+x $destdir/$dlname~
> +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> +      fi'
> +    else
>      postinstall_cmds='base_file=`basename \${file}`~
>        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
>        dldir=$destdir/`dirname \$dlpath`~
> @@ -10540,6 +10552,7 @@ cygwin* | mingw* | pw32* | cegcc*)
>        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
>          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
>        fi'
> +    fi
>      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
>        dlpath=$dir/\$dldll~
>         $RM \$dlpath'
> @@ -14247,6 +14260,18 @@ cygwin* | mingw* | pw32* | cegcc*)
>    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
>      library_names_spec='$libname.dll.a'
>      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> +    if test ${multilib} = yes; then
> +    postinstall_cmds='base_file=`basename \${file}`~
> +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> +      dldir=$destdir/`dirname \$dlpath`~
> +      $install_prog $dir/$dlname $destdir/$dlname~
> +      chmod a+x $destdir/$dlname~
> +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> +      fi'
> +    else
>      postinstall_cmds='base_file=`basename \${file}`~
>        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
>        dldir=$destdir/`dirname \$dlpath`~
> @@ -14256,6 +14281,7 @@ cygwin* | mingw* | pw32* | cegcc*)
>        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
>          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
>        fi'
> +    fi
>      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
>        dlpath=$dir/\$dldll~
>         $RM \$dlpath'
> diff --git a/libgrust/configure b/libgrust/configure
> index dcdc3142fa2..7abc1a8b13a 100755
> --- a/libgrust/configure
> +++ b/libgrust/configure
> @@ -11699,6 +11699,18 @@ cygwin* | mingw* | pw32* | cegcc*)
>    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
>      library_names_spec='$libname.dll.a'
>      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> +    if test ${multilib} = yes; then
> +    postinstall_cmds='base_file=`basename \${file}`~
> +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> +      dldir=$destdir/`dirname \$dlpath`~
> +      $install_prog $dir/$dlname $destdir/$dlname~
> +      chmod a+x $destdir/$dlname~
> +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> +      fi'
> +    else
>      postinstall_cmds='base_file=`basename \${file}`~
>        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
>        dldir=$destdir/`dirname \$dlpath`~
> @@ -11708,6 +11720,7 @@ cygwin* | mingw* | pw32* | cegcc*)
>        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
>          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
>        fi'
> +    fi
>      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
>        dlpath=$dir/\$dldll~
>         $RM \$dlpath'
> @@ -15451,6 +15464,18 @@ cygwin* | mingw* | pw32* | cegcc*)
>    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
>      library_names_spec='$libname.dll.a'
>      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> +    if test ${multilib} = yes; then
> +    postinstall_cmds='base_file=`basename \${file}`~
> +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> +      dldir=$destdir/`dirname \$dlpath`~
> +      $install_prog $dir/$dlname $destdir/$dlname~
> +      chmod a+x $destdir/$dlname~
> +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> +      fi'
> +    else
>      postinstall_cmds='base_file=`basename \${file}`~
>        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
>        dldir=$destdir/`dirname \$dlpath`~
> @@ -15460,6 +15485,7 @@ cygwin* | mingw* | pw32* | cegcc*)
>        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
>          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
>        fi'
> +    fi
>      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
>        dlpath=$dir/\$dldll~
>         $RM \$dlpath'
> diff --git a/libitm/configure b/libitm/configure
> index 9ba7fb03a57..31db9015c18 100755
> --- a/libitm/configure
> +++ b/libitm/configure
> @@ -11193,6 +11193,18 @@ cygwin* | mingw* | pw32* | cegcc*)
>    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
>      library_names_spec='$libname.dll.a'
>      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> +    if test ${multilib} = yes; then
> +    postinstall_cmds='base_file=`basename \${file}`~
> +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> +      dldir=$destdir/`dirname \$dlpath`~
> +      $install_prog $dir/$dlname $destdir/$dlname~
> +      chmod a+x $destdir/$dlname~
> +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> +      fi'
> +    else
>      postinstall_cmds='base_file=`basename \${file}`~
>        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
>        dldir=$destdir/`dirname \$dlpath`~
> @@ -11202,6 +11214,7 @@ cygwin* | mingw* | pw32* | cegcc*)
>        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
>          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
>        fi'
> +    fi
>      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
>        dlpath=$dir/\$dldll~
>         $RM \$dlpath'
> @@ -14921,6 +14934,18 @@ cygwin* | mingw* | pw32* | cegcc*)
>    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
>      library_names_spec='$libname.dll.a'
>      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> +    if test ${multilib} = yes; then
> +    postinstall_cmds='base_file=`basename \${file}`~
> +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> +      dldir=$destdir/`dirname \$dlpath`~
> +      $install_prog $dir/$dlname $destdir/$dlname~
> +      chmod a+x $destdir/$dlname~
> +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> +      fi'
> +    else
>      postinstall_cmds='base_file=`basename \${file}`~
>        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
>        dldir=$destdir/`dirname \$dlpath`~
> @@ -14930,6 +14955,7 @@ cygwin* | mingw* | pw32* | cegcc*)
>        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
>          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
>        fi'
> +    fi
>      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
>        dlpath=$dir/\$dldll~
>         $RM \$dlpath'
> diff --git a/libobjc/configure b/libobjc/configure
> index 68172549137..32160f9a547 100755
> --- a/libobjc/configure
> +++ b/libobjc/configure
> @@ -9920,6 +9920,18 @@ cygwin* | mingw* | pw32* | cegcc*)
>    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
>      library_names_spec='$libname.dll.a'
>      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> +    if test ${multilib} = yes; then
> +    postinstall_cmds='base_file=`basename \${file}`~
> +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> +      dldir=$destdir/`dirname \$dlpath`~
> +      $install_prog $dir/$dlname $destdir/$dlname~
> +      chmod a+x $destdir/$dlname~
> +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> +      fi'
> +    else
>      postinstall_cmds='base_file=`basename \${file}`~
>        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
>        dldir=$destdir/`dirname \$dlpath`~
> @@ -9929,6 +9941,7 @@ cygwin* | mingw* | pw32* | cegcc*)
>        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
>          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
>        fi'
> +    fi
>      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
>        dlpath=$dir/\$dldll~
>         $RM \$dlpath'
> diff --git a/libphobos/configure b/libphobos/configure
> index 9b6a41879d3..0d9a877455d 100755
> --- a/libphobos/configure
> +++ b/libphobos/configure
> @@ -10929,6 +10929,18 @@ cygwin* | mingw* | pw32* | cegcc*)
>    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
>      library_names_spec='$libname.dll.a'
>      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> +    if test ${multilib} = yes; then
> +    postinstall_cmds='base_file=`basename \${file}`~
> +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> +      dldir=$destdir/`dirname \$dlpath`~
> +      $install_prog $dir/$dlname $destdir/$dlname~
> +      chmod a+x $destdir/$dlname~
> +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> +      fi'
> +    else
>      postinstall_cmds='base_file=`basename \${file}`~
>        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
>        dldir=$destdir/`dirname \$dlpath`~
> @@ -10938,6 +10950,7 @@ cygwin* | mingw* | pw32* | cegcc*)
>        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
>          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
>        fi'
> +    fi
>      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
>        dlpath=$dir/\$dldll~
>         $RM \$dlpath'
> diff --git a/libquadmath/configure b/libquadmath/configure
> index 49d70809218..2882c1f30c2 100755
> --- a/libquadmath/configure
> +++ b/libquadmath/configure
> @@ -9966,6 +9966,18 @@ cygwin* | mingw* | pw32* | cegcc*)
>    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
>      library_names_spec='$libname.dll.a'
>      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> +    if test ${multilib} = yes; then
> +    postinstall_cmds='base_file=`basename \${file}`~
> +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> +      dldir=$destdir/`dirname \$dlpath`~
> +      $install_prog $dir/$dlname $destdir/$dlname~
> +      chmod a+x $destdir/$dlname~
> +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> +      fi'
> +    else
>      postinstall_cmds='base_file=`basename \${file}`~
>        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
>        dldir=$destdir/`dirname \$dlpath`~
> @@ -9975,6 +9987,7 @@ cygwin* | mingw* | pw32* | cegcc*)
>        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
>          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
>        fi'
> +    fi
>      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
>        dlpath=$dir/\$dldll~
>         $RM \$dlpath'
> diff --git a/libsanitizer/configure b/libsanitizer/configure
> index 6bfd28916d2..56b217d123a 100755
> --- a/libsanitizer/configure
> +++ b/libsanitizer/configure
> @@ -11537,6 +11537,18 @@ cygwin* | mingw* | pw32* | cegcc*)
>    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
>      library_names_spec='$libname.dll.a'
>      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> +    if test ${multilib} = yes; then
> +    postinstall_cmds='base_file=`basename \${file}`~
> +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> +      dldir=$destdir/`dirname \$dlpath`~
> +      $install_prog $dir/$dlname $destdir/$dlname~
> +      chmod a+x $destdir/$dlname~
> +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> +      fi'
> +    else
>      postinstall_cmds='base_file=`basename \${file}`~
>        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
>        dldir=$destdir/`dirname \$dlpath`~
> @@ -11546,6 +11558,7 @@ cygwin* | mingw* | pw32* | cegcc*)
>        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
>          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
>        fi'
> +    fi
>      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
>        dlpath=$dir/\$dldll~
>         $RM \$dlpath'
> @@ -15265,6 +15278,18 @@ cygwin* | mingw* | pw32* | cegcc*)
>    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
>      library_names_spec='$libname.dll.a'
>      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> +    if test ${multilib} = yes; then
> +    postinstall_cmds='base_file=`basename \${file}`~
> +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> +      dldir=$destdir/`dirname \$dlpath`~
> +      $install_prog $dir/$dlname $destdir/$dlname~
> +      chmod a+x $destdir/$dlname~
> +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> +      fi'
> +    else
>      postinstall_cmds='base_file=`basename \${file}`~
>        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
>        dldir=$destdir/`dirname \$dlpath`~
> @@ -15274,6 +15299,7 @@ cygwin* | mingw* | pw32* | cegcc*)
>        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
>          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
>        fi'
> +    fi
>      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
>        dlpath=$dir/\$dldll~
>         $RM \$dlpath'
> diff --git a/libssp/configure b/libssp/configure
> index 0052e03650d..e8560a861f7 100755
> --- a/libssp/configure
> +++ b/libssp/configure
> @@ -10208,6 +10208,18 @@ cygwin* | mingw* | pw32* | cegcc*)
>    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
>      library_names_spec='$libname.dll.a'
>      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> +    if test ${multilib} = yes; then
> +    postinstall_cmds='base_file=`basename \${file}`~
> +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> +      dldir=$destdir/`dirname \$dlpath`~
> +      $install_prog $dir/$dlname $destdir/$dlname~
> +      chmod a+x $destdir/$dlname~
> +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> +      fi'
> +    else
>      postinstall_cmds='base_file=`basename \${file}`~
>        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
>        dldir=$destdir/`dirname \$dlpath`~
> @@ -10217,6 +10229,7 @@ cygwin* | mingw* | pw32* | cegcc*)
>        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
>          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
>        fi'
> +    fi
>      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
>        dlpath=$dir/\$dldll~
>         $RM \$dlpath'
> diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
> index 21abaeb0778..df7f77751ea 100755
> --- a/libstdc++-v3/configure
> +++ b/libstdc++-v3/configure
> @@ -11324,6 +11324,18 @@ cygwin* | mingw* | pw32* | cegcc*)
>    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
>      library_names_spec='$libname.dll.a'
>      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> +    if test ${multilib} = yes; then
> +    postinstall_cmds='base_file=`basename \${file}`~
> +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> +      dldir=$destdir/`dirname \$dlpath`~
> +      $install_prog $dir/$dlname $destdir/$dlname~
> +      chmod a+x $destdir/$dlname~
> +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> +      fi'
> +    else
>      postinstall_cmds='base_file=`basename \${file}`~
>        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
>        dldir=$destdir/`dirname \$dlpath`~
> @@ -11333,6 +11345,7 @@ cygwin* | mingw* | pw32* | cegcc*)
>        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
>          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
>        fi'
> +    fi
>      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
>        dlpath=$dir/\$dldll~
>         $RM \$dlpath'
> @@ -15076,6 +15089,18 @@ cygwin* | mingw* | pw32* | cegcc*)
>    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
>      library_names_spec='$libname.dll.a'
>      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> +    if test ${multilib} = yes; then
> +    postinstall_cmds='base_file=`basename \${file}`~
> +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> +      dldir=$destdir/`dirname \$dlpath`~
> +      $install_prog $dir/$dlname $destdir/$dlname~
> +      chmod a+x $destdir/$dlname~
> +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> +      fi'
> +    else
>      postinstall_cmds='base_file=`basename \${file}`~
>        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
>        dldir=$destdir/`dirname \$dlpath`~
> @@ -15085,6 +15110,7 @@ cygwin* | mingw* | pw32* | cegcc*)
>        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
>          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
>        fi'
> +    fi
>      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
>        dlpath=$dir/\$dldll~
>         $RM \$dlpath'
> diff --git a/libtool.m4 b/libtool.m4
> index add2d4a1e23..0e1006f18db 100644
> --- a/libtool.m4
> +++ b/libtool.m4
> @@ -2293,6 +2293,18 @@ cygwin* | mingw* | pw32* | cegcc*)
>    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
>      library_names_spec='$libname.dll.a'
>      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> +    if test ${multilib} = yes; then
> +    postinstall_cmds='base_file=`basename \${file}`~
> +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> +      dldir=$destdir/`dirname \$dlpath`~
> +      $install_prog $dir/$dlname $destdir/$dlname~
> +      chmod a+x $destdir/$dlname~
> +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> +      fi'
> +    else
>      postinstall_cmds='base_file=`basename \${file}`~
>        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
>        dldir=$destdir/`dirname \$dlpath`~
> @@ -2302,6 +2314,7 @@ cygwin* | mingw* | pw32* | cegcc*)
>        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
>          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
>        fi'
> +    fi
>      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
>        dlpath=$dir/\$dldll~
>         $RM \$dlpath'
> diff --git a/libvtv/configure b/libvtv/configure
> index a7889161c50..64d904757c9 100755
> --- a/libvtv/configure
> +++ b/libvtv/configure
> @@ -11431,6 +11431,18 @@ cygwin* | mingw* | pw32* | cegcc*)
>    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
>      library_names_spec='$libname.dll.a'
>      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> +    if test ${multilib} = yes; then
> +    postinstall_cmds='base_file=`basename \${file}`~
> +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> +      dldir=$destdir/`dirname \$dlpath`~
> +      $install_prog $dir/$dlname $destdir/$dlname~
> +      chmod a+x $destdir/$dlname~
> +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> +      fi'
> +    else
>      postinstall_cmds='base_file=`basename \${file}`~
>        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
>        dldir=$destdir/`dirname \$dlpath`~
> @@ -11440,6 +11452,7 @@ cygwin* | mingw* | pw32* | cegcc*)
>        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
>          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
>        fi'
> +    fi
>      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
>        dlpath=$dir/\$dldll~
>         $RM \$dlpath'
> @@ -15159,6 +15172,18 @@ cygwin* | mingw* | pw32* | cegcc*)
>    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
>      library_names_spec='$libname.dll.a'
>      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> +    if test ${multilib} = yes; then
> +    postinstall_cmds='base_file=`basename \${file}`~
> +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> +      dldir=$destdir/`dirname \$dlpath`~
> +      $install_prog $dir/$dlname $destdir/$dlname~
> +      chmod a+x $destdir/$dlname~
> +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> +      fi'
> +    else
>      postinstall_cmds='base_file=`basename \${file}`~
>        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
>        dldir=$destdir/`dirname \$dlpath`~
> @@ -15168,6 +15193,7 @@ cygwin* | mingw* | pw32* | cegcc*)
>        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
>          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
>        fi'
> +    fi
>      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
>        dlpath=$dir/\$dldll~
>         $RM \$dlpath'
> diff --git a/lto-plugin/configure b/lto-plugin/configure
> index 28f5dd79cd7..56d4915673b 100755
> --- a/lto-plugin/configure
> +++ b/lto-plugin/configure
> @@ -11303,6 +11303,18 @@ cygwin* | mingw* | pw32* | cegcc*)
>    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
>      library_names_spec='$libname.dll.a'
>      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> +    if test ${multilib} = yes; then
> +    postinstall_cmds='base_file=`basename \${file}`~
> +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> +      dldir=$destdir/`dirname \$dlpath`~
> +      $install_prog $dir/$dlname $destdir/$dlname~
> +      chmod a+x $destdir/$dlname~
> +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> +      fi'
> +    else
>      postinstall_cmds='base_file=`basename \${file}`~
>        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
>        dldir=$destdir/`dirname \$dlpath`~
> @@ -11312,6 +11324,7 @@ cygwin* | mingw* | pw32* | cegcc*)
>        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
>          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
>        fi'
> +    fi
>      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
>        dlpath=$dir/\$dldll~
>         $RM \$dlpath'
> diff --git a/zlib/configure b/zlib/configure
> index 92c462d04c6..ba3ad8101d6 100755
> --- a/zlib/configure
> +++ b/zlib/configure
> @@ -9898,6 +9898,18 @@ cygwin* | mingw* | pw32* | cegcc*)
>    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
>      library_names_spec='$libname.dll.a'
>      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> +    if test ${multilib} = yes; then
> +    postinstall_cmds='base_file=`basename \${file}`~
> +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> +      dldir=$destdir/`dirname \$dlpath`~
> +      $install_prog $dir/$dlname $destdir/$dlname~
> +      chmod a+x $destdir/$dlname~
> +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> +      fi'
> +    else
>      postinstall_cmds='base_file=`basename \${file}`~
>        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
>        dldir=$destdir/`dirname \$dlpath`~
> @@ -9907,6 +9919,7 @@ cygwin* | mingw* | pw32* | cegcc*)
>        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
>          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
>        fi'
> +    fi
>      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
>        dlpath=$dir/\$dldll~
>         $RM \$dlpath'
> --
> 2.34.1
>
unlvsur unlvsur May 15, 2024, 9:02 a.m. UTC | #2
Hi. Richard. I checked configure.ac and it is not in configure.ac. It is in the libtool.m4. The code was generated from libtool.m4 so it is correct.
Richard Biener May 15, 2024, 9:28 a.m. UTC | #3
On Wed, May 15, 2024 at 11:02 AM unlvsur unlvsur <unlvsur@live.com> wrote:
>
> Hi. Richard. I checked configure.ac and it is not in configure.ac. It is in the libtool.m4. The code was generated from libtool.m4 so it is correct.

Ah, sorry - the libtool.m4 change escaped me ...

It's been some time since we updated libtool, is this fixed in libtool
upstream in the
same way?  You are missing a ChangeLog entry which should indicate which
files were just re-generated and which ones you edited (and what part).

Richard.

> ________________________________
> From: Richard Biener <richard.guenther@gmail.com>
> Sent: Wednesday, May 15, 2024 3:46
> To: trcrsired <unlvsur@live.com>
> Cc: gcc-patches@gcc.gnu.org <gcc-patches@gcc.gnu.org>; trcrsired <uwgghhbcad@gmail.com>
> Subject: Re: [PATCH] [PATCH] Correct DLL Installation Path for x86_64-w64-mingw32 Multilib [PR115094]
>
> On Tue, May 14, 2024 at 10:27 PM trcrsired <unlvsur@live.com> wrote:
> >
> > From: trcrsired <uwgghhbcad@gmail.com>
> >
> > When building native GCC for the x86_64-w64-mingw32 host, the compiler copies its library DLLs to the `bin` directory. However, in the case of a multilib configuration, both 32-bit and 64-bit libraries end up in the same `bin` directory, leading to conflicts where 64-bit DLLs are overridden by their 32-bit counterparts.
> >
> > This patch addresses the issue by adjusting the installation path for the libraries. Specifically, it installs the libraries to separate directories: `lib` for 64-bit and `lib32` for 32-bit. This behavior aligns with how libraries are installed when creating an x86_64-w64-mingw32 cross-compiler without copying them to the `bin` directory if it is a multilib build.
>
> You need to patch configure.ac, not only the generated files.
>
> > ---
> >  gcc/configure           | 26 ++++++++++++++++++++++++++
> >  libatomic/configure     | 13 +++++++++++++
> >  libbacktrace/configure  | 13 +++++++++++++
> >  libcc1/configure        | 26 ++++++++++++++++++++++++++
> >  libffi/configure        | 26 ++++++++++++++++++++++++++
> >  libgfortran/configure   | 26 ++++++++++++++++++++++++++
> >  libgm2/configure        | 26 ++++++++++++++++++++++++++
> >  libgo/config/libtool.m4 | 13 +++++++++++++
> >  libgo/configure         | 13 +++++++++++++
> >  libgomp/configure       | 26 ++++++++++++++++++++++++++
> >  libgrust/configure      | 26 ++++++++++++++++++++++++++
> >  libitm/configure        | 26 ++++++++++++++++++++++++++
> >  libobjc/configure       | 13 +++++++++++++
> >  libphobos/configure     | 13 +++++++++++++
> >  libquadmath/configure   | 13 +++++++++++++
> >  libsanitizer/configure  | 26 ++++++++++++++++++++++++++
> >  libssp/configure        | 13 +++++++++++++
> >  libstdc++-v3/configure  | 26 ++++++++++++++++++++++++++
> >  libtool.m4              | 13 +++++++++++++
> >  libvtv/configure        | 26 ++++++++++++++++++++++++++
> >  lto-plugin/configure    | 13 +++++++++++++
> >  zlib/configure          | 13 +++++++++++++
> >  22 files changed, 429 insertions(+)
> >
> > diff --git a/gcc/configure b/gcc/configure
> > index aaf5899cc03..beab6df1878 100755
> > --- a/gcc/configure
> > +++ b/gcc/configure
> > @@ -20472,6 +20472,18 @@ cygwin* | mingw* | pw32* | cegcc*)
> >    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
> >      library_names_spec='$libname.dll.a'
> >      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> > +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> > +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> > +    if test ${multilib} = yes; then
> > +    postinstall_cmds='base_file=`basename \${file}`~
> > +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > +      dldir=$destdir/`dirname \$dlpath`~
> > +      $install_prog $dir/$dlname $destdir/$dlname~
> > +      chmod a+x $destdir/$dlname~
> > +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> > +      fi'
> > +    else
> >      postinstall_cmds='base_file=`basename \${file}`~
> >        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> >        dldir=$destdir/`dirname \$dlpath`~
> > @@ -20481,6 +20493,7 @@ cygwin* | mingw* | pw32* | cegcc*)
> >        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> >          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
> >        fi'
> > +    fi
> >      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
> >        dlpath=$dir/\$dldll~
> >         $RM \$dlpath'
> > @@ -24200,6 +24213,18 @@ cygwin* | mingw* | pw32* | cegcc*)
> >    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
> >      library_names_spec='$libname.dll.a'
> >      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> > +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> > +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> > +    if test ${multilib} = yes; then
> > +    postinstall_cmds='base_file=`basename \${file}`~
> > +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > +      dldir=$destdir/`dirname \$dlpath`~
> > +      $install_prog $dir/$dlname $destdir/$dlname~
> > +      chmod a+x $destdir/$dlname~
> > +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> > +      fi'
> > +    else
> >      postinstall_cmds='base_file=`basename \${file}`~
> >        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> >        dldir=$destdir/`dirname \$dlpath`~
> > @@ -24209,6 +24234,7 @@ cygwin* | mingw* | pw32* | cegcc*)
> >        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> >          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
> >        fi'
> > +    fi
> >      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
> >        dlpath=$dir/\$dldll~
> >         $RM \$dlpath'
> > diff --git a/libatomic/configure b/libatomic/configure
> > index 32cb3ecac26..cb17a863719 100755
> > --- a/libatomic/configure
> > +++ b/libatomic/configure
> > @@ -10518,6 +10518,18 @@ cygwin* | mingw* | pw32* | cegcc*)
> >    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
> >      library_names_spec='$libname.dll.a'
> >      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> > +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> > +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> > +    if test ${multilib} = yes; then
> > +    postinstall_cmds='base_file=`basename \${file}`~
> > +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > +      dldir=$destdir/`dirname \$dlpath`~
> > +      $install_prog $dir/$dlname $destdir/$dlname~
> > +      chmod a+x $destdir/$dlname~
> > +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> > +      fi'
> > +    else
> >      postinstall_cmds='base_file=`basename \${file}`~
> >        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> >        dldir=$destdir/`dirname \$dlpath`~
> > @@ -10527,6 +10539,7 @@ cygwin* | mingw* | pw32* | cegcc*)
> >        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> >          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
> >        fi'
> > +    fi
> >      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
> >        dlpath=$dir/\$dldll~
> >         $RM \$dlpath'
> > diff --git a/libbacktrace/configure b/libbacktrace/configure
> > index ab94a85f45c..644d523c3cb 100755
> > --- a/libbacktrace/configure
> > +++ b/libbacktrace/configure
> > @@ -10696,6 +10696,18 @@ cygwin* | mingw* | pw32* | cegcc*)
> >    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
> >      library_names_spec='$libname.dll.a'
> >      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> > +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> > +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> > +    if test ${multilib} = yes; then
> > +    postinstall_cmds='base_file=`basename \${file}`~
> > +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > +      dldir=$destdir/`dirname \$dlpath`~
> > +      $install_prog $dir/$dlname $destdir/$dlname~
> > +      chmod a+x $destdir/$dlname~
> > +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> > +      fi'
> > +    else
> >      postinstall_cmds='base_file=`basename \${file}`~
> >        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> >        dldir=$destdir/`dirname \$dlpath`~
> > @@ -10705,6 +10717,7 @@ cygwin* | mingw* | pw32* | cegcc*)
> >        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> >          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
> >        fi'
> > +    fi
> >      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
> >        dlpath=$dir/\$dldll~
> >         $RM \$dlpath'
> > diff --git a/libcc1/configure b/libcc1/configure
> > index ea689a353c8..8233251c6e9 100755
> > --- a/libcc1/configure
> > +++ b/libcc1/configure
> > @@ -9952,6 +9952,18 @@ cygwin* | mingw* | pw32* | cegcc*)
> >    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
> >      library_names_spec='$libname.dll.a'
> >      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> > +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> > +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> > +    if test ${multilib} = yes; then
> > +    postinstall_cmds='base_file=`basename \${file}`~
> > +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > +      dldir=$destdir/`dirname \$dlpath`~
> > +      $install_prog $dir/$dlname $destdir/$dlname~
> > +      chmod a+x $destdir/$dlname~
> > +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> > +      fi'
> > +    else
> >      postinstall_cmds='base_file=`basename \${file}`~
> >        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> >        dldir=$destdir/`dirname \$dlpath`~
> > @@ -9961,6 +9973,7 @@ cygwin* | mingw* | pw32* | cegcc*)
> >        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> >          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
> >        fi'
> > +    fi
> >      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
> >        dlpath=$dir/\$dldll~
> >         $RM \$dlpath'
> > @@ -14086,6 +14099,18 @@ cygwin* | mingw* | pw32* | cegcc*)
> >    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
> >      library_names_spec='$libname.dll.a'
> >      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> > +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> > +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> > +    if test ${multilib} = yes; then
> > +    postinstall_cmds='base_file=`basename \${file}`~
> > +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > +      dldir=$destdir/`dirname \$dlpath`~
> > +      $install_prog $dir/$dlname $destdir/$dlname~
> > +      chmod a+x $destdir/$dlname~
> > +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> > +      fi'
> > +    else
> >      postinstall_cmds='base_file=`basename \${file}`~
> >        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> >        dldir=$destdir/`dirname \$dlpath`~
> > @@ -14095,6 +14120,7 @@ cygwin* | mingw* | pw32* | cegcc*)
> >        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> >          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
> >        fi'
> > +    fi
> >      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
> >        dlpath=$dir/\$dldll~
> >         $RM \$dlpath'
> > diff --git a/libffi/configure b/libffi/configure
> > index f82a45b13bc..d5c3717803c 100755
> > --- a/libffi/configure
> > +++ b/libffi/configure
> > @@ -10750,6 +10750,18 @@ cygwin* | mingw* | pw32* | cegcc*)
> >    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
> >      library_names_spec='$libname.dll.a'
> >      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> > +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> > +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> > +    if test ${multilib} = yes; then
> > +    postinstall_cmds='base_file=`basename \${file}`~
> > +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > +      dldir=$destdir/`dirname \$dlpath`~
> > +      $install_prog $dir/$dlname $destdir/$dlname~
> > +      chmod a+x $destdir/$dlname~
> > +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> > +      fi'
> > +    else
> >      postinstall_cmds='base_file=`basename \${file}`~
> >        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> >        dldir=$destdir/`dirname \$dlpath`~
> > @@ -10759,6 +10771,7 @@ cygwin* | mingw* | pw32* | cegcc*)
> >        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> >          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
> >        fi'
> > +    fi
> >      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
> >        dlpath=$dir/\$dldll~
> >         $RM \$dlpath'
> > @@ -14478,6 +14491,18 @@ cygwin* | mingw* | pw32* | cegcc*)
> >    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
> >      library_names_spec='$libname.dll.a'
> >      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> > +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> > +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> > +    if test ${multilib} = yes; then
> > +    postinstall_cmds='base_file=`basename \${file}`~
> > +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > +      dldir=$destdir/`dirname \$dlpath`~
> > +      $install_prog $dir/$dlname $destdir/$dlname~
> > +      chmod a+x $destdir/$dlname~
> > +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> > +      fi'
> > +    else
> >      postinstall_cmds='base_file=`basename \${file}`~
> >        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> >        dldir=$destdir/`dirname \$dlpath`~
> > @@ -14487,6 +14512,7 @@ cygwin* | mingw* | pw32* | cegcc*)
> >        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> >          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
> >        fi'
> > +    fi
> >      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
> >        dlpath=$dir/\$dldll~
> >         $RM \$dlpath'
> > diff --git a/libgfortran/configure b/libgfortran/configure
> > index 774dd52fc95..b092ee0a75d 100755
> > --- a/libgfortran/configure
> > +++ b/libgfortran/configure
> > @@ -11896,6 +11896,18 @@ cygwin* | mingw* | pw32* | cegcc*)
> >    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
> >      library_names_spec='$libname.dll.a'
> >      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> > +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> > +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> > +    if test ${multilib} = yes; then
> > +    postinstall_cmds='base_file=`basename \${file}`~
> > +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > +      dldir=$destdir/`dirname \$dlpath`~
> > +      $install_prog $dir/$dlname $destdir/$dlname~
> > +      chmod a+x $destdir/$dlname~
> > +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> > +      fi'
> > +    else
> >      postinstall_cmds='base_file=`basename \${file}`~
> >        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> >        dldir=$destdir/`dirname \$dlpath`~
> > @@ -11905,6 +11917,7 @@ cygwin* | mingw* | pw32* | cegcc*)
> >        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> >          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
> >        fi'
> > +    fi
> >      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
> >        dlpath=$dir/\$dldll~
> >         $RM \$dlpath'
> > @@ -15742,6 +15755,18 @@ cygwin* | mingw* | pw32* | cegcc*)
> >    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
> >      library_names_spec='$libname.dll.a'
> >      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> > +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> > +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> > +    if test ${multilib} = yes; then
> > +    postinstall_cmds='base_file=`basename \${file}`~
> > +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > +      dldir=$destdir/`dirname \$dlpath`~
> > +      $install_prog $dir/$dlname $destdir/$dlname~
> > +      chmod a+x $destdir/$dlname~
> > +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> > +      fi'
> > +    else
> >      postinstall_cmds='base_file=`basename \${file}`~
> >        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> >        dldir=$destdir/`dirname \$dlpath`~
> > @@ -15751,6 +15776,7 @@ cygwin* | mingw* | pw32* | cegcc*)
> >        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> >          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
> >        fi'
> > +    fi
> >      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
> >        dlpath=$dir/\$dldll~
> >         $RM \$dlpath'
> > diff --git a/libgm2/configure b/libgm2/configure
> > index 13861f0ff93..0b1471187ff 100755
> > --- a/libgm2/configure
> > +++ b/libgm2/configure
> > @@ -13588,6 +13588,18 @@ cygwin* | mingw* | pw32* | cegcc*)
> >    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
> >      library_names_spec='$libname.dll.a'
> >      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> > +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> > +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> > +    if test ${multilib} = yes; then
> > +    postinstall_cmds='base_file=`basename \${file}`~
> > +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > +      dldir=$destdir/`dirname \$dlpath`~
> > +      $install_prog $dir/$dlname $destdir/$dlname~
> > +      chmod a+x $destdir/$dlname~
> > +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> > +      fi'
> > +    else
> >      postinstall_cmds='base_file=`basename \${file}`~
> >        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> >        dldir=$destdir/`dirname \$dlpath`~
> > @@ -13597,6 +13609,7 @@ cygwin* | mingw* | pw32* | cegcc*)
> >        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> >          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
> >        fi'
> > +    fi
> >      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
> >        dlpath=$dir/\$dldll~
> >         $RM \$dlpath'
> > @@ -17340,6 +17353,18 @@ cygwin* | mingw* | pw32* | cegcc*)
> >    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
> >      library_names_spec='$libname.dll.a'
> >      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> > +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> > +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> > +    if test ${multilib} = yes; then
> > +    postinstall_cmds='base_file=`basename \${file}`~
> > +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > +      dldir=$destdir/`dirname \$dlpath`~
> > +      $install_prog $dir/$dlname $destdir/$dlname~
> > +      chmod a+x $destdir/$dlname~
> > +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> > +      fi'
> > +    else
> >      postinstall_cmds='base_file=`basename \${file}`~
> >        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> >        dldir=$destdir/`dirname \$dlpath`~
> > @@ -17349,6 +17374,7 @@ cygwin* | mingw* | pw32* | cegcc*)
> >        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> >          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
> >        fi'
> > +    fi
> >      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
> >        dlpath=$dir/\$dldll~
> >         $RM \$dlpath'
> > diff --git a/libgo/config/libtool.m4 b/libgo/config/libtool.m4
> > index 4ca90ee71bc..25436f1187c 100644
> > --- a/libgo/config/libtool.m4
> > +++ b/libgo/config/libtool.m4
> > @@ -2219,6 +2219,18 @@ cygwin* | mingw* | pw32* | cegcc*)
> >    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
> >      library_names_spec='$libname.dll.a'
> >      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> > +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> > +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> > +    if test ${multilib} = yes; then
> > +    postinstall_cmds='base_file=`basename \${file}`~
> > +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > +      dldir=$destdir/`dirname \$dlpath`~
> > +      $install_prog $dir/$dlname $destdir/$dlname~
> > +      chmod a+x $destdir/$dlname~
> > +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> > +      fi'
> > +    else
> >      postinstall_cmds='base_file=`basename \${file}`~
> >        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> >        dldir=$destdir/`dirname \$dlpath`~
> > @@ -2228,6 +2240,7 @@ cygwin* | mingw* | pw32* | cegcc*)
> >        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> >          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
> >        fi'
> > +    fi
> >      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
> >        dlpath=$dir/\$dldll~
> >         $RM \$dlpath'
> > diff --git a/libgo/configure b/libgo/configure
> > index c0d0a1560f5..d39bb637c5f 100755
> > --- a/libgo/configure
> > +++ b/libgo/configure
> > @@ -10633,6 +10633,18 @@ cygwin* | mingw* | pw32* | cegcc*)
> >    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
> >      library_names_spec='$libname.dll.a'
> >      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> > +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> > +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> > +    if test ${multilib} = yes; then
> > +    postinstall_cmds='base_file=`basename \${file}`~
> > +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > +      dldir=$destdir/`dirname \$dlpath`~
> > +      $install_prog $dir/$dlname $destdir/$dlname~
> > +      chmod a+x $destdir/$dlname~
> > +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> > +      fi'
> > +    else
> >      postinstall_cmds='base_file=`basename \${file}`~
> >        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> >        dldir=$destdir/`dirname \$dlpath`~
> > @@ -10642,6 +10654,7 @@ cygwin* | mingw* | pw32* | cegcc*)
> >        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> >          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
> >        fi'
> > +    fi
> >      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
> >        dlpath=$dir/\$dldll~
> >         $RM \$dlpath'
> > diff --git a/libgomp/configure b/libgomp/configure
> > index ad245b47dff..22f879046a5 100755
> > --- a/libgomp/configure
> > +++ b/libgomp/configure
> > @@ -10531,6 +10531,18 @@ cygwin* | mingw* | pw32* | cegcc*)
> >    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
> >      library_names_spec='$libname.dll.a'
> >      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> > +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> > +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> > +    if test ${multilib} = yes; then
> > +    postinstall_cmds='base_file=`basename \${file}`~
> > +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > +      dldir=$destdir/`dirname \$dlpath`~
> > +      $install_prog $dir/$dlname $destdir/$dlname~
> > +      chmod a+x $destdir/$dlname~
> > +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> > +      fi'
> > +    else
> >      postinstall_cmds='base_file=`basename \${file}`~
> >        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> >        dldir=$destdir/`dirname \$dlpath`~
> > @@ -10540,6 +10552,7 @@ cygwin* | mingw* | pw32* | cegcc*)
> >        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> >          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
> >        fi'
> > +    fi
> >      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
> >        dlpath=$dir/\$dldll~
> >         $RM \$dlpath'
> > @@ -14247,6 +14260,18 @@ cygwin* | mingw* | pw32* | cegcc*)
> >    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
> >      library_names_spec='$libname.dll.a'
> >      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> > +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> > +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> > +    if test ${multilib} = yes; then
> > +    postinstall_cmds='base_file=`basename \${file}`~
> > +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > +      dldir=$destdir/`dirname \$dlpath`~
> > +      $install_prog $dir/$dlname $destdir/$dlname~
> > +      chmod a+x $destdir/$dlname~
> > +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> > +      fi'
> > +    else
> >      postinstall_cmds='base_file=`basename \${file}`~
> >        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> >        dldir=$destdir/`dirname \$dlpath`~
> > @@ -14256,6 +14281,7 @@ cygwin* | mingw* | pw32* | cegcc*)
> >        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> >          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
> >        fi'
> > +    fi
> >      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
> >        dlpath=$dir/\$dldll~
> >         $RM \$dlpath'
> > diff --git a/libgrust/configure b/libgrust/configure
> > index dcdc3142fa2..7abc1a8b13a 100755
> > --- a/libgrust/configure
> > +++ b/libgrust/configure
> > @@ -11699,6 +11699,18 @@ cygwin* | mingw* | pw32* | cegcc*)
> >    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
> >      library_names_spec='$libname.dll.a'
> >      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> > +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> > +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> > +    if test ${multilib} = yes; then
> > +    postinstall_cmds='base_file=`basename \${file}`~
> > +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > +      dldir=$destdir/`dirname \$dlpath`~
> > +      $install_prog $dir/$dlname $destdir/$dlname~
> > +      chmod a+x $destdir/$dlname~
> > +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> > +      fi'
> > +    else
> >      postinstall_cmds='base_file=`basename \${file}`~
> >        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> >        dldir=$destdir/`dirname \$dlpath`~
> > @@ -11708,6 +11720,7 @@ cygwin* | mingw* | pw32* | cegcc*)
> >        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> >          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
> >        fi'
> > +    fi
> >      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
> >        dlpath=$dir/\$dldll~
> >         $RM \$dlpath'
> > @@ -15451,6 +15464,18 @@ cygwin* | mingw* | pw32* | cegcc*)
> >    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
> >      library_names_spec='$libname.dll.a'
> >      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> > +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> > +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> > +    if test ${multilib} = yes; then
> > +    postinstall_cmds='base_file=`basename \${file}`~
> > +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > +      dldir=$destdir/`dirname \$dlpath`~
> > +      $install_prog $dir/$dlname $destdir/$dlname~
> > +      chmod a+x $destdir/$dlname~
> > +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> > +      fi'
> > +    else
> >      postinstall_cmds='base_file=`basename \${file}`~
> >        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> >        dldir=$destdir/`dirname \$dlpath`~
> > @@ -15460,6 +15485,7 @@ cygwin* | mingw* | pw32* | cegcc*)
> >        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> >          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
> >        fi'
> > +    fi
> >      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
> >        dlpath=$dir/\$dldll~
> >         $RM \$dlpath'
> > diff --git a/libitm/configure b/libitm/configure
> > index 9ba7fb03a57..31db9015c18 100755
> > --- a/libitm/configure
> > +++ b/libitm/configure
> > @@ -11193,6 +11193,18 @@ cygwin* | mingw* | pw32* | cegcc*)
> >    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
> >      library_names_spec='$libname.dll.a'
> >      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> > +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> > +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> > +    if test ${multilib} = yes; then
> > +    postinstall_cmds='base_file=`basename \${file}`~
> > +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > +      dldir=$destdir/`dirname \$dlpath`~
> > +      $install_prog $dir/$dlname $destdir/$dlname~
> > +      chmod a+x $destdir/$dlname~
> > +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> > +      fi'
> > +    else
> >      postinstall_cmds='base_file=`basename \${file}`~
> >        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> >        dldir=$destdir/`dirname \$dlpath`~
> > @@ -11202,6 +11214,7 @@ cygwin* | mingw* | pw32* | cegcc*)
> >        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> >          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
> >        fi'
> > +    fi
> >      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
> >        dlpath=$dir/\$dldll~
> >         $RM \$dlpath'
> > @@ -14921,6 +14934,18 @@ cygwin* | mingw* | pw32* | cegcc*)
> >    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
> >      library_names_spec='$libname.dll.a'
> >      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> > +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> > +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> > +    if test ${multilib} = yes; then
> > +    postinstall_cmds='base_file=`basename \${file}`~
> > +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > +      dldir=$destdir/`dirname \$dlpath`~
> > +      $install_prog $dir/$dlname $destdir/$dlname~
> > +      chmod a+x $destdir/$dlname~
> > +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> > +      fi'
> > +    else
> >      postinstall_cmds='base_file=`basename \${file}`~
> >        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> >        dldir=$destdir/`dirname \$dlpath`~
> > @@ -14930,6 +14955,7 @@ cygwin* | mingw* | pw32* | cegcc*)
> >        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> >          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
> >        fi'
> > +    fi
> >      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
> >        dlpath=$dir/\$dldll~
> >         $RM \$dlpath'
> > diff --git a/libobjc/configure b/libobjc/configure
> > index 68172549137..32160f9a547 100755
> > --- a/libobjc/configure
> > +++ b/libobjc/configure
> > @@ -9920,6 +9920,18 @@ cygwin* | mingw* | pw32* | cegcc*)
> >    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
> >      library_names_spec='$libname.dll.a'
> >      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> > +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> > +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> > +    if test ${multilib} = yes; then
> > +    postinstall_cmds='base_file=`basename \${file}`~
> > +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > +      dldir=$destdir/`dirname \$dlpath`~
> > +      $install_prog $dir/$dlname $destdir/$dlname~
> > +      chmod a+x $destdir/$dlname~
> > +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> > +      fi'
> > +    else
> >      postinstall_cmds='base_file=`basename \${file}`~
> >        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> >        dldir=$destdir/`dirname \$dlpath`~
> > @@ -9929,6 +9941,7 @@ cygwin* | mingw* | pw32* | cegcc*)
> >        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> >          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
> >        fi'
> > +    fi
> >      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
> >        dlpath=$dir/\$dldll~
> >         $RM \$dlpath'
> > diff --git a/libphobos/configure b/libphobos/configure
> > index 9b6a41879d3..0d9a877455d 100755
> > --- a/libphobos/configure
> > +++ b/libphobos/configure
> > @@ -10929,6 +10929,18 @@ cygwin* | mingw* | pw32* | cegcc*)
> >    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
> >      library_names_spec='$libname.dll.a'
> >      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> > +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> > +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> > +    if test ${multilib} = yes; then
> > +    postinstall_cmds='base_file=`basename \${file}`~
> > +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > +      dldir=$destdir/`dirname \$dlpath`~
> > +      $install_prog $dir/$dlname $destdir/$dlname~
> > +      chmod a+x $destdir/$dlname~
> > +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> > +      fi'
> > +    else
> >      postinstall_cmds='base_file=`basename \${file}`~
> >        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> >        dldir=$destdir/`dirname \$dlpath`~
> > @@ -10938,6 +10950,7 @@ cygwin* | mingw* | pw32* | cegcc*)
> >        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> >          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
> >        fi'
> > +    fi
> >      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
> >        dlpath=$dir/\$dldll~
> >         $RM \$dlpath'
> > diff --git a/libquadmath/configure b/libquadmath/configure
> > index 49d70809218..2882c1f30c2 100755
> > --- a/libquadmath/configure
> > +++ b/libquadmath/configure
> > @@ -9966,6 +9966,18 @@ cygwin* | mingw* | pw32* | cegcc*)
> >    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
> >      library_names_spec='$libname.dll.a'
> >      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> > +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> > +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> > +    if test ${multilib} = yes; then
> > +    postinstall_cmds='base_file=`basename \${file}`~
> > +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > +      dldir=$destdir/`dirname \$dlpath`~
> > +      $install_prog $dir/$dlname $destdir/$dlname~
> > +      chmod a+x $destdir/$dlname~
> > +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> > +      fi'
> > +    else
> >      postinstall_cmds='base_file=`basename \${file}`~
> >        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> >        dldir=$destdir/`dirname \$dlpath`~
> > @@ -9975,6 +9987,7 @@ cygwin* | mingw* | pw32* | cegcc*)
> >        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> >          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
> >        fi'
> > +    fi
> >      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
> >        dlpath=$dir/\$dldll~
> >         $RM \$dlpath'
> > diff --git a/libsanitizer/configure b/libsanitizer/configure
> > index 6bfd28916d2..56b217d123a 100755
> > --- a/libsanitizer/configure
> > +++ b/libsanitizer/configure
> > @@ -11537,6 +11537,18 @@ cygwin* | mingw* | pw32* | cegcc*)
> >    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
> >      library_names_spec='$libname.dll.a'
> >      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> > +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> > +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> > +    if test ${multilib} = yes; then
> > +    postinstall_cmds='base_file=`basename \${file}`~
> > +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > +      dldir=$destdir/`dirname \$dlpath`~
> > +      $install_prog $dir/$dlname $destdir/$dlname~
> > +      chmod a+x $destdir/$dlname~
> > +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> > +      fi'
> > +    else
> >      postinstall_cmds='base_file=`basename \${file}`~
> >        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> >        dldir=$destdir/`dirname \$dlpath`~
> > @@ -11546,6 +11558,7 @@ cygwin* | mingw* | pw32* | cegcc*)
> >        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> >          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
> >        fi'
> > +    fi
> >      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
> >        dlpath=$dir/\$dldll~
> >         $RM \$dlpath'
> > @@ -15265,6 +15278,18 @@ cygwin* | mingw* | pw32* | cegcc*)
> >    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
> >      library_names_spec='$libname.dll.a'
> >      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> > +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> > +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> > +    if test ${multilib} = yes; then
> > +    postinstall_cmds='base_file=`basename \${file}`~
> > +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > +      dldir=$destdir/`dirname \$dlpath`~
> > +      $install_prog $dir/$dlname $destdir/$dlname~
> > +      chmod a+x $destdir/$dlname~
> > +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> > +      fi'
> > +    else
> >      postinstall_cmds='base_file=`basename \${file}`~
> >        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> >        dldir=$destdir/`dirname \$dlpath`~
> > @@ -15274,6 +15299,7 @@ cygwin* | mingw* | pw32* | cegcc*)
> >        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> >          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
> >        fi'
> > +    fi
> >      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
> >        dlpath=$dir/\$dldll~
> >         $RM \$dlpath'
> > diff --git a/libssp/configure b/libssp/configure
> > index 0052e03650d..e8560a861f7 100755
> > --- a/libssp/configure
> > +++ b/libssp/configure
> > @@ -10208,6 +10208,18 @@ cygwin* | mingw* | pw32* | cegcc*)
> >    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
> >      library_names_spec='$libname.dll.a'
> >      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> > +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> > +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> > +    if test ${multilib} = yes; then
> > +    postinstall_cmds='base_file=`basename \${file}`~
> > +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > +      dldir=$destdir/`dirname \$dlpath`~
> > +      $install_prog $dir/$dlname $destdir/$dlname~
> > +      chmod a+x $destdir/$dlname~
> > +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> > +      fi'
> > +    else
> >      postinstall_cmds='base_file=`basename \${file}`~
> >        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> >        dldir=$destdir/`dirname \$dlpath`~
> > @@ -10217,6 +10229,7 @@ cygwin* | mingw* | pw32* | cegcc*)
> >        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> >          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
> >        fi'
> > +    fi
> >      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
> >        dlpath=$dir/\$dldll~
> >         $RM \$dlpath'
> > diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
> > index 21abaeb0778..df7f77751ea 100755
> > --- a/libstdc++-v3/configure
> > +++ b/libstdc++-v3/configure
> > @@ -11324,6 +11324,18 @@ cygwin* | mingw* | pw32* | cegcc*)
> >    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
> >      library_names_spec='$libname.dll.a'
> >      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> > +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> > +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> > +    if test ${multilib} = yes; then
> > +    postinstall_cmds='base_file=`basename \${file}`~
> > +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > +      dldir=$destdir/`dirname \$dlpath`~
> > +      $install_prog $dir/$dlname $destdir/$dlname~
> > +      chmod a+x $destdir/$dlname~
> > +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> > +      fi'
> > +    else
> >      postinstall_cmds='base_file=`basename \${file}`~
> >        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> >        dldir=$destdir/`dirname \$dlpath`~
> > @@ -11333,6 +11345,7 @@ cygwin* | mingw* | pw32* | cegcc*)
> >        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> >          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
> >        fi'
> > +    fi
> >      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
> >        dlpath=$dir/\$dldll~
> >         $RM \$dlpath'
> > @@ -15076,6 +15089,18 @@ cygwin* | mingw* | pw32* | cegcc*)
> >    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
> >      library_names_spec='$libname.dll.a'
> >      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> > +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> > +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> > +    if test ${multilib} = yes; then
> > +    postinstall_cmds='base_file=`basename \${file}`~
> > +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > +      dldir=$destdir/`dirname \$dlpath`~
> > +      $install_prog $dir/$dlname $destdir/$dlname~
> > +      chmod a+x $destdir/$dlname~
> > +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> > +      fi'
> > +    else
> >      postinstall_cmds='base_file=`basename \${file}`~
> >        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> >        dldir=$destdir/`dirname \$dlpath`~
> > @@ -15085,6 +15110,7 @@ cygwin* | mingw* | pw32* | cegcc*)
> >        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> >          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
> >        fi'
> > +    fi
> >      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
> >        dlpath=$dir/\$dldll~
> >         $RM \$dlpath'
> > diff --git a/libtool.m4 b/libtool.m4
> > index add2d4a1e23..0e1006f18db 100644
> > --- a/libtool.m4
> > +++ b/libtool.m4
> > @@ -2293,6 +2293,18 @@ cygwin* | mingw* | pw32* | cegcc*)
> >    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
> >      library_names_spec='$libname.dll.a'
> >      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> > +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> > +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> > +    if test ${multilib} = yes; then
> > +    postinstall_cmds='base_file=`basename \${file}`~
> > +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > +      dldir=$destdir/`dirname \$dlpath`~
> > +      $install_prog $dir/$dlname $destdir/$dlname~
> > +      chmod a+x $destdir/$dlname~
> > +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> > +      fi'
> > +    else
> >      postinstall_cmds='base_file=`basename \${file}`~
> >        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> >        dldir=$destdir/`dirname \$dlpath`~
> > @@ -2302,6 +2314,7 @@ cygwin* | mingw* | pw32* | cegcc*)
> >        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> >          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
> >        fi'
> > +    fi
> >      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
> >        dlpath=$dir/\$dldll~
> >         $RM \$dlpath'
> > diff --git a/libvtv/configure b/libvtv/configure
> > index a7889161c50..64d904757c9 100755
> > --- a/libvtv/configure
> > +++ b/libvtv/configure
> > @@ -11431,6 +11431,18 @@ cygwin* | mingw* | pw32* | cegcc*)
> >    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
> >      library_names_spec='$libname.dll.a'
> >      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> > +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> > +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> > +    if test ${multilib} = yes; then
> > +    postinstall_cmds='base_file=`basename \${file}`~
> > +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > +      dldir=$destdir/`dirname \$dlpath`~
> > +      $install_prog $dir/$dlname $destdir/$dlname~
> > +      chmod a+x $destdir/$dlname~
> > +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> > +      fi'
> > +    else
> >      postinstall_cmds='base_file=`basename \${file}`~
> >        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> >        dldir=$destdir/`dirname \$dlpath`~
> > @@ -11440,6 +11452,7 @@ cygwin* | mingw* | pw32* | cegcc*)
> >        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> >          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
> >        fi'
> > +    fi
> >      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
> >        dlpath=$dir/\$dldll~
> >         $RM \$dlpath'
> > @@ -15159,6 +15172,18 @@ cygwin* | mingw* | pw32* | cegcc*)
> >    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
> >      library_names_spec='$libname.dll.a'
> >      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> > +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> > +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> > +    if test ${multilib} = yes; then
> > +    postinstall_cmds='base_file=`basename \${file}`~
> > +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > +      dldir=$destdir/`dirname \$dlpath`~
> > +      $install_prog $dir/$dlname $destdir/$dlname~
> > +      chmod a+x $destdir/$dlname~
> > +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> > +      fi'
> > +    else
> >      postinstall_cmds='base_file=`basename \${file}`~
> >        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> >        dldir=$destdir/`dirname \$dlpath`~
> > @@ -15168,6 +15193,7 @@ cygwin* | mingw* | pw32* | cegcc*)
> >        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> >          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
> >        fi'
> > +    fi
> >      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
> >        dlpath=$dir/\$dldll~
> >         $RM \$dlpath'
> > diff --git a/lto-plugin/configure b/lto-plugin/configure
> > index 28f5dd79cd7..56d4915673b 100755
> > --- a/lto-plugin/configure
> > +++ b/lto-plugin/configure
> > @@ -11303,6 +11303,18 @@ cygwin* | mingw* | pw32* | cegcc*)
> >    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
> >      library_names_spec='$libname.dll.a'
> >      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> > +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> > +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> > +    if test ${multilib} = yes; then
> > +    postinstall_cmds='base_file=`basename \${file}`~
> > +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > +      dldir=$destdir/`dirname \$dlpath`~
> > +      $install_prog $dir/$dlname $destdir/$dlname~
> > +      chmod a+x $destdir/$dlname~
> > +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> > +      fi'
> > +    else
> >      postinstall_cmds='base_file=`basename \${file}`~
> >        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> >        dldir=$destdir/`dirname \$dlpath`~
> > @@ -11312,6 +11324,7 @@ cygwin* | mingw* | pw32* | cegcc*)
> >        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> >          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
> >        fi'
> > +    fi
> >      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
> >        dlpath=$dir/\$dldll~
> >         $RM \$dlpath'
> > diff --git a/zlib/configure b/zlib/configure
> > index 92c462d04c6..ba3ad8101d6 100755
> > --- a/zlib/configure
> > +++ b/zlib/configure
> > @@ -9898,6 +9898,18 @@ cygwin* | mingw* | pw32* | cegcc*)
> >    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
> >      library_names_spec='$libname.dll.a'
> >      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> > +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> > +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> > +    if test ${multilib} = yes; then
> > +    postinstall_cmds='base_file=`basename \${file}`~
> > +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > +      dldir=$destdir/`dirname \$dlpath`~
> > +      $install_prog $dir/$dlname $destdir/$dlname~
> > +      chmod a+x $destdir/$dlname~
> > +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> > +      fi'
> > +    else
> >      postinstall_cmds='base_file=`basename \${file}`~
> >        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> >        dldir=$destdir/`dirname \$dlpath`~
> > @@ -9907,6 +9919,7 @@ cygwin* | mingw* | pw32* | cegcc*)
> >        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> >          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
> >        fi'
> > +    fi
> >      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
> >        dlpath=$dir/\$dldll~
> >         $RM \$dlpath'
> > --
> > 2.34.1
> >
unlvsur unlvsur May 15, 2024, 9:39 a.m. UTC | #4
cqwrteur@DESKTOP-9B705LH:~/gcc$ grep -r "# DLL is installed to" .
./zlib/configure:    # DLL is installed to $(libdir)/../bin by postinstall_cmds
./libitm/configure:    # DLL is installed to $(libdir)/../bin by postinstall_cmds
./libitm/configure:    # DLL is installed to $(libdir)/../bin by postinstall_cmds
./libquadmath/configure:    # DLL is installed to $(libdir)/../bin by postinstall_cmds
./libssp/configure:    # DLL is installed to $(libdir)/../bin by postinstall_cmds
./libobjc/configure:    # DLL is installed to $(libdir)/../bin by postinstall_cmds
./libvtv/configure:    # DLL is installed to $(libdir)/../bin by postinstall_cmds
./libvtv/configure:    # DLL is installed to $(libdir)/../bin by postinstall_cmds
./libsanitizer/configure:    # DLL is installed to $(libdir)/../bin by postinstall_cmds
./libsanitizer/configure:    # DLL is installed to $(libdir)/../bin by postinstall_cmds
./libstdc++-v3/configure:    # DLL is installed to $(libdir)/../bin by postinstall_cmds
./libstdc++-v3/configure:    # DLL is installed to $(libdir)/../bin by postinstall_cmds
./libffi/configure:    # DLL is installed to $(libdir)/../bin by postinstall_cmds
./libffi/configure:    # DLL is installed to $(libdir)/../bin by postinstall_cmds
./gcc/configure:    # DLL is installed to $(libdir)/../bin by postinstall_cmds
./gcc/configure:    # DLL is installed to $(libdir)/../bin by postinstall_cmds
./libphobos/configure:    # DLL is installed to $(libdir)/../bin by postinstall_cmds
./libgomp/configure:    # DLL is installed to $(libdir)/../bin by postinstall_cmds
./libgomp/configure:    # DLL is installed to $(libdir)/../bin by postinstall_cmds
./libgm2/configure:    # DLL is installed to $(libdir)/../bin by postinstall_cmds
./libgm2/configure:    # DLL is installed to $(libdir)/../bin by postinstall_cmds
./libcc1/configure:    # DLL is installed to $(libdir)/../bin by postinstall_cmds
./libcc1/configure:    # DLL is installed to $(libdir)/../bin by postinstall_cmds
./libbacktrace/configure:    # DLL is installed to $(libdir)/../bin by postinstall_cmds
./libgrust/configure:    # DLL is installed to $(libdir)/../bin by postinstall_cmds
./libgrust/configure:    # DLL is installed to $(libdir)/../bin by postinstall_cmds
./libtool.m4:    # DLL is installed to $(libdir)/../bin by postinstall_cmds
./libgfortran/configure:    # DLL is installed to $(libdir)/../bin by postinstall_cmds
./libgfortran/configure:    # DLL is installed to $(libdir)/../bin by postinstall_cmds
./lto-plugin/configure:    # DLL is installed to $(libdir)/../bin by postinstall_cmds
./libgo/config/libtool.m4:    # DLL is installed to $(libdir)/../bin by postinstall_cmds
./libgo/configure:    # DLL is installed to $(libdir)/../bin by postinstall_cmds
./libatomic/configure:    # DLL is installed to $(libdir)/../bin by postinstall_cmds

The comment can only find it from libtool and configure. configure.ac does not contain the information.

I just wrote a program to replace all text in gcc directory here.

can you tell me how to generate configure from libtool.m4? Thank you
Richard Biener May 15, 2024, 11:16 a.m. UTC | #5
On Wed, May 15, 2024 at 11:39 AM unlvsur unlvsur <unlvsur@live.com> wrote:
>
> cqwrteur@DESKTOP-9B705LH:~/gcc$ grep -r "# DLL is installed to" .
> ./zlib/configure:    # DLL is installed to $(libdir)/../bin by postinstall_cmds
> ./libitm/configure:    # DLL is installed to $(libdir)/../bin by postinstall_cmds
> ./libitm/configure:    # DLL is installed to $(libdir)/../bin by postinstall_cmds
> ./libquadmath/configure:    # DLL is installed to $(libdir)/../bin by postinstall_cmds
> ./libssp/configure:    # DLL is installed to $(libdir)/../bin by postinstall_cmds
> ./libobjc/configure:    # DLL is installed to $(libdir)/../bin by postinstall_cmds
> ./libvtv/configure:    # DLL is installed to $(libdir)/../bin by postinstall_cmds
> ./libvtv/configure:    # DLL is installed to $(libdir)/../bin by postinstall_cmds
> ./libsanitizer/configure:    # DLL is installed to $(libdir)/../bin by postinstall_cmds
> ./libsanitizer/configure:    # DLL is installed to $(libdir)/../bin by postinstall_cmds
> ./libstdc++-v3/configure:    # DLL is installed to $(libdir)/../bin by postinstall_cmds
> ./libstdc++-v3/configure:    # DLL is installed to $(libdir)/../bin by postinstall_cmds
> ./libffi/configure:    # DLL is installed to $(libdir)/../bin by postinstall_cmds
> ./libffi/configure:    # DLL is installed to $(libdir)/../bin by postinstall_cmds
> ./gcc/configure:    # DLL is installed to $(libdir)/../bin by postinstall_cmds
> ./gcc/configure:    # DLL is installed to $(libdir)/../bin by postinstall_cmds
> ./libphobos/configure:    # DLL is installed to $(libdir)/../bin by postinstall_cmds
> ./libgomp/configure:    # DLL is installed to $(libdir)/../bin by postinstall_cmds
> ./libgomp/configure:    # DLL is installed to $(libdir)/../bin by postinstall_cmds
> ./libgm2/configure:    # DLL is installed to $(libdir)/../bin by postinstall_cmds
> ./libgm2/configure:    # DLL is installed to $(libdir)/../bin by postinstall_cmds
> ./libcc1/configure:    # DLL is installed to $(libdir)/../bin by postinstall_cmds
> ./libcc1/configure:    # DLL is installed to $(libdir)/../bin by postinstall_cmds
> ./libbacktrace/configure:    # DLL is installed to $(libdir)/../bin by postinstall_cmds
> ./libgrust/configure:    # DLL is installed to $(libdir)/../bin by postinstall_cmds
> ./libgrust/configure:    # DLL is installed to $(libdir)/../bin by postinstall_cmds
> ./libtool.m4:    # DLL is installed to $(libdir)/../bin by postinstall_cmds
> ./libgfortran/configure:    # DLL is installed to $(libdir)/../bin by postinstall_cmds
> ./libgfortran/configure:    # DLL is installed to $(libdir)/../bin by postinstall_cmds
> ./lto-plugin/configure:    # DLL is installed to $(libdir)/../bin by postinstall_cmds
> ./libgo/config/libtool.m4:    # DLL is installed to $(libdir)/../bin by postinstall_cmds
> ./libgo/configure:    # DLL is installed to $(libdir)/../bin by postinstall_cmds
> ./libatomic/configure:    # DLL is installed to $(libdir)/../bin by postinstall_cmds
>
> The comment can only find it from libtool and configure. configure.ac does not contain the information.
>
> I just wrote a program to replace all text in gcc directory here.
>
> can you tell me how to generate configure from libtool.m4? Thank you

You need to have exactly autoconf 2.69 installed and then invoke
'autoconf' from each directory.
At least that's how I do it.  But my question was whether upstream
libtool has your fix or
whether this is a downstream patch against libtool.m4 which we need to carry.

Richard.

> ________________________________
> From: Richard Biener <richard.guenther@gmail.com>
> Sent: Wednesday, May 15, 2024 5:28
> To: unlvsur unlvsur <unlvsur@live.com>
> Cc: gcc-patches@gcc.gnu.org <gcc-patches@gcc.gnu.org>; trcrsired <uwgghhbcad@gmail.com>
> Subject: Re: [PATCH] [PATCH] Correct DLL Installation Path for x86_64-w64-mingw32 Multilib [PR115094]
>
> On Wed, May 15, 2024 at 11:02 AM unlvsur unlvsur <unlvsur@live.com> wrote:
> >
> > Hi. Richard. I checked configure.ac and it is not in configure.ac. It is in the libtool.m4. The code was generated from libtool.m4 so it is correct.
>
> Ah, sorry - the libtool.m4 change escaped me ...
>
> It's been some time since we updated libtool, is this fixed in libtool
> upstream in the
> same way?  You are missing a ChangeLog entry which should indicate which
> files were just re-generated and which ones you edited (and what part).
>
> Richard.
>
> > ________________________________
> > From: Richard Biener <richard.guenther@gmail.com>
> > Sent: Wednesday, May 15, 2024 3:46
> > To: trcrsired <unlvsur@live.com>
> > Cc: gcc-patches@gcc.gnu.org <gcc-patches@gcc.gnu.org>; trcrsired <uwgghhbcad@gmail.com>
> > Subject: Re: [PATCH] [PATCH] Correct DLL Installation Path for x86_64-w64-mingw32 Multilib [PR115094]
> >
> > On Tue, May 14, 2024 at 10:27 PM trcrsired <unlvsur@live.com> wrote:
> > >
> > > From: trcrsired <uwgghhbcad@gmail.com>
> > >
> > > When building native GCC for the x86_64-w64-mingw32 host, the compiler copies its library DLLs to the `bin` directory. However, in the case of a multilib configuration, both 32-bit and 64-bit libraries end up in the same `bin` directory, leading to conflicts where 64-bit DLLs are overridden by their 32-bit counterparts.
> > >
> > > This patch addresses the issue by adjusting the installation path for the libraries. Specifically, it installs the libraries to separate directories: `lib` for 64-bit and `lib32` for 32-bit. This behavior aligns with how libraries are installed when creating an x86_64-w64-mingw32 cross-compiler without copying them to the `bin` directory if it is a multilib build.
> >
> > You need to patch configure.ac, not only the generated files.
> >
> > > ---
> > >  gcc/configure           | 26 ++++++++++++++++++++++++++
> > >  libatomic/configure     | 13 +++++++++++++
> > >  libbacktrace/configure  | 13 +++++++++++++
> > >  libcc1/configure        | 26 ++++++++++++++++++++++++++
> > >  libffi/configure        | 26 ++++++++++++++++++++++++++
> > >  libgfortran/configure   | 26 ++++++++++++++++++++++++++
> > >  libgm2/configure        | 26 ++++++++++++++++++++++++++
> > >  libgo/config/libtool.m4 | 13 +++++++++++++
> > >  libgo/configure         | 13 +++++++++++++
> > >  libgomp/configure       | 26 ++++++++++++++++++++++++++
> > >  libgrust/configure      | 26 ++++++++++++++++++++++++++
> > >  libitm/configure        | 26 ++++++++++++++++++++++++++
> > >  libobjc/configure       | 13 +++++++++++++
> > >  libphobos/configure     | 13 +++++++++++++
> > >  libquadmath/configure   | 13 +++++++++++++
> > >  libsanitizer/configure  | 26 ++++++++++++++++++++++++++
> > >  libssp/configure        | 13 +++++++++++++
> > >  libstdc++-v3/configure  | 26 ++++++++++++++++++++++++++
> > >  libtool.m4              | 13 +++++++++++++
> > >  libvtv/configure        | 26 ++++++++++++++++++++++++++
> > >  lto-plugin/configure    | 13 +++++++++++++
> > >  zlib/configure          | 13 +++++++++++++
> > >  22 files changed, 429 insertions(+)
> > >
> > > diff --git a/gcc/configure b/gcc/configure
> > > index aaf5899cc03..beab6df1878 100755
> > > --- a/gcc/configure
> > > +++ b/gcc/configure
> > > @@ -20472,6 +20472,18 @@ cygwin* | mingw* | pw32* | cegcc*)
> > >    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
> > >      library_names_spec='$libname.dll.a'
> > >      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> > > +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> > > +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> > > +    if test ${multilib} = yes; then
> > > +    postinstall_cmds='base_file=`basename \${file}`~
> > > +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > > +      dldir=$destdir/`dirname \$dlpath`~
> > > +      $install_prog $dir/$dlname $destdir/$dlname~
> > > +      chmod a+x $destdir/$dlname~
> > > +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > > +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> > > +      fi'
> > > +    else
> > >      postinstall_cmds='base_file=`basename \${file}`~
> > >        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > >        dldir=$destdir/`dirname \$dlpath`~
> > > @@ -20481,6 +20493,7 @@ cygwin* | mingw* | pw32* | cegcc*)
> > >        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > >          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
> > >        fi'
> > > +    fi
> > >      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
> > >        dlpath=$dir/\$dldll~
> > >         $RM \$dlpath'
> > > @@ -24200,6 +24213,18 @@ cygwin* | mingw* | pw32* | cegcc*)
> > >    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
> > >      library_names_spec='$libname.dll.a'
> > >      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> > > +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> > > +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> > > +    if test ${multilib} = yes; then
> > > +    postinstall_cmds='base_file=`basename \${file}`~
> > > +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > > +      dldir=$destdir/`dirname \$dlpath`~
> > > +      $install_prog $dir/$dlname $destdir/$dlname~
> > > +      chmod a+x $destdir/$dlname~
> > > +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > > +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> > > +      fi'
> > > +    else
> > >      postinstall_cmds='base_file=`basename \${file}`~
> > >        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > >        dldir=$destdir/`dirname \$dlpath`~
> > > @@ -24209,6 +24234,7 @@ cygwin* | mingw* | pw32* | cegcc*)
> > >        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > >          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
> > >        fi'
> > > +    fi
> > >      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
> > >        dlpath=$dir/\$dldll~
> > >         $RM \$dlpath'
> > > diff --git a/libatomic/configure b/libatomic/configure
> > > index 32cb3ecac26..cb17a863719 100755
> > > --- a/libatomic/configure
> > > +++ b/libatomic/configure
> > > @@ -10518,6 +10518,18 @@ cygwin* | mingw* | pw32* | cegcc*)
> > >    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
> > >      library_names_spec='$libname.dll.a'
> > >      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> > > +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> > > +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> > > +    if test ${multilib} = yes; then
> > > +    postinstall_cmds='base_file=`basename \${file}`~
> > > +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > > +      dldir=$destdir/`dirname \$dlpath`~
> > > +      $install_prog $dir/$dlname $destdir/$dlname~
> > > +      chmod a+x $destdir/$dlname~
> > > +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > > +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> > > +      fi'
> > > +    else
> > >      postinstall_cmds='base_file=`basename \${file}`~
> > >        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > >        dldir=$destdir/`dirname \$dlpath`~
> > > @@ -10527,6 +10539,7 @@ cygwin* | mingw* | pw32* | cegcc*)
> > >        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > >          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
> > >        fi'
> > > +    fi
> > >      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
> > >        dlpath=$dir/\$dldll~
> > >         $RM \$dlpath'
> > > diff --git a/libbacktrace/configure b/libbacktrace/configure
> > > index ab94a85f45c..644d523c3cb 100755
> > > --- a/libbacktrace/configure
> > > +++ b/libbacktrace/configure
> > > @@ -10696,6 +10696,18 @@ cygwin* | mingw* | pw32* | cegcc*)
> > >    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
> > >      library_names_spec='$libname.dll.a'
> > >      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> > > +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> > > +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> > > +    if test ${multilib} = yes; then
> > > +    postinstall_cmds='base_file=`basename \${file}`~
> > > +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > > +      dldir=$destdir/`dirname \$dlpath`~
> > > +      $install_prog $dir/$dlname $destdir/$dlname~
> > > +      chmod a+x $destdir/$dlname~
> > > +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > > +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> > > +      fi'
> > > +    else
> > >      postinstall_cmds='base_file=`basename \${file}`~
> > >        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > >        dldir=$destdir/`dirname \$dlpath`~
> > > @@ -10705,6 +10717,7 @@ cygwin* | mingw* | pw32* | cegcc*)
> > >        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > >          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
> > >        fi'
> > > +    fi
> > >      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
> > >        dlpath=$dir/\$dldll~
> > >         $RM \$dlpath'
> > > diff --git a/libcc1/configure b/libcc1/configure
> > > index ea689a353c8..8233251c6e9 100755
> > > --- a/libcc1/configure
> > > +++ b/libcc1/configure
> > > @@ -9952,6 +9952,18 @@ cygwin* | mingw* | pw32* | cegcc*)
> > >    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
> > >      library_names_spec='$libname.dll.a'
> > >      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> > > +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> > > +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> > > +    if test ${multilib} = yes; then
> > > +    postinstall_cmds='base_file=`basename \${file}`~
> > > +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > > +      dldir=$destdir/`dirname \$dlpath`~
> > > +      $install_prog $dir/$dlname $destdir/$dlname~
> > > +      chmod a+x $destdir/$dlname~
> > > +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > > +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> > > +      fi'
> > > +    else
> > >      postinstall_cmds='base_file=`basename \${file}`~
> > >        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > >        dldir=$destdir/`dirname \$dlpath`~
> > > @@ -9961,6 +9973,7 @@ cygwin* | mingw* | pw32* | cegcc*)
> > >        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > >          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
> > >        fi'
> > > +    fi
> > >      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
> > >        dlpath=$dir/\$dldll~
> > >         $RM \$dlpath'
> > > @@ -14086,6 +14099,18 @@ cygwin* | mingw* | pw32* | cegcc*)
> > >    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
> > >      library_names_spec='$libname.dll.a'
> > >      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> > > +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> > > +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> > > +    if test ${multilib} = yes; then
> > > +    postinstall_cmds='base_file=`basename \${file}`~
> > > +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > > +      dldir=$destdir/`dirname \$dlpath`~
> > > +      $install_prog $dir/$dlname $destdir/$dlname~
> > > +      chmod a+x $destdir/$dlname~
> > > +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > > +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> > > +      fi'
> > > +    else
> > >      postinstall_cmds='base_file=`basename \${file}`~
> > >        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > >        dldir=$destdir/`dirname \$dlpath`~
> > > @@ -14095,6 +14120,7 @@ cygwin* | mingw* | pw32* | cegcc*)
> > >        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > >          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
> > >        fi'
> > > +    fi
> > >      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
> > >        dlpath=$dir/\$dldll~
> > >         $RM \$dlpath'
> > > diff --git a/libffi/configure b/libffi/configure
> > > index f82a45b13bc..d5c3717803c 100755
> > > --- a/libffi/configure
> > > +++ b/libffi/configure
> > > @@ -10750,6 +10750,18 @@ cygwin* | mingw* | pw32* | cegcc*)
> > >    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
> > >      library_names_spec='$libname.dll.a'
> > >      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> > > +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> > > +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> > > +    if test ${multilib} = yes; then
> > > +    postinstall_cmds='base_file=`basename \${file}`~
> > > +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > > +      dldir=$destdir/`dirname \$dlpath`~
> > > +      $install_prog $dir/$dlname $destdir/$dlname~
> > > +      chmod a+x $destdir/$dlname~
> > > +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > > +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> > > +      fi'
> > > +    else
> > >      postinstall_cmds='base_file=`basename \${file}`~
> > >        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > >        dldir=$destdir/`dirname \$dlpath`~
> > > @@ -10759,6 +10771,7 @@ cygwin* | mingw* | pw32* | cegcc*)
> > >        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > >          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
> > >        fi'
> > > +    fi
> > >      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
> > >        dlpath=$dir/\$dldll~
> > >         $RM \$dlpath'
> > > @@ -14478,6 +14491,18 @@ cygwin* | mingw* | pw32* | cegcc*)
> > >    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
> > >      library_names_spec='$libname.dll.a'
> > >      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> > > +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> > > +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> > > +    if test ${multilib} = yes; then
> > > +    postinstall_cmds='base_file=`basename \${file}`~
> > > +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > > +      dldir=$destdir/`dirname \$dlpath`~
> > > +      $install_prog $dir/$dlname $destdir/$dlname~
> > > +      chmod a+x $destdir/$dlname~
> > > +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > > +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> > > +      fi'
> > > +    else
> > >      postinstall_cmds='base_file=`basename \${file}`~
> > >        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > >        dldir=$destdir/`dirname \$dlpath`~
> > > @@ -14487,6 +14512,7 @@ cygwin* | mingw* | pw32* | cegcc*)
> > >        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > >          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
> > >        fi'
> > > +    fi
> > >      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
> > >        dlpath=$dir/\$dldll~
> > >         $RM \$dlpath'
> > > diff --git a/libgfortran/configure b/libgfortran/configure
> > > index 774dd52fc95..b092ee0a75d 100755
> > > --- a/libgfortran/configure
> > > +++ b/libgfortran/configure
> > > @@ -11896,6 +11896,18 @@ cygwin* | mingw* | pw32* | cegcc*)
> > >    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
> > >      library_names_spec='$libname.dll.a'
> > >      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> > > +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> > > +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> > > +    if test ${multilib} = yes; then
> > > +    postinstall_cmds='base_file=`basename \${file}`~
> > > +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > > +      dldir=$destdir/`dirname \$dlpath`~
> > > +      $install_prog $dir/$dlname $destdir/$dlname~
> > > +      chmod a+x $destdir/$dlname~
> > > +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > > +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> > > +      fi'
> > > +    else
> > >      postinstall_cmds='base_file=`basename \${file}`~
> > >        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > >        dldir=$destdir/`dirname \$dlpath`~
> > > @@ -11905,6 +11917,7 @@ cygwin* | mingw* | pw32* | cegcc*)
> > >        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > >          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
> > >        fi'
> > > +    fi
> > >      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
> > >        dlpath=$dir/\$dldll~
> > >         $RM \$dlpath'
> > > @@ -15742,6 +15755,18 @@ cygwin* | mingw* | pw32* | cegcc*)
> > >    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
> > >      library_names_spec='$libname.dll.a'
> > >      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> > > +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> > > +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> > > +    if test ${multilib} = yes; then
> > > +    postinstall_cmds='base_file=`basename \${file}`~
> > > +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > > +      dldir=$destdir/`dirname \$dlpath`~
> > > +      $install_prog $dir/$dlname $destdir/$dlname~
> > > +      chmod a+x $destdir/$dlname~
> > > +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > > +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> > > +      fi'
> > > +    else
> > >      postinstall_cmds='base_file=`basename \${file}`~
> > >        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > >        dldir=$destdir/`dirname \$dlpath`~
> > > @@ -15751,6 +15776,7 @@ cygwin* | mingw* | pw32* | cegcc*)
> > >        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > >          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
> > >        fi'
> > > +    fi
> > >      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
> > >        dlpath=$dir/\$dldll~
> > >         $RM \$dlpath'
> > > diff --git a/libgm2/configure b/libgm2/configure
> > > index 13861f0ff93..0b1471187ff 100755
> > > --- a/libgm2/configure
> > > +++ b/libgm2/configure
> > > @@ -13588,6 +13588,18 @@ cygwin* | mingw* | pw32* | cegcc*)
> > >    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
> > >      library_names_spec='$libname.dll.a'
> > >      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> > > +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> > > +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> > > +    if test ${multilib} = yes; then
> > > +    postinstall_cmds='base_file=`basename \${file}`~
> > > +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > > +      dldir=$destdir/`dirname \$dlpath`~
> > > +      $install_prog $dir/$dlname $destdir/$dlname~
> > > +      chmod a+x $destdir/$dlname~
> > > +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > > +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> > > +      fi'
> > > +    else
> > >      postinstall_cmds='base_file=`basename \${file}`~
> > >        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > >        dldir=$destdir/`dirname \$dlpath`~
> > > @@ -13597,6 +13609,7 @@ cygwin* | mingw* | pw32* | cegcc*)
> > >        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > >          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
> > >        fi'
> > > +    fi
> > >      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
> > >        dlpath=$dir/\$dldll~
> > >         $RM \$dlpath'
> > > @@ -17340,6 +17353,18 @@ cygwin* | mingw* | pw32* | cegcc*)
> > >    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
> > >      library_names_spec='$libname.dll.a'
> > >      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> > > +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> > > +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> > > +    if test ${multilib} = yes; then
> > > +    postinstall_cmds='base_file=`basename \${file}`~
> > > +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > > +      dldir=$destdir/`dirname \$dlpath`~
> > > +      $install_prog $dir/$dlname $destdir/$dlname~
> > > +      chmod a+x $destdir/$dlname~
> > > +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > > +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> > > +      fi'
> > > +    else
> > >      postinstall_cmds='base_file=`basename \${file}`~
> > >        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > >        dldir=$destdir/`dirname \$dlpath`~
> > > @@ -17349,6 +17374,7 @@ cygwin* | mingw* | pw32* | cegcc*)
> > >        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > >          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
> > >        fi'
> > > +    fi
> > >      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
> > >        dlpath=$dir/\$dldll~
> > >         $RM \$dlpath'
> > > diff --git a/libgo/config/libtool.m4 b/libgo/config/libtool.m4
> > > index 4ca90ee71bc..25436f1187c 100644
> > > --- a/libgo/config/libtool.m4
> > > +++ b/libgo/config/libtool.m4
> > > @@ -2219,6 +2219,18 @@ cygwin* | mingw* | pw32* | cegcc*)
> > >    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
> > >      library_names_spec='$libname.dll.a'
> > >      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> > > +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> > > +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> > > +    if test ${multilib} = yes; then
> > > +    postinstall_cmds='base_file=`basename \${file}`~
> > > +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > > +      dldir=$destdir/`dirname \$dlpath`~
> > > +      $install_prog $dir/$dlname $destdir/$dlname~
> > > +      chmod a+x $destdir/$dlname~
> > > +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > > +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> > > +      fi'
> > > +    else
> > >      postinstall_cmds='base_file=`basename \${file}`~
> > >        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > >        dldir=$destdir/`dirname \$dlpath`~
> > > @@ -2228,6 +2240,7 @@ cygwin* | mingw* | pw32* | cegcc*)
> > >        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > >          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
> > >        fi'
> > > +    fi
> > >      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
> > >        dlpath=$dir/\$dldll~
> > >         $RM \$dlpath'
> > > diff --git a/libgo/configure b/libgo/configure
> > > index c0d0a1560f5..d39bb637c5f 100755
> > > --- a/libgo/configure
> > > +++ b/libgo/configure
> > > @@ -10633,6 +10633,18 @@ cygwin* | mingw* | pw32* | cegcc*)
> > >    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
> > >      library_names_spec='$libname.dll.a'
> > >      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> > > +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> > > +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> > > +    if test ${multilib} = yes; then
> > > +    postinstall_cmds='base_file=`basename \${file}`~
> > > +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > > +      dldir=$destdir/`dirname \$dlpath`~
> > > +      $install_prog $dir/$dlname $destdir/$dlname~
> > > +      chmod a+x $destdir/$dlname~
> > > +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > > +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> > > +      fi'
> > > +    else
> > >      postinstall_cmds='base_file=`basename \${file}`~
> > >        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > >        dldir=$destdir/`dirname \$dlpath`~
> > > @@ -10642,6 +10654,7 @@ cygwin* | mingw* | pw32* | cegcc*)
> > >        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > >          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
> > >        fi'
> > > +    fi
> > >      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
> > >        dlpath=$dir/\$dldll~
> > >         $RM \$dlpath'
> > > diff --git a/libgomp/configure b/libgomp/configure
> > > index ad245b47dff..22f879046a5 100755
> > > --- a/libgomp/configure
> > > +++ b/libgomp/configure
> > > @@ -10531,6 +10531,18 @@ cygwin* | mingw* | pw32* | cegcc*)
> > >    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
> > >      library_names_spec='$libname.dll.a'
> > >      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> > > +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> > > +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> > > +    if test ${multilib} = yes; then
> > > +    postinstall_cmds='base_file=`basename \${file}`~
> > > +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > > +      dldir=$destdir/`dirname \$dlpath`~
> > > +      $install_prog $dir/$dlname $destdir/$dlname~
> > > +      chmod a+x $destdir/$dlname~
> > > +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > > +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> > > +      fi'
> > > +    else
> > >      postinstall_cmds='base_file=`basename \${file}`~
> > >        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > >        dldir=$destdir/`dirname \$dlpath`~
> > > @@ -10540,6 +10552,7 @@ cygwin* | mingw* | pw32* | cegcc*)
> > >        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > >          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
> > >        fi'
> > > +    fi
> > >      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
> > >        dlpath=$dir/\$dldll~
> > >         $RM \$dlpath'
> > > @@ -14247,6 +14260,18 @@ cygwin* | mingw* | pw32* | cegcc*)
> > >    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
> > >      library_names_spec='$libname.dll.a'
> > >      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> > > +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> > > +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> > > +    if test ${multilib} = yes; then
> > > +    postinstall_cmds='base_file=`basename \${file}`~
> > > +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > > +      dldir=$destdir/`dirname \$dlpath`~
> > > +      $install_prog $dir/$dlname $destdir/$dlname~
> > > +      chmod a+x $destdir/$dlname~
> > > +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > > +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> > > +      fi'
> > > +    else
> > >      postinstall_cmds='base_file=`basename \${file}`~
> > >        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > >        dldir=$destdir/`dirname \$dlpath`~
> > > @@ -14256,6 +14281,7 @@ cygwin* | mingw* | pw32* | cegcc*)
> > >        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > >          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
> > >        fi'
> > > +    fi
> > >      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
> > >        dlpath=$dir/\$dldll~
> > >         $RM \$dlpath'
> > > diff --git a/libgrust/configure b/libgrust/configure
> > > index dcdc3142fa2..7abc1a8b13a 100755
> > > --- a/libgrust/configure
> > > +++ b/libgrust/configure
> > > @@ -11699,6 +11699,18 @@ cygwin* | mingw* | pw32* | cegcc*)
> > >    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
> > >      library_names_spec='$libname.dll.a'
> > >      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> > > +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> > > +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> > > +    if test ${multilib} = yes; then
> > > +    postinstall_cmds='base_file=`basename \${file}`~
> > > +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > > +      dldir=$destdir/`dirname \$dlpath`~
> > > +      $install_prog $dir/$dlname $destdir/$dlname~
> > > +      chmod a+x $destdir/$dlname~
> > > +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > > +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> > > +      fi'
> > > +    else
> > >      postinstall_cmds='base_file=`basename \${file}`~
> > >        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > >        dldir=$destdir/`dirname \$dlpath`~
> > > @@ -11708,6 +11720,7 @@ cygwin* | mingw* | pw32* | cegcc*)
> > >        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > >          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
> > >        fi'
> > > +    fi
> > >      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
> > >        dlpath=$dir/\$dldll~
> > >         $RM \$dlpath'
> > > @@ -15451,6 +15464,18 @@ cygwin* | mingw* | pw32* | cegcc*)
> > >    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
> > >      library_names_spec='$libname.dll.a'
> > >      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> > > +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> > > +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> > > +    if test ${multilib} = yes; then
> > > +    postinstall_cmds='base_file=`basename \${file}`~
> > > +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > > +      dldir=$destdir/`dirname \$dlpath`~
> > > +      $install_prog $dir/$dlname $destdir/$dlname~
> > > +      chmod a+x $destdir/$dlname~
> > > +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > > +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> > > +      fi'
> > > +    else
> > >      postinstall_cmds='base_file=`basename \${file}`~
> > >        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > >        dldir=$destdir/`dirname \$dlpath`~
> > > @@ -15460,6 +15485,7 @@ cygwin* | mingw* | pw32* | cegcc*)
> > >        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > >          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
> > >        fi'
> > > +    fi
> > >      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
> > >        dlpath=$dir/\$dldll~
> > >         $RM \$dlpath'
> > > diff --git a/libitm/configure b/libitm/configure
> > > index 9ba7fb03a57..31db9015c18 100755
> > > --- a/libitm/configure
> > > +++ b/libitm/configure
> > > @@ -11193,6 +11193,18 @@ cygwin* | mingw* | pw32* | cegcc*)
> > >    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
> > >      library_names_spec='$libname.dll.a'
> > >      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> > > +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> > > +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> > > +    if test ${multilib} = yes; then
> > > +    postinstall_cmds='base_file=`basename \${file}`~
> > > +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > > +      dldir=$destdir/`dirname \$dlpath`~
> > > +      $install_prog $dir/$dlname $destdir/$dlname~
> > > +      chmod a+x $destdir/$dlname~
> > > +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > > +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> > > +      fi'
> > > +    else
> > >      postinstall_cmds='base_file=`basename \${file}`~
> > >        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > >        dldir=$destdir/`dirname \$dlpath`~
> > > @@ -11202,6 +11214,7 @@ cygwin* | mingw* | pw32* | cegcc*)
> > >        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > >          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
> > >        fi'
> > > +    fi
> > >      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
> > >        dlpath=$dir/\$dldll~
> > >         $RM \$dlpath'
> > > @@ -14921,6 +14934,18 @@ cygwin* | mingw* | pw32* | cegcc*)
> > >    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
> > >      library_names_spec='$libname.dll.a'
> > >      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> > > +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> > > +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> > > +    if test ${multilib} = yes; then
> > > +    postinstall_cmds='base_file=`basename \${file}`~
> > > +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > > +      dldir=$destdir/`dirname \$dlpath`~
> > > +      $install_prog $dir/$dlname $destdir/$dlname~
> > > +      chmod a+x $destdir/$dlname~
> > > +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > > +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> > > +      fi'
> > > +    else
> > >      postinstall_cmds='base_file=`basename \${file}`~
> > >        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > >        dldir=$destdir/`dirname \$dlpath`~
> > > @@ -14930,6 +14955,7 @@ cygwin* | mingw* | pw32* | cegcc*)
> > >        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > >          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
> > >        fi'
> > > +    fi
> > >      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
> > >        dlpath=$dir/\$dldll~
> > >         $RM \$dlpath'
> > > diff --git a/libobjc/configure b/libobjc/configure
> > > index 68172549137..32160f9a547 100755
> > > --- a/libobjc/configure
> > > +++ b/libobjc/configure
> > > @@ -9920,6 +9920,18 @@ cygwin* | mingw* | pw32* | cegcc*)
> > >    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
> > >      library_names_spec='$libname.dll.a'
> > >      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> > > +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> > > +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> > > +    if test ${multilib} = yes; then
> > > +    postinstall_cmds='base_file=`basename \${file}`~
> > > +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > > +      dldir=$destdir/`dirname \$dlpath`~
> > > +      $install_prog $dir/$dlname $destdir/$dlname~
> > > +      chmod a+x $destdir/$dlname~
> > > +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > > +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> > > +      fi'
> > > +    else
> > >      postinstall_cmds='base_file=`basename \${file}`~
> > >        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > >        dldir=$destdir/`dirname \$dlpath`~
> > > @@ -9929,6 +9941,7 @@ cygwin* | mingw* | pw32* | cegcc*)
> > >        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > >          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
> > >        fi'
> > > +    fi
> > >      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
> > >        dlpath=$dir/\$dldll~
> > >         $RM \$dlpath'
> > > diff --git a/libphobos/configure b/libphobos/configure
> > > index 9b6a41879d3..0d9a877455d 100755
> > > --- a/libphobos/configure
> > > +++ b/libphobos/configure
> > > @@ -10929,6 +10929,18 @@ cygwin* | mingw* | pw32* | cegcc*)
> > >    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
> > >      library_names_spec='$libname.dll.a'
> > >      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> > > +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> > > +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> > > +    if test ${multilib} = yes; then
> > > +    postinstall_cmds='base_file=`basename \${file}`~
> > > +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > > +      dldir=$destdir/`dirname \$dlpath`~
> > > +      $install_prog $dir/$dlname $destdir/$dlname~
> > > +      chmod a+x $destdir/$dlname~
> > > +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > > +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> > > +      fi'
> > > +    else
> > >      postinstall_cmds='base_file=`basename \${file}`~
> > >        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > >        dldir=$destdir/`dirname \$dlpath`~
> > > @@ -10938,6 +10950,7 @@ cygwin* | mingw* | pw32* | cegcc*)
> > >        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > >          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
> > >        fi'
> > > +    fi
> > >      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
> > >        dlpath=$dir/\$dldll~
> > >         $RM \$dlpath'
> > > diff --git a/libquadmath/configure b/libquadmath/configure
> > > index 49d70809218..2882c1f30c2 100755
> > > --- a/libquadmath/configure
> > > +++ b/libquadmath/configure
> > > @@ -9966,6 +9966,18 @@ cygwin* | mingw* | pw32* | cegcc*)
> > >    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
> > >      library_names_spec='$libname.dll.a'
> > >      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> > > +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> > > +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> > > +    if test ${multilib} = yes; then
> > > +    postinstall_cmds='base_file=`basename \${file}`~
> > > +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > > +      dldir=$destdir/`dirname \$dlpath`~
> > > +      $install_prog $dir/$dlname $destdir/$dlname~
> > > +      chmod a+x $destdir/$dlname~
> > > +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > > +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> > > +      fi'
> > > +    else
> > >      postinstall_cmds='base_file=`basename \${file}`~
> > >        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > >        dldir=$destdir/`dirname \$dlpath`~
> > > @@ -9975,6 +9987,7 @@ cygwin* | mingw* | pw32* | cegcc*)
> > >        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > >          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
> > >        fi'
> > > +    fi
> > >      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
> > >        dlpath=$dir/\$dldll~
> > >         $RM \$dlpath'
> > > diff --git a/libsanitizer/configure b/libsanitizer/configure
> > > index 6bfd28916d2..56b217d123a 100755
> > > --- a/libsanitizer/configure
> > > +++ b/libsanitizer/configure
> > > @@ -11537,6 +11537,18 @@ cygwin* | mingw* | pw32* | cegcc*)
> > >    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
> > >      library_names_spec='$libname.dll.a'
> > >      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> > > +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> > > +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> > > +    if test ${multilib} = yes; then
> > > +    postinstall_cmds='base_file=`basename \${file}`~
> > > +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > > +      dldir=$destdir/`dirname \$dlpath`~
> > > +      $install_prog $dir/$dlname $destdir/$dlname~
> > > +      chmod a+x $destdir/$dlname~
> > > +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > > +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> > > +      fi'
> > > +    else
> > >      postinstall_cmds='base_file=`basename \${file}`~
> > >        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > >        dldir=$destdir/`dirname \$dlpath`~
> > > @@ -11546,6 +11558,7 @@ cygwin* | mingw* | pw32* | cegcc*)
> > >        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > >          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
> > >        fi'
> > > +    fi
> > >      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
> > >        dlpath=$dir/\$dldll~
> > >         $RM \$dlpath'
> > > @@ -15265,6 +15278,18 @@ cygwin* | mingw* | pw32* | cegcc*)
> > >    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
> > >      library_names_spec='$libname.dll.a'
> > >      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> > > +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> > > +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> > > +    if test ${multilib} = yes; then
> > > +    postinstall_cmds='base_file=`basename \${file}`~
> > > +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > > +      dldir=$destdir/`dirname \$dlpath`~
> > > +      $install_prog $dir/$dlname $destdir/$dlname~
> > > +      chmod a+x $destdir/$dlname~
> > > +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > > +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> > > +      fi'
> > > +    else
> > >      postinstall_cmds='base_file=`basename \${file}`~
> > >        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > >        dldir=$destdir/`dirname \$dlpath`~
> > > @@ -15274,6 +15299,7 @@ cygwin* | mingw* | pw32* | cegcc*)
> > >        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > >          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
> > >        fi'
> > > +    fi
> > >      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
> > >        dlpath=$dir/\$dldll~
> > >         $RM \$dlpath'
> > > diff --git a/libssp/configure b/libssp/configure
> > > index 0052e03650d..e8560a861f7 100755
> > > --- a/libssp/configure
> > > +++ b/libssp/configure
> > > @@ -10208,6 +10208,18 @@ cygwin* | mingw* | pw32* | cegcc*)
> > >    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
> > >      library_names_spec='$libname.dll.a'
> > >      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> > > +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> > > +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> > > +    if test ${multilib} = yes; then
> > > +    postinstall_cmds='base_file=`basename \${file}`~
> > > +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > > +      dldir=$destdir/`dirname \$dlpath`~
> > > +      $install_prog $dir/$dlname $destdir/$dlname~
> > > +      chmod a+x $destdir/$dlname~
> > > +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > > +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> > > +      fi'
> > > +    else
> > >      postinstall_cmds='base_file=`basename \${file}`~
> > >        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > >        dldir=$destdir/`dirname \$dlpath`~
> > > @@ -10217,6 +10229,7 @@ cygwin* | mingw* | pw32* | cegcc*)
> > >        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > >          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
> > >        fi'
> > > +    fi
> > >      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
> > >        dlpath=$dir/\$dldll~
> > >         $RM \$dlpath'
> > > diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
> > > index 21abaeb0778..df7f77751ea 100755
> > > --- a/libstdc++-v3/configure
> > > +++ b/libstdc++-v3/configure
> > > @@ -11324,6 +11324,18 @@ cygwin* | mingw* | pw32* | cegcc*)
> > >    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
> > >      library_names_spec='$libname.dll.a'
> > >      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> > > +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> > > +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> > > +    if test ${multilib} = yes; then
> > > +    postinstall_cmds='base_file=`basename \${file}`~
> > > +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > > +      dldir=$destdir/`dirname \$dlpath`~
> > > +      $install_prog $dir/$dlname $destdir/$dlname~
> > > +      chmod a+x $destdir/$dlname~
> > > +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > > +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> > > +      fi'
> > > +    else
> > >      postinstall_cmds='base_file=`basename \${file}`~
> > >        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > >        dldir=$destdir/`dirname \$dlpath`~
> > > @@ -11333,6 +11345,7 @@ cygwin* | mingw* | pw32* | cegcc*)
> > >        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > >          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
> > >        fi'
> > > +    fi
> > >      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
> > >        dlpath=$dir/\$dldll~
> > >         $RM \$dlpath'
> > > @@ -15076,6 +15089,18 @@ cygwin* | mingw* | pw32* | cegcc*)
> > >    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
> > >      library_names_spec='$libname.dll.a'
> > >      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> > > +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> > > +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> > > +    if test ${multilib} = yes; then
> > > +    postinstall_cmds='base_file=`basename \${file}`~
> > > +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > > +      dldir=$destdir/`dirname \$dlpath`~
> > > +      $install_prog $dir/$dlname $destdir/$dlname~
> > > +      chmod a+x $destdir/$dlname~
> > > +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > > +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> > > +      fi'
> > > +    else
> > >      postinstall_cmds='base_file=`basename \${file}`~
> > >        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > >        dldir=$destdir/`dirname \$dlpath`~
> > > @@ -15085,6 +15110,7 @@ cygwin* | mingw* | pw32* | cegcc*)
> > >        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > >          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
> > >        fi'
> > > +    fi
> > >      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
> > >        dlpath=$dir/\$dldll~
> > >         $RM \$dlpath'
> > > diff --git a/libtool.m4 b/libtool.m4
> > > index add2d4a1e23..0e1006f18db 100644
> > > --- a/libtool.m4
> > > +++ b/libtool.m4
> > > @@ -2293,6 +2293,18 @@ cygwin* | mingw* | pw32* | cegcc*)
> > >    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
> > >      library_names_spec='$libname.dll.a'
> > >      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> > > +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> > > +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> > > +    if test ${multilib} = yes; then
> > > +    postinstall_cmds='base_file=`basename \${file}`~
> > > +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > > +      dldir=$destdir/`dirname \$dlpath`~
> > > +      $install_prog $dir/$dlname $destdir/$dlname~
> > > +      chmod a+x $destdir/$dlname~
> > > +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > > +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> > > +      fi'
> > > +    else
> > >      postinstall_cmds='base_file=`basename \${file}`~
> > >        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > >        dldir=$destdir/`dirname \$dlpath`~
> > > @@ -2302,6 +2314,7 @@ cygwin* | mingw* | pw32* | cegcc*)
> > >        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > >          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
> > >        fi'
> > > +    fi
> > >      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
> > >        dlpath=$dir/\$dldll~
> > >         $RM \$dlpath'
> > > diff --git a/libvtv/configure b/libvtv/configure
> > > index a7889161c50..64d904757c9 100755
> > > --- a/libvtv/configure
> > > +++ b/libvtv/configure
> > > @@ -11431,6 +11431,18 @@ cygwin* | mingw* | pw32* | cegcc*)
> > >    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
> > >      library_names_spec='$libname.dll.a'
> > >      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> > > +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> > > +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> > > +    if test ${multilib} = yes; then
> > > +    postinstall_cmds='base_file=`basename \${file}`~
> > > +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > > +      dldir=$destdir/`dirname \$dlpath`~
> > > +      $install_prog $dir/$dlname $destdir/$dlname~
> > > +      chmod a+x $destdir/$dlname~
> > > +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > > +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> > > +      fi'
> > > +    else
> > >      postinstall_cmds='base_file=`basename \${file}`~
> > >        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > >        dldir=$destdir/`dirname \$dlpath`~
> > > @@ -11440,6 +11452,7 @@ cygwin* | mingw* | pw32* | cegcc*)
> > >        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > >          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
> > >        fi'
> > > +    fi
> > >      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
> > >        dlpath=$dir/\$dldll~
> > >         $RM \$dlpath'
> > > @@ -15159,6 +15172,18 @@ cygwin* | mingw* | pw32* | cegcc*)
> > >    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
> > >      library_names_spec='$libname.dll.a'
> > >      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> > > +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> > > +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> > > +    if test ${multilib} = yes; then
> > > +    postinstall_cmds='base_file=`basename \${file}`~
> > > +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > > +      dldir=$destdir/`dirname \$dlpath`~
> > > +      $install_prog $dir/$dlname $destdir/$dlname~
> > > +      chmod a+x $destdir/$dlname~
> > > +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > > +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> > > +      fi'
> > > +    else
> > >      postinstall_cmds='base_file=`basename \${file}`~
> > >        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > >        dldir=$destdir/`dirname \$dlpath`~
> > > @@ -15168,6 +15193,7 @@ cygwin* | mingw* | pw32* | cegcc*)
> > >        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > >          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
> > >        fi'
> > > +    fi
> > >      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
> > >        dlpath=$dir/\$dldll~
> > >         $RM \$dlpath'
> > > diff --git a/lto-plugin/configure b/lto-plugin/configure
> > > index 28f5dd79cd7..56d4915673b 100755
> > > --- a/lto-plugin/configure
> > > +++ b/lto-plugin/configure
> > > @@ -11303,6 +11303,18 @@ cygwin* | mingw* | pw32* | cegcc*)
> > >    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
> > >      library_names_spec='$libname.dll.a'
> > >      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> > > +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> > > +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> > > +    if test ${multilib} = yes; then
> > > +    postinstall_cmds='base_file=`basename \${file}`~
> > > +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > > +      dldir=$destdir/`dirname \$dlpath`~
> > > +      $install_prog $dir/$dlname $destdir/$dlname~
> > > +      chmod a+x $destdir/$dlname~
> > > +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > > +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> > > +      fi'
> > > +    else
> > >      postinstall_cmds='base_file=`basename \${file}`~
> > >        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > >        dldir=$destdir/`dirname \$dlpath`~
> > > @@ -11312,6 +11324,7 @@ cygwin* | mingw* | pw32* | cegcc*)
> > >        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > >          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
> > >        fi'
> > > +    fi
> > >      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
> > >        dlpath=$dir/\$dldll~
> > >         $RM \$dlpath'
> > > diff --git a/zlib/configure b/zlib/configure
> > > index 92c462d04c6..ba3ad8101d6 100755
> > > --- a/zlib/configure
> > > +++ b/zlib/configure
> > > @@ -9898,6 +9898,18 @@ cygwin* | mingw* | pw32* | cegcc*)
> > >    yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
> > >      library_names_spec='$libname.dll.a'
> > >      # DLL is installed to $(libdir)/../bin by postinstall_cmds
> > > +    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
> > > +    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
> > > +    if test ${multilib} = yes; then
> > > +    postinstall_cmds='base_file=`basename \${file}`~
> > > +      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > > +      dldir=$destdir/`dirname \$dlpath`~
> > > +      $install_prog $dir/$dlname $destdir/$dlname~
> > > +      chmod a+x $destdir/$dlname~
> > > +      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > > +        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
> > > +      fi'
> > > +    else
> > >      postinstall_cmds='base_file=`basename \${file}`~
> > >        dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
> > >        dldir=$destdir/`dirname \$dlpath`~
> > > @@ -9907,6 +9919,7 @@ cygwin* | mingw* | pw32* | cegcc*)
> > >        if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
> > >          eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
> > >        fi'
> > > +    fi
> > >      postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
> > >        dlpath=$dir/\$dldll~
> > >         $RM \$dlpath'
> > > --
> > > 2.34.1
> > >
diff mbox series

Patch

diff --git a/gcc/configure b/gcc/configure
index aaf5899cc03..beab6df1878 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -20472,6 +20472,18 @@  cygwin* | mingw* | pw32* | cegcc*)
   yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
     library_names_spec='$libname.dll.a'
     # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
+    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
+    if test ${multilib} = yes; then
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      $install_prog $dir/$dlname $destdir/$dlname~
+      chmod a+x $destdir/$dlname~
+      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
+      fi'
+    else
     postinstall_cmds='base_file=`basename \${file}`~
       dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
       dldir=$destdir/`dirname \$dlpath`~
@@ -20481,6 +20493,7 @@  cygwin* | mingw* | pw32* | cegcc*)
       if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
         eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
       fi'
+    fi
     postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
       dlpath=$dir/\$dldll~
        $RM \$dlpath'
@@ -24200,6 +24213,18 @@  cygwin* | mingw* | pw32* | cegcc*)
   yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
     library_names_spec='$libname.dll.a'
     # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
+    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
+    if test ${multilib} = yes; then
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      $install_prog $dir/$dlname $destdir/$dlname~
+      chmod a+x $destdir/$dlname~
+      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
+      fi'
+    else
     postinstall_cmds='base_file=`basename \${file}`~
       dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
       dldir=$destdir/`dirname \$dlpath`~
@@ -24209,6 +24234,7 @@  cygwin* | mingw* | pw32* | cegcc*)
       if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
         eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
       fi'
+    fi
     postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
       dlpath=$dir/\$dldll~
        $RM \$dlpath'
diff --git a/libatomic/configure b/libatomic/configure
index 32cb3ecac26..cb17a863719 100755
--- a/libatomic/configure
+++ b/libatomic/configure
@@ -10518,6 +10518,18 @@  cygwin* | mingw* | pw32* | cegcc*)
   yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
     library_names_spec='$libname.dll.a'
     # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
+    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
+    if test ${multilib} = yes; then
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      $install_prog $dir/$dlname $destdir/$dlname~
+      chmod a+x $destdir/$dlname~
+      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
+      fi'
+    else
     postinstall_cmds='base_file=`basename \${file}`~
       dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
       dldir=$destdir/`dirname \$dlpath`~
@@ -10527,6 +10539,7 @@  cygwin* | mingw* | pw32* | cegcc*)
       if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
         eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
       fi'
+    fi
     postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
       dlpath=$dir/\$dldll~
        $RM \$dlpath'
diff --git a/libbacktrace/configure b/libbacktrace/configure
index ab94a85f45c..644d523c3cb 100755
--- a/libbacktrace/configure
+++ b/libbacktrace/configure
@@ -10696,6 +10696,18 @@  cygwin* | mingw* | pw32* | cegcc*)
   yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
     library_names_spec='$libname.dll.a'
     # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
+    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
+    if test ${multilib} = yes; then
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      $install_prog $dir/$dlname $destdir/$dlname~
+      chmod a+x $destdir/$dlname~
+      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
+      fi'
+    else
     postinstall_cmds='base_file=`basename \${file}`~
       dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
       dldir=$destdir/`dirname \$dlpath`~
@@ -10705,6 +10717,7 @@  cygwin* | mingw* | pw32* | cegcc*)
       if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
         eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
       fi'
+    fi
     postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
       dlpath=$dir/\$dldll~
        $RM \$dlpath'
diff --git a/libcc1/configure b/libcc1/configure
index ea689a353c8..8233251c6e9 100755
--- a/libcc1/configure
+++ b/libcc1/configure
@@ -9952,6 +9952,18 @@  cygwin* | mingw* | pw32* | cegcc*)
   yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
     library_names_spec='$libname.dll.a'
     # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
+    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
+    if test ${multilib} = yes; then
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      $install_prog $dir/$dlname $destdir/$dlname~
+      chmod a+x $destdir/$dlname~
+      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
+      fi'
+    else
     postinstall_cmds='base_file=`basename \${file}`~
       dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
       dldir=$destdir/`dirname \$dlpath`~
@@ -9961,6 +9973,7 @@  cygwin* | mingw* | pw32* | cegcc*)
       if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
         eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
       fi'
+    fi
     postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
       dlpath=$dir/\$dldll~
        $RM \$dlpath'
@@ -14086,6 +14099,18 @@  cygwin* | mingw* | pw32* | cegcc*)
   yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
     library_names_spec='$libname.dll.a'
     # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
+    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
+    if test ${multilib} = yes; then
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      $install_prog $dir/$dlname $destdir/$dlname~
+      chmod a+x $destdir/$dlname~
+      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
+      fi'
+    else
     postinstall_cmds='base_file=`basename \${file}`~
       dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
       dldir=$destdir/`dirname \$dlpath`~
@@ -14095,6 +14120,7 @@  cygwin* | mingw* | pw32* | cegcc*)
       if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
         eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
       fi'
+    fi
     postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
       dlpath=$dir/\$dldll~
        $RM \$dlpath'
diff --git a/libffi/configure b/libffi/configure
index f82a45b13bc..d5c3717803c 100755
--- a/libffi/configure
+++ b/libffi/configure
@@ -10750,6 +10750,18 @@  cygwin* | mingw* | pw32* | cegcc*)
   yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
     library_names_spec='$libname.dll.a'
     # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
+    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
+    if test ${multilib} = yes; then
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      $install_prog $dir/$dlname $destdir/$dlname~
+      chmod a+x $destdir/$dlname~
+      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
+      fi'
+    else
     postinstall_cmds='base_file=`basename \${file}`~
       dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
       dldir=$destdir/`dirname \$dlpath`~
@@ -10759,6 +10771,7 @@  cygwin* | mingw* | pw32* | cegcc*)
       if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
         eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
       fi'
+    fi
     postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
       dlpath=$dir/\$dldll~
        $RM \$dlpath'
@@ -14478,6 +14491,18 @@  cygwin* | mingw* | pw32* | cegcc*)
   yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
     library_names_spec='$libname.dll.a'
     # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
+    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
+    if test ${multilib} = yes; then
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      $install_prog $dir/$dlname $destdir/$dlname~
+      chmod a+x $destdir/$dlname~
+      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
+      fi'
+    else
     postinstall_cmds='base_file=`basename \${file}`~
       dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
       dldir=$destdir/`dirname \$dlpath`~
@@ -14487,6 +14512,7 @@  cygwin* | mingw* | pw32* | cegcc*)
       if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
         eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
       fi'
+    fi
     postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
       dlpath=$dir/\$dldll~
        $RM \$dlpath'
diff --git a/libgfortran/configure b/libgfortran/configure
index 774dd52fc95..b092ee0a75d 100755
--- a/libgfortran/configure
+++ b/libgfortran/configure
@@ -11896,6 +11896,18 @@  cygwin* | mingw* | pw32* | cegcc*)
   yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
     library_names_spec='$libname.dll.a'
     # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
+    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
+    if test ${multilib} = yes; then
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      $install_prog $dir/$dlname $destdir/$dlname~
+      chmod a+x $destdir/$dlname~
+      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
+      fi'
+    else
     postinstall_cmds='base_file=`basename \${file}`~
       dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
       dldir=$destdir/`dirname \$dlpath`~
@@ -11905,6 +11917,7 @@  cygwin* | mingw* | pw32* | cegcc*)
       if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
         eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
       fi'
+    fi
     postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
       dlpath=$dir/\$dldll~
        $RM \$dlpath'
@@ -15742,6 +15755,18 @@  cygwin* | mingw* | pw32* | cegcc*)
   yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
     library_names_spec='$libname.dll.a'
     # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
+    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
+    if test ${multilib} = yes; then
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      $install_prog $dir/$dlname $destdir/$dlname~
+      chmod a+x $destdir/$dlname~
+      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
+      fi'
+    else
     postinstall_cmds='base_file=`basename \${file}`~
       dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
       dldir=$destdir/`dirname \$dlpath`~
@@ -15751,6 +15776,7 @@  cygwin* | mingw* | pw32* | cegcc*)
       if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
         eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
       fi'
+    fi
     postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
       dlpath=$dir/\$dldll~
        $RM \$dlpath'
diff --git a/libgm2/configure b/libgm2/configure
index 13861f0ff93..0b1471187ff 100755
--- a/libgm2/configure
+++ b/libgm2/configure
@@ -13588,6 +13588,18 @@  cygwin* | mingw* | pw32* | cegcc*)
   yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
     library_names_spec='$libname.dll.a'
     # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
+    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
+    if test ${multilib} = yes; then
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      $install_prog $dir/$dlname $destdir/$dlname~
+      chmod a+x $destdir/$dlname~
+      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
+      fi'
+    else
     postinstall_cmds='base_file=`basename \${file}`~
       dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
       dldir=$destdir/`dirname \$dlpath`~
@@ -13597,6 +13609,7 @@  cygwin* | mingw* | pw32* | cegcc*)
       if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
         eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
       fi'
+    fi
     postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
       dlpath=$dir/\$dldll~
        $RM \$dlpath'
@@ -17340,6 +17353,18 @@  cygwin* | mingw* | pw32* | cegcc*)
   yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
     library_names_spec='$libname.dll.a'
     # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
+    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
+    if test ${multilib} = yes; then
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      $install_prog $dir/$dlname $destdir/$dlname~
+      chmod a+x $destdir/$dlname~
+      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
+      fi'
+    else
     postinstall_cmds='base_file=`basename \${file}`~
       dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
       dldir=$destdir/`dirname \$dlpath`~
@@ -17349,6 +17374,7 @@  cygwin* | mingw* | pw32* | cegcc*)
       if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
         eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
       fi'
+    fi
     postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
       dlpath=$dir/\$dldll~
        $RM \$dlpath'
diff --git a/libgo/config/libtool.m4 b/libgo/config/libtool.m4
index 4ca90ee71bc..25436f1187c 100644
--- a/libgo/config/libtool.m4
+++ b/libgo/config/libtool.m4
@@ -2219,6 +2219,18 @@  cygwin* | mingw* | pw32* | cegcc*)
   yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
     library_names_spec='$libname.dll.a'
     # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
+    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
+    if test ${multilib} = yes; then
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      $install_prog $dir/$dlname $destdir/$dlname~
+      chmod a+x $destdir/$dlname~
+      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
+      fi'
+    else
     postinstall_cmds='base_file=`basename \${file}`~
       dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
       dldir=$destdir/`dirname \$dlpath`~
@@ -2228,6 +2240,7 @@  cygwin* | mingw* | pw32* | cegcc*)
       if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
         eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
       fi'
+    fi
     postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
       dlpath=$dir/\$dldll~
        $RM \$dlpath'
diff --git a/libgo/configure b/libgo/configure
index c0d0a1560f5..d39bb637c5f 100755
--- a/libgo/configure
+++ b/libgo/configure
@@ -10633,6 +10633,18 @@  cygwin* | mingw* | pw32* | cegcc*)
   yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
     library_names_spec='$libname.dll.a'
     # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
+    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
+    if test ${multilib} = yes; then
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      $install_prog $dir/$dlname $destdir/$dlname~
+      chmod a+x $destdir/$dlname~
+      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
+      fi'
+    else
     postinstall_cmds='base_file=`basename \${file}`~
       dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
       dldir=$destdir/`dirname \$dlpath`~
@@ -10642,6 +10654,7 @@  cygwin* | mingw* | pw32* | cegcc*)
       if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
         eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
       fi'
+    fi
     postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
       dlpath=$dir/\$dldll~
        $RM \$dlpath'
diff --git a/libgomp/configure b/libgomp/configure
index ad245b47dff..22f879046a5 100755
--- a/libgomp/configure
+++ b/libgomp/configure
@@ -10531,6 +10531,18 @@  cygwin* | mingw* | pw32* | cegcc*)
   yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
     library_names_spec='$libname.dll.a'
     # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
+    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
+    if test ${multilib} = yes; then
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      $install_prog $dir/$dlname $destdir/$dlname~
+      chmod a+x $destdir/$dlname~
+      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
+      fi'
+    else
     postinstall_cmds='base_file=`basename \${file}`~
       dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
       dldir=$destdir/`dirname \$dlpath`~
@@ -10540,6 +10552,7 @@  cygwin* | mingw* | pw32* | cegcc*)
       if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
         eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
       fi'
+    fi
     postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
       dlpath=$dir/\$dldll~
        $RM \$dlpath'
@@ -14247,6 +14260,18 @@  cygwin* | mingw* | pw32* | cegcc*)
   yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
     library_names_spec='$libname.dll.a'
     # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
+    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
+    if test ${multilib} = yes; then
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      $install_prog $dir/$dlname $destdir/$dlname~
+      chmod a+x $destdir/$dlname~
+      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
+      fi'
+    else
     postinstall_cmds='base_file=`basename \${file}`~
       dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
       dldir=$destdir/`dirname \$dlpath`~
@@ -14256,6 +14281,7 @@  cygwin* | mingw* | pw32* | cegcc*)
       if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
         eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
       fi'
+    fi
     postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
       dlpath=$dir/\$dldll~
        $RM \$dlpath'
diff --git a/libgrust/configure b/libgrust/configure
index dcdc3142fa2..7abc1a8b13a 100755
--- a/libgrust/configure
+++ b/libgrust/configure
@@ -11699,6 +11699,18 @@  cygwin* | mingw* | pw32* | cegcc*)
   yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
     library_names_spec='$libname.dll.a'
     # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
+    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
+    if test ${multilib} = yes; then
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      $install_prog $dir/$dlname $destdir/$dlname~
+      chmod a+x $destdir/$dlname~
+      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
+      fi'
+    else
     postinstall_cmds='base_file=`basename \${file}`~
       dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
       dldir=$destdir/`dirname \$dlpath`~
@@ -11708,6 +11720,7 @@  cygwin* | mingw* | pw32* | cegcc*)
       if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
         eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
       fi'
+    fi
     postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
       dlpath=$dir/\$dldll~
        $RM \$dlpath'
@@ -15451,6 +15464,18 @@  cygwin* | mingw* | pw32* | cegcc*)
   yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
     library_names_spec='$libname.dll.a'
     # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
+    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
+    if test ${multilib} = yes; then
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      $install_prog $dir/$dlname $destdir/$dlname~
+      chmod a+x $destdir/$dlname~
+      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
+      fi'
+    else
     postinstall_cmds='base_file=`basename \${file}`~
       dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
       dldir=$destdir/`dirname \$dlpath`~
@@ -15460,6 +15485,7 @@  cygwin* | mingw* | pw32* | cegcc*)
       if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
         eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
       fi'
+    fi
     postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
       dlpath=$dir/\$dldll~
        $RM \$dlpath'
diff --git a/libitm/configure b/libitm/configure
index 9ba7fb03a57..31db9015c18 100755
--- a/libitm/configure
+++ b/libitm/configure
@@ -11193,6 +11193,18 @@  cygwin* | mingw* | pw32* | cegcc*)
   yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
     library_names_spec='$libname.dll.a'
     # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
+    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
+    if test ${multilib} = yes; then
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      $install_prog $dir/$dlname $destdir/$dlname~
+      chmod a+x $destdir/$dlname~
+      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
+      fi'
+    else
     postinstall_cmds='base_file=`basename \${file}`~
       dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
       dldir=$destdir/`dirname \$dlpath`~
@@ -11202,6 +11214,7 @@  cygwin* | mingw* | pw32* | cegcc*)
       if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
         eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
       fi'
+    fi
     postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
       dlpath=$dir/\$dldll~
        $RM \$dlpath'
@@ -14921,6 +14934,18 @@  cygwin* | mingw* | pw32* | cegcc*)
   yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
     library_names_spec='$libname.dll.a'
     # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
+    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
+    if test ${multilib} = yes; then
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      $install_prog $dir/$dlname $destdir/$dlname~
+      chmod a+x $destdir/$dlname~
+      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
+      fi'
+    else
     postinstall_cmds='base_file=`basename \${file}`~
       dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
       dldir=$destdir/`dirname \$dlpath`~
@@ -14930,6 +14955,7 @@  cygwin* | mingw* | pw32* | cegcc*)
       if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
         eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
       fi'
+    fi
     postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
       dlpath=$dir/\$dldll~
        $RM \$dlpath'
diff --git a/libobjc/configure b/libobjc/configure
index 68172549137..32160f9a547 100755
--- a/libobjc/configure
+++ b/libobjc/configure
@@ -9920,6 +9920,18 @@  cygwin* | mingw* | pw32* | cegcc*)
   yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
     library_names_spec='$libname.dll.a'
     # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
+    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
+    if test ${multilib} = yes; then
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      $install_prog $dir/$dlname $destdir/$dlname~
+      chmod a+x $destdir/$dlname~
+      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
+      fi'
+    else
     postinstall_cmds='base_file=`basename \${file}`~
       dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
       dldir=$destdir/`dirname \$dlpath`~
@@ -9929,6 +9941,7 @@  cygwin* | mingw* | pw32* | cegcc*)
       if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
         eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
       fi'
+    fi
     postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
       dlpath=$dir/\$dldll~
        $RM \$dlpath'
diff --git a/libphobos/configure b/libphobos/configure
index 9b6a41879d3..0d9a877455d 100755
--- a/libphobos/configure
+++ b/libphobos/configure
@@ -10929,6 +10929,18 @@  cygwin* | mingw* | pw32* | cegcc*)
   yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
     library_names_spec='$libname.dll.a'
     # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
+    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
+    if test ${multilib} = yes; then
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      $install_prog $dir/$dlname $destdir/$dlname~
+      chmod a+x $destdir/$dlname~
+      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
+      fi'
+    else
     postinstall_cmds='base_file=`basename \${file}`~
       dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
       dldir=$destdir/`dirname \$dlpath`~
@@ -10938,6 +10950,7 @@  cygwin* | mingw* | pw32* | cegcc*)
       if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
         eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
       fi'
+    fi
     postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
       dlpath=$dir/\$dldll~
        $RM \$dlpath'
diff --git a/libquadmath/configure b/libquadmath/configure
index 49d70809218..2882c1f30c2 100755
--- a/libquadmath/configure
+++ b/libquadmath/configure
@@ -9966,6 +9966,18 @@  cygwin* | mingw* | pw32* | cegcc*)
   yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
     library_names_spec='$libname.dll.a'
     # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
+    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
+    if test ${multilib} = yes; then
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      $install_prog $dir/$dlname $destdir/$dlname~
+      chmod a+x $destdir/$dlname~
+      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
+      fi'
+    else
     postinstall_cmds='base_file=`basename \${file}`~
       dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
       dldir=$destdir/`dirname \$dlpath`~
@@ -9975,6 +9987,7 @@  cygwin* | mingw* | pw32* | cegcc*)
       if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
         eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
       fi'
+    fi
     postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
       dlpath=$dir/\$dldll~
        $RM \$dlpath'
diff --git a/libsanitizer/configure b/libsanitizer/configure
index 6bfd28916d2..56b217d123a 100755
--- a/libsanitizer/configure
+++ b/libsanitizer/configure
@@ -11537,6 +11537,18 @@  cygwin* | mingw* | pw32* | cegcc*)
   yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
     library_names_spec='$libname.dll.a'
     # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
+    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
+    if test ${multilib} = yes; then
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      $install_prog $dir/$dlname $destdir/$dlname~
+      chmod a+x $destdir/$dlname~
+      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
+      fi'
+    else
     postinstall_cmds='base_file=`basename \${file}`~
       dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
       dldir=$destdir/`dirname \$dlpath`~
@@ -11546,6 +11558,7 @@  cygwin* | mingw* | pw32* | cegcc*)
       if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
         eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
       fi'
+    fi
     postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
       dlpath=$dir/\$dldll~
        $RM \$dlpath'
@@ -15265,6 +15278,18 @@  cygwin* | mingw* | pw32* | cegcc*)
   yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
     library_names_spec='$libname.dll.a'
     # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
+    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
+    if test ${multilib} = yes; then
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      $install_prog $dir/$dlname $destdir/$dlname~
+      chmod a+x $destdir/$dlname~
+      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
+      fi'
+    else
     postinstall_cmds='base_file=`basename \${file}`~
       dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
       dldir=$destdir/`dirname \$dlpath`~
@@ -15274,6 +15299,7 @@  cygwin* | mingw* | pw32* | cegcc*)
       if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
         eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
       fi'
+    fi
     postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
       dlpath=$dir/\$dldll~
        $RM \$dlpath'
diff --git a/libssp/configure b/libssp/configure
index 0052e03650d..e8560a861f7 100755
--- a/libssp/configure
+++ b/libssp/configure
@@ -10208,6 +10208,18 @@  cygwin* | mingw* | pw32* | cegcc*)
   yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
     library_names_spec='$libname.dll.a'
     # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
+    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
+    if test ${multilib} = yes; then
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      $install_prog $dir/$dlname $destdir/$dlname~
+      chmod a+x $destdir/$dlname~
+      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
+      fi'
+    else
     postinstall_cmds='base_file=`basename \${file}`~
       dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
       dldir=$destdir/`dirname \$dlpath`~
@@ -10217,6 +10229,7 @@  cygwin* | mingw* | pw32* | cegcc*)
       if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
         eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
       fi'
+    fi
     postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
       dlpath=$dir/\$dldll~
        $RM \$dlpath'
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index 21abaeb0778..df7f77751ea 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -11324,6 +11324,18 @@  cygwin* | mingw* | pw32* | cegcc*)
   yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
     library_names_spec='$libname.dll.a'
     # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
+    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
+    if test ${multilib} = yes; then
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      $install_prog $dir/$dlname $destdir/$dlname~
+      chmod a+x $destdir/$dlname~
+      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
+      fi'
+    else
     postinstall_cmds='base_file=`basename \${file}`~
       dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
       dldir=$destdir/`dirname \$dlpath`~
@@ -11333,6 +11345,7 @@  cygwin* | mingw* | pw32* | cegcc*)
       if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
         eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
       fi'
+    fi
     postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
       dlpath=$dir/\$dldll~
        $RM \$dlpath'
@@ -15076,6 +15089,18 @@  cygwin* | mingw* | pw32* | cegcc*)
   yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
     library_names_spec='$libname.dll.a'
     # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
+    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
+    if test ${multilib} = yes; then
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      $install_prog $dir/$dlname $destdir/$dlname~
+      chmod a+x $destdir/$dlname~
+      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
+      fi'
+    else
     postinstall_cmds='base_file=`basename \${file}`~
       dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
       dldir=$destdir/`dirname \$dlpath`~
@@ -15085,6 +15110,7 @@  cygwin* | mingw* | pw32* | cegcc*)
       if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
         eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
       fi'
+    fi
     postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
       dlpath=$dir/\$dldll~
        $RM \$dlpath'
diff --git a/libtool.m4 b/libtool.m4
index add2d4a1e23..0e1006f18db 100644
--- a/libtool.m4
+++ b/libtool.m4
@@ -2293,6 +2293,18 @@  cygwin* | mingw* | pw32* | cegcc*)
   yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
     library_names_spec='$libname.dll.a'
     # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
+    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
+    if test ${multilib} = yes; then
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      $install_prog $dir/$dlname $destdir/$dlname~
+      chmod a+x $destdir/$dlname~
+      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
+      fi'
+    else
     postinstall_cmds='base_file=`basename \${file}`~
       dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
       dldir=$destdir/`dirname \$dlpath`~
@@ -2302,6 +2314,7 @@  cygwin* | mingw* | pw32* | cegcc*)
       if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
         eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
       fi'
+    fi
     postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
       dlpath=$dir/\$dldll~
        $RM \$dlpath'
diff --git a/libvtv/configure b/libvtv/configure
index a7889161c50..64d904757c9 100755
--- a/libvtv/configure
+++ b/libvtv/configure
@@ -11431,6 +11431,18 @@  cygwin* | mingw* | pw32* | cegcc*)
   yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
     library_names_spec='$libname.dll.a'
     # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
+    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
+    if test ${multilib} = yes; then
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      $install_prog $dir/$dlname $destdir/$dlname~
+      chmod a+x $destdir/$dlname~
+      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
+      fi'
+    else
     postinstall_cmds='base_file=`basename \${file}`~
       dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
       dldir=$destdir/`dirname \$dlpath`~
@@ -11440,6 +11452,7 @@  cygwin* | mingw* | pw32* | cegcc*)
       if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
         eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
       fi'
+    fi
     postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
       dlpath=$dir/\$dldll~
        $RM \$dlpath'
@@ -15159,6 +15172,18 @@  cygwin* | mingw* | pw32* | cegcc*)
   yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
     library_names_spec='$libname.dll.a'
     # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
+    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
+    if test ${multilib} = yes; then
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      $install_prog $dir/$dlname $destdir/$dlname~
+      chmod a+x $destdir/$dlname~
+      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
+      fi'
+    else
     postinstall_cmds='base_file=`basename \${file}`~
       dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
       dldir=$destdir/`dirname \$dlpath`~
@@ -15168,6 +15193,7 @@  cygwin* | mingw* | pw32* | cegcc*)
       if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
         eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
       fi'
+    fi
     postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
       dlpath=$dir/\$dldll~
        $RM \$dlpath'
diff --git a/lto-plugin/configure b/lto-plugin/configure
index 28f5dd79cd7..56d4915673b 100755
--- a/lto-plugin/configure
+++ b/lto-plugin/configure
@@ -11303,6 +11303,18 @@  cygwin* | mingw* | pw32* | cegcc*)
   yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
     library_names_spec='$libname.dll.a'
     # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
+    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
+    if test ${multilib} = yes; then
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      $install_prog $dir/$dlname $destdir/$dlname~
+      chmod a+x $destdir/$dlname~
+      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
+      fi'
+    else
     postinstall_cmds='base_file=`basename \${file}`~
       dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
       dldir=$destdir/`dirname \$dlpath`~
@@ -11312,6 +11324,7 @@  cygwin* | mingw* | pw32* | cegcc*)
       if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
         eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
       fi'
+    fi
     postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
       dlpath=$dir/\$dldll~
        $RM \$dlpath'
diff --git a/zlib/configure b/zlib/configure
index 92c462d04c6..ba3ad8101d6 100755
--- a/zlib/configure
+++ b/zlib/configure
@@ -9898,6 +9898,18 @@  cygwin* | mingw* | pw32* | cegcc*)
   yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
     library_names_spec='$libname.dll.a'
     # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    # If user builds GCC with mulitlibs enabled, it should just install on $(libdir)
+    # not on $(libdir)/../bin or 32 bits dlls would override 64 bit ones.
+    if test ${multilib} = yes; then
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      $install_prog $dir/$dlname $destdir/$dlname~
+      chmod a+x $destdir/$dlname~
+      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+        eval '\''$striplib $destdir/$dlname'\'' || exit \$?;
+      fi'
+    else
     postinstall_cmds='base_file=`basename \${file}`~
       dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
       dldir=$destdir/`dirname \$dlpath`~
@@ -9907,6 +9919,7 @@  cygwin* | mingw* | pw32* | cegcc*)
       if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
         eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
       fi'
+    fi
     postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
       dlpath=$dir/\$dldll~
        $RM \$dlpath'