fix visibility problems with libstdc++ on Debian and Ubuntu
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@47644 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -60,6 +60,30 @@ AC_DEFUN([WX_VISIBILITY],
|
||||
AC_MSG_RESULT([$wx_cv_cc_visibility])
|
||||
if test $wx_cv_cc_visibility = yes; then
|
||||
AC_DEFINE([HAVE_VISIBILITY])
|
||||
|
||||
dnl Debian/Ubuntu's gcc 4.1 is affected:
|
||||
dnl https://bugs.launchpad.net/ubuntu/+source/gcc-4.1/+bug/109262
|
||||
AC_MSG_CHECKING([for broken libstdc++ visibility])
|
||||
AC_CACHE_VAL(wx_cv_cc_broken_libstdcxx_visibility, [
|
||||
wx_save_CXXFLAGS="$CXXFLAGS"
|
||||
CXXFLAGS="$CXXFLAGS $CXXFLAGS_VISIBILITY"
|
||||
AC_LANG_PUSH(C++)
|
||||
AC_TRY_LINK(
|
||||
[
|
||||
#include <string>
|
||||
],
|
||||
[
|
||||
std::string x;
|
||||
],
|
||||
wx_cv_cc_broken_libstdcxx_visibility=no,
|
||||
wx_cv_cc_broken_libstdcxx_visibility=yes)
|
||||
AC_LANG_POP()
|
||||
CXXFLAGS="$wx_save_CXXFLAGS"])
|
||||
AC_MSG_RESULT([$wx_cv_cc_broken_libstdcxx_visibility])
|
||||
if test $wx_cv_cc_broken_libstdcxx_visibility = yes; then
|
||||
AC_DEFINE([HAVE_BROKEN_LIBSTDCXX_VISIBILITY])
|
||||
fi
|
||||
|
||||
else
|
||||
CFLAGS_VISIBILITY=""
|
||||
CXXFLAGS_VISIBILITY=""
|
||||
|
80
configure
vendored
80
configure
vendored
@@ -35919,6 +35919,86 @@ echo "${ECHO_T}$wx_cv_cc_visibility" >&6; }
|
||||
#define HAVE_VISIBILITY 1
|
||||
_ACEOF
|
||||
|
||||
|
||||
{ echo "$as_me:$LINENO: checking for broken libstdc++ visibility" >&5
|
||||
echo $ECHO_N "checking for broken libstdc++ visibility... $ECHO_C" >&6; }
|
||||
if test "${wx_cv_cc_broken_libstdcxx_visibility+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
|
||||
wx_save_CXXFLAGS="$CXXFLAGS"
|
||||
CXXFLAGS="$CXXFLAGS $CXXFLAGS_VISIBILITY"
|
||||
ac_ext=cpp
|
||||
ac_cpp='$CXXCPP $CPPFLAGS'
|
||||
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
||||
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
|
||||
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
|
||||
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
|
||||
#include <string>
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
|
||||
std::string x;
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext conftest$ac_exeext
|
||||
if { (ac_try="$ac_link"
|
||||
case "(($ac_try" in
|
||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
*) ac_try_echo=$ac_try;;
|
||||
esac
|
||||
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
|
||||
(eval "$ac_link") 2>conftest.er1
|
||||
ac_status=$?
|
||||
grep -v '^ *+' conftest.er1 >conftest.err
|
||||
rm -f conftest.er1
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } && {
|
||||
test -z "$ac_cxx_werror_flag" ||
|
||||
test ! -s conftest.err
|
||||
} && test -s conftest$ac_exeext &&
|
||||
$as_test_x conftest$ac_exeext; then
|
||||
wx_cv_cc_broken_libstdcxx_visibility=no
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
wx_cv_cc_broken_libstdcxx_visibility=yes
|
||||
fi
|
||||
|
||||
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
ac_ext=c
|
||||
ac_cpp='$CPP $CPPFLAGS'
|
||||
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
||||
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
|
||||
ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
||||
|
||||
CXXFLAGS="$wx_save_CXXFLAGS"
|
||||
fi
|
||||
|
||||
{ echo "$as_me:$LINENO: result: $wx_cv_cc_broken_libstdcxx_visibility" >&5
|
||||
echo "${ECHO_T}$wx_cv_cc_broken_libstdcxx_visibility" >&6; }
|
||||
if test $wx_cv_cc_broken_libstdcxx_visibility = yes; then
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define HAVE_BROKEN_LIBSTDCXX_VISIBILITY 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
|
||||
else
|
||||
CFLAGS_VISIBILITY=""
|
||||
CXXFLAGS_VISIBILITY=""
|
||||
|
@@ -46,3 +46,7 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// see beforestd.h for explanation
|
||||
#if defined(HAVE_VISIBILITY) && defined(HAVE_BROKEN_LIBSTDCXX_VISIBILITY)
|
||||
#pragma GCC visibility pop
|
||||
#endif
|
||||
|
@@ -63,3 +63,13 @@
|
||||
#pragma warning(disable:4786)
|
||||
#endif // VC++ < 7
|
||||
|
||||
/**
|
||||
GCC's visibility support is broken for libstdc++ in some older versions
|
||||
(namely Debian/Ubuntu's GCC 4.1, see
|
||||
https://bugs.launchpad.net/ubuntu/+source/gcc-4.1/+bug/109262). We fix it
|
||||
here by mimicking newer versions' behaviour of using default visibility
|
||||
for libstdc++ code.
|
||||
*/
|
||||
#if defined(HAVE_VISIBILITY) && defined(HAVE_BROKEN_LIBSTDCXX_VISIBILITY)
|
||||
#pragma GCC visibility push(default)
|
||||
#endif
|
||||
|
@@ -11,12 +11,16 @@
|
||||
|
||||
#if wxUSE_STD_IOSTREAM
|
||||
|
||||
#include "wx/beforestd.h"
|
||||
|
||||
#if wxUSE_IOSTREAMH
|
||||
# include <iostream.h>
|
||||
#else
|
||||
# include <iostream>
|
||||
#endif
|
||||
|
||||
#include "wx/afterstd.h"
|
||||
|
||||
#ifdef __WXMSW__
|
||||
# include "wx/msw/winundef.h"
|
||||
#endif
|
||||
|
@@ -673,6 +673,11 @@
|
||||
*/
|
||||
#undef HAVE_VISIBILITY
|
||||
|
||||
/*
|
||||
* Define if compiler's visibility support in libstdc++ is broken
|
||||
*/
|
||||
#undef HAVE_BROKEN_LIBSTDCXX_VISIBILITY
|
||||
|
||||
/*
|
||||
* The built-in regex supports advanced REs in additional to POSIX's basic
|
||||
* and extended. Your system regex probably won't support this, and in this
|
||||
|
Reference in New Issue
Block a user