PR bootstrap/56750 * configure.ac (stage1-static-libs): New option. * configure: Regenerate. gcc/ PR bootstrap/56750 * doc/install.texi (--enable-stage1-static-libs): New. diff --git a/configure.ac b/configure.ac index aae94501e48..94b540226cc 100644 --- a/configure.ac +++ b/configure.ac @@ -465,6 +465,12 @@ ENABLE_LIBSTDCXX=default) noconfigdirs="$noconfigdirs target-libstdc++-v3" fi] +AC_ARG_ENABLE(stage1-static-libs, +AS_HELP_STRING([--disable-stage1-static-libs], + [do not statically link libstdc++ and libgcc into stage1 binaries]), +ENABLE_STAGE1_STATIC_LIBS=$enableval, +ENABLE_STAGE1_STATIC_LIBS=yes) + # If this is accelerator compiler and its target is intelmic we enable # target liboffloadmic by default. If this is compiler with offloading # for intelmic we enable host liboffloadmic by default. Otherwise @@ -1619,7 +1625,7 @@ AC_ARG_WITH(stage1-ldflags, # In stage 1, default to linking libstdc++ and libgcc statically with GCC # if supported. But if the user explicitly specified the libraries to use, # trust that they are doing what they want. - if test "$stage1_libs" = "" -a "$have_static_libs" = yes; then + if test "$ENABLE_STAGE1_STATIC_LIBS" = "yes" -a "$stage1_libs" = "" -a "$have_static_libs" = yes; then stage1_ldflags="-static-libstdc++ -static-libgcc" fi]) AC_SUBST(stage1_ldflags) diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi index 64ad2445a33..5567daad957 100644 --- a/gcc/doc/install.texi +++ b/gcc/doc/install.texi @@ -1958,10 +1958,23 @@ include and lib options directly. These flags are applicable to the host platform only. When building a cross compiler, they will not be used to configure target libraries. +@item --enable-stage1-static-libs +@itemx --disable-stage1-static-libs + +Enable linking stage1 binaries with @samp{-static-libstdc++ +-static-libgcc} if available on your system. This also enables +linking stage1 binaries statically when not bootstrapping. The +default is enabled. + +Even with this option enabled, static libraries will only be used when +@option{--with-stage1-libs} is not set to a value. See option +@option{--with-stage1-ldflags} below. + @item --with-stage1-ldflags=@var{flags} This option may be used to set linker flags to be used when linking stage 1 of GCC. These are also used when linking GCC if configured with -@option{--disable-bootstrap}. If @option{--with-stage1-libs} is not set to a +@option{--disable-bootstrap}. If @option{--enable-stage1-static-libs} +is enabled and @option{--with-stage1-libs} is not set to a value, then the default is @samp{-static-libstdc++ -static-libgcc}, if supported.