This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Detect if the C++ toolchain does not support -static
- From: Florian Weimer <fweimer at redhat dot com>
- To: Roland McGrath <roland at hack dot frob dot com>
- Cc: GNU C Library <libc-alpha at sourceware dot org>
- Date: Fri, 23 Oct 2015 23:34:56 +0200
- Subject: Re: [PATCH] Detect if the C++ toolchain does not support -static
- Authentication-results: sourceware.org; auth=none
- References: <562A4EDC dot 9030203 at redhat dot com> <20151023181910 dot 407252C3B7A at topped-with-meat dot com> <562A7A8D dot 7020106 at redhat dot com> <20151023183021 dot 2F8ED2C3B7A at topped-with-meat dot com>
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=])