aboutsummaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2024-06-20 15:28:12 -0700
committerH.J. Lu <hjl.tools@gmail.com>2024-07-02 00:51:34 -0700
commit23f12e6e0c95aaf8b5b4973d029db794a43f248a (patch)
tree0a1f40e34bcefc6644c16a618e31081e912a7c8d /configure.ac
parentdce754b1553b86fc6352636f1fa490a85b7cf0ff (diff)
downloadglibc-23f12e6e0c95aaf8b5b4973d029db794a43f248a.tar.xz
glibc-23f12e6e0c95aaf8b5b4973d029db794a43f248a.zip
Add --disable-static-c++-link-check option [BZ #31412]
The current minimum GCC version of glibc build is GCC 6.2 or newer. But building i686 glibc with GCC 6.4 on Fedora 40 failed since the C++ header files couldn't be found which was caused by the static C++ link check failure due to missing __divmoddi4 which was referenced in i686 libc.a and added to GCC 7. Add --disable-static-c++-link-check configure option to disable the static C++ link test. The newly built i686 libc.a can be used by GCC 6.4 to create static C++ tests. This fixes BZ #31412. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac22
1 files changed, 15 insertions, 7 deletions
diff --git a/configure.ac b/configure.ac
index bdc385d03c..ee64d49b03 100644
--- a/configure.ac
+++ b/configure.ac
@@ -52,6 +52,12 @@ fi
AC_SUBST(cross_compiling)
AC_PROG_CPP
+AC_ARG_ENABLE([static-c++-link-check],
+ AS_HELP_STRING([--disable-static-c++-link-check],
+ [disable static C++ link check @<:@default=no@:>@]),
+ [static_cxx_link_check=$enableval],
+ [static_cxx_link_check=yes])
+
# We need the C++ compiler only for testing.
AC_PROG_CXX
# It's useless to us if it can't link programs (e.g. missing -lstdc++).
@@ -61,10 +67,11 @@ AC_LANG_PUSH([C++])
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
[libc_cv_cxx_link_ok=yes],
[libc_cv_cxx_link_ok=no])
-# Static case.
-old_LDFLAGS="$LDFLAGS"
-LDFLAGS="$LDFLAGS -static"
-AC_LINK_IFELSE([AC_LANG_SOURCE([
+if test $static_cxx_link_check = yes; then
+ # Static case.
+ old_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS -static"
+ AC_LINK_IFELSE([AC_LANG_SOURCE([
#include <iostream>
int
@@ -74,9 +81,10 @@ main()
return 0;
}
])],
- [],
- [libc_cv_cxx_link_ok=no])
-LDFLAGS="$old_LDFLAGS"
+ [],
+ [libc_cv_cxx_link_ok=no])
+ LDFLAGS="$old_LDFLAGS"
+fi
AC_LANG_POP([C++])])
AS_IF([test $libc_cv_cxx_link_ok != yes], [CXX=])