This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Detect if the C++ toolchain does not support -static


On 10/23/2015 08:30 PM, Roland McGrath wrote:
>> On 10/23/2015 08:19 PM, Roland McGrath wrote:
>>> Why not just clear CXX and call this a "C++ not available" case?
>>
>> I have no preference either way.
> 
> Then let's keep it simpler for now.  Just change the criteria in the
> configure check, and don't add any new degrees of freedom.

What about this?

It results in the following failures without libstdc++-static:

UNSUPPORTED: debug/tst-chk4
UNSUPPORTED: debug/tst-chk5
UNSUPPORTED: debug/tst-chk6
UNSUPPORTED: debug/tst-lfschk4
UNSUPPORTED: debug/tst-lfschk5
UNSUPPORTED: debug/tst-lfschk6
UNSUPPORTED: dlfcn/bug-atexit3
UNSUPPORTED: nptl/tst-cancel24
UNSUPPORTED: nptl/tst-cancel24-static
UNSUPPORTED: nptl/tst-once5
UNSUPPORTED: nptl/tst-thread_local1

Florian

2015-10-23  Florian Weimer  <fweimer@redhat.com>

	* configure.ac (CXX): Clear the variable if the C++ toolchain does
	not support static linking.
	* configure: Regenerate.

diff --git a/configure.ac b/configure.ac
index e502aa5..3c7f6c0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -57,9 +57,26 @@ AC_PROG_CXX
 # It's useless to us if it can't link programs (e.g. missing -lstdc++).
 AC_CACHE_CHECK([whether $CXX can link programs], libc_cv_cxx_link_ok, [dnl
 AC_LANG_PUSH([C++])
+# Default, dynamic case.
 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([
+#include <iostream>
+
+int
+main()
+{
+  std::cout << "Hello, world!";
+  return 0;
+}
+])],
+	       [],
+	       [libc_cv_cxx_link_ok=no])
+LDFLAGS="$old_LDFLAGS"
 AC_LANG_POP([C++])])
 AS_IF([test $libc_cv_cxx_link_ok != yes], [CXX=])
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]