]> git.saurik.com Git - wxWidgets.git/commitdiff
check whether compiler supports visibility pragmas used for broken libstdc++ visibili...
authorVadim Zeitlin <vadim@wxwidgets.org>
Fri, 21 Sep 2007 10:50:13 +0000 (10:50 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Fri, 21 Sep 2007 10:50:13 +0000 (10:50 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@48852 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

build/aclocal/visibility.m4
configure

index 9ee33576dcceb16774aa9576e7928e1f672b0329..52c97f9c8ef605d1f7481ceaf66e1227ecb29932 100644 (file)
@@ -64,8 +64,8 @@ AC_DEFUN([WX_VISIBILITY],
       CXXFLAGS="$wx_save_CXXFLAGS"])
     AC_MSG_RESULT([$wx_cv_cc_visibility])
     if test $wx_cv_cc_visibility = yes; then
-      AC_DEFINE([HAVE_VISIBILITY])
-
+      dnl we do have basic visibility support, now check if we can use it:
+      dnl
       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])
@@ -89,10 +89,39 @@ AC_DEFUN([WX_VISIBILITY],
         CXXFLAGS="$wx_save_CXXFLAGS"
         LDFLAGS="$wx_save_LDFLAGS"])
       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])
+        AC_MSG_CHECKING([whether we can work around it])
+        AC_CACHE_VAL(wx_cv_cc_visibility_workaround, [
+          AC_LANG_PUSH(C++)
+          AC_TRY_LINK(
+            [
+              #pragma GCC visibility push(default)
+              #include <string>
+              #pragma GCC visibility pop
+            ],
+            [
+              std::string s("hello");
+              return s.length();
+            ],
+            wx_cv_cc_visibility_workaround=no,
+            wx_cv_cc_visibility_workaround=yes)
+          AC_LANG_POP()
+        ])
+        AC_MSG_RESULT([$wx_cv_cc_visibility_workaround])
+
+        if test $wx_cv_cc_visibility_workaround = no; then
+          dnl we can't use visibility at all then
+          wx_cv_cc_visibility=no
+        fi
       fi
+    fi
 
+    if test $wx_cv_cc_visibility = yes; then
+      AC_DEFINE([HAVE_VISIBILITY])
+      if test $wx_cv_cc_broken_libstdcxx_visibility = yes; then
+        AC_DEFINE([HAVE_BROKEN_LIBSTDCXX_VISIBILITY])
+      fi
     else
       CFLAGS_VISIBILITY=""
       CXXFLAGS_VISIBILITY=""
index e64618a054e0483efc4ec9277eb518c9d8c2957e..6dd327d017d8332fb36f6cfb0a816b4555687438 100755 (executable)
--- a/configure
+++ b/configure
     { echo "$as_me:$LINENO: result: $wx_cv_cc_visibility" >&5
 echo "${ECHO_T}$wx_cv_cc_visibility" >&6; }
     if test $wx_cv_cc_visibility = yes; then
-      cat >>confdefs.h <<\_ACEOF
-#define HAVE_VISIBILITY 1
-_ACEOF
-
-
-                  { echo "$as_me:$LINENO: checking for broken libstdc++ visibility" >&5
+                              { 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
 
       { 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
+        { echo "$as_me:$LINENO: checking whether we can work around it" >&5
+echo $ECHO_N "checking whether we can work around it... $ECHO_C" >&6; }
+        if test "${wx_cv_cc_visibility_workaround+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+          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.  */
+
+              #pragma GCC visibility push(default)
+              #include <string>
+              #pragma GCC visibility pop
+
+int
+main ()
+{
+
+              std::string s("hello");
+              return s.length();
+
+  ;
+  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_visibility_workaround=no
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       wx_cv_cc_visibility_workaround=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
+
+
+fi
+
+        { echo "$as_me:$LINENO: result: $wx_cv_cc_visibility_workaround" >&5
+echo "${ECHO_T}$wx_cv_cc_visibility_workaround" >&6; }
+
+        if test $wx_cv_cc_visibility_workaround = no; then
+                    wx_cv_cc_visibility=no
+        fi
+      fi
+    fi
+
+    if test $wx_cv_cc_visibility = yes; then
+      cat >>confdefs.h <<\_ACEOF
+#define HAVE_VISIBILITY 1
+_ACEOF
+
       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=""
@@ -49220,6 +49301,9 @@ if test "$wxUSE_GUI" = "yes"; then
     fi
 else
     SAMPLES_SUBDIRS="console"
+    if test "$wxUSE_SOCKETS" = "yes" ; then
+        SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS sockets"
+    fi
 fi
 
 
@@ -52983,7 +53067,12 @@ for subdir in `echo $SUBDIRS`; do
                 makefiles=`(cd $srcdir ; find $subdir -name Makefile.in) | $EGREP -v "$disabled"`
             fi
         else                                     if test ${subdir} = "samples"; then
-                makefiles="samples/Makefile.in samples/console/Makefile.in"
+                                                makefiles="samples/Makefile.in $makefiles"
+                for sample in `echo $SAMPLES_SUBDIRS`; do
+                    if test -d $srcdir/samples/$sample; then
+                        makefiles="samples/$sample/Makefile.in $makefiles"
+                    fi
+                done
             elif test ${subdir} = "utils"; then
                 makefiles=""
                 for util in HelpGen tex2rtf ; do