]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Add --disable-static-c++-tests option [BZ #31797]
authorH.J. Lu <hjl.tools@gmail.com>
Thu, 20 Jun 2024 22:28:13 +0000 (15:28 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Tue, 2 Jul 2024 07:51:34 +0000 (00:51 -0700)
By default, if the C++ toolchain lacks support for static linking,
configure fails to find the C++ header files and the glibc build fails.
The --disable-static-c++-link-check option allows the glibc build to
finish, but static C++ tests will fail if the C++ toolchain doesn't
have the necessary static C++ libraries which may not be easily installed.
Add --disable-static-c++-tests option to skip the static C++ link check
and tests.  This fixes BZ #31797.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
INSTALL
configure
configure.ac
manual/install.texi
nptl/Makefile

diff --git a/INSTALL b/INSTALL
index 02151e6e99a5c5901baf73d6c77ff419a194d7e7..4bd3d53676569e54f00e7f7d0921790be7d9ef43 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -224,6 +224,15 @@ if 'CFLAGS' is specified it must enable optimization.  For example:
      By default for x86_64, the GNU C Library is built with the vector
      math library.  Use this option to disable the vector math library.
 
+'--disable-static-c++-tests'
+     By default, if the C++ toolchain lacks support for static linking,
+     configure fails to find the C++ header files and the glibc build
+     fails.  '--disable-static-c++-link-check' allows the glibc build to
+     finish, but static C++ tests will fail if the C++ toolchain doesn't
+     have the necessary static C++ libraries.  Use this option to skip
+     the static C++ tests.  This option implies
+     '--disable-static-c++-link-check'.
+
 '--disable-static-c++-link-check'
      By default, if the C++ toolchain lacks support for static linking,
      configure fails to find the C++ header files and the glibc build
index e236b503feb3508ae513a6c4ab5c16c50bd5e04c..1bae55b45b25b251148f852abf8f4fadfeff971b 100755 (executable)
--- a/configure
+++ b/configure
@@ -771,6 +771,7 @@ ac_user_opts='
 enable_option_checking
 with_pkgversion
 with_bugurl
+enable_static_c___tests
 enable_static_c___link_check
 with_gd
 with_gd_include
@@ -1441,6 +1442,8 @@ Optional Features:
   --disable-option-checking  ignore unrecognized --enable/--with options
   --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
   --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
+  --disable-static-c++-tests
+                          disable static C++ tests[default=no]
   --disable-static-c++-link-check
                           disable static C++ link check [default=no]
   --disable-sanity-checks really do not use threads (should not be used except
@@ -3858,6 +3861,20 @@ if test -z "$CPP"; then
 fi
 
 
+# This will get text that should go into config.make.
+config_vars=
+
+# Check whether --enable-static-c++-tests was given.
+if test ${enable_static_c___tests+y}
+then :
+  enableval=$enable_static_c___tests; static_cxx_tests=$enableval
+else $as_nop
+  static_cxx_tests=yes
+fi
+
+config_vars="$config_vars
+static-cxx-tests = $static_cxx_tests"
+
 # Check whether --enable-static-c++-link-check was given.
 if test ${enable_static_c___link_check+y}
 then :
@@ -4291,7 +4308,7 @@ esac
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.beam \
     conftest$ac_exeext conftest.$ac_ext
-if test $static_cxx_link_check = yes; then
+if test $static_cxx_link_check$static_cxx_tests = yesyes; then
   # Static case.
   old_LDFLAGS="$LDFLAGS"
   LDFLAGS="$LDFLAGS -static"
@@ -4338,9 +4355,6 @@ if test "`cd $srcdir; pwd -P`" = "`pwd -P`"; then
   as_fn_error $? "you must configure in a separate build directory" "$LINENO" 5
 fi
 
-# This will get text that should go into config.make.
-config_vars=
-
 # Check for a --with-gd argument and set libgd-LDFLAGS in config.make.
 
 # Check whether --with-gd was given.
index ee64d49b03350ee41c2db85b8a00332aaf1d2d5e..e48957f318055e6c3d68226f8d1def2e61790910 100644 (file)
@@ -52,6 +52,16 @@ fi
 AC_SUBST(cross_compiling)
 AC_PROG_CPP
 
+# This will get text that should go into config.make.
+config_vars=
+
+AC_ARG_ENABLE([static-c++-tests],
+             AS_HELP_STRING([--disable-static-c++-tests],
+                            [disable static C++ tests@<:@default=no@:>@]),
+             [static_cxx_tests=$enableval],
+             [static_cxx_tests=yes])
+LIBC_CONFIG_VAR([static-cxx-tests], [$static_cxx_tests])
+
 AC_ARG_ENABLE([static-c++-link-check],
              AS_HELP_STRING([--disable-static-c++-link-check],
                             [disable static C++ link check @<:@default=no@:>@]),
@@ -67,7 +77,7 @@ AC_LANG_PUSH([C++])
 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
               [libc_cv_cxx_link_ok=yes],
               [libc_cv_cxx_link_ok=no])
-if test $static_cxx_link_check = yes; then
+if test $static_cxx_link_check$static_cxx_tests = yesyes; then
   # Static case.
   old_LDFLAGS="$LDFLAGS"
   LDFLAGS="$LDFLAGS -static"
@@ -92,9 +102,6 @@ if test "`cd $srcdir; pwd -P`" = "`pwd -P`"; then
   AC_MSG_ERROR([you must configure in a separate build directory])
 fi
 
-# This will get text that should go into config.make.
-config_vars=
-
 # Check for a --with-gd argument and set libgd-LDFLAGS in config.make.
 AC_ARG_WITH([gd],
            AS_HELP_STRING([--with-gd=DIR],
index 6b6595ac9161d9633699b9556d3d2a9b3c0dcbb1..a7847b02c0558019519e0cd40ef2049d0a5e74c8 100644 (file)
@@ -252,6 +252,14 @@ configure with @option{--disable-werror}.
 By default for x86_64, @theglibc{} is built with the vector math library.
 Use this option to disable the vector math library.
 
+@item --disable-static-c++-tests
+By default, if the C++ toolchain lacks support for static linking,
+configure fails to find the C++ header files and the glibc build fails.
+@option{--disable-static-c++-link-check} allows the glibc build to finish,
+but static C++ tests will fail if the C++ toolchain doesn't have the
+necessary static C++ libraries.  Use this option to skip the static C++
+tests.  This option implies @option{--disable-static-c++-link-check}.
+
 @item --disable-static-c++-link-check
 By default, if the C++ toolchain lacks support for static linking,
 configure fails to find the C++ header files and the glibc build fails.
index 096eef54f2500c82669c0bc3db9f11c33c5e2b5a..c4c27e0d23c85bc90c69130bd3aa758e85c3c034 100644 (file)
@@ -545,6 +545,9 @@ tests-static += \
   # tests-static
 
 tests += tst-cancel24-static
+ifeq ($(static-cxx-tests),no)
+tests-unsupported += tst-cancel24-static
+endif
 
 tests-internal += \
   tst-sem11-static \