]> git.saurik.com Git - wxWidgets.git/commitdiff
Test for --version-script bug, known to be in at least ld 2.11.2 on netbsd and openbsd.
authorMichael Wetherell <mike.wetherell@ntlworld.com>
Fri, 22 Apr 2005 12:30:38 +0000 (12:30 +0000)
committerMichael Wetherell <mike.wetherell@ntlworld.com>
Fri, 22 Apr 2005 12:30:38 +0000 (12:30 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33819 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

acinclude.m4
aclocal.m4
configure

index 65ad9e93d8cd9b5b3f4a8f7bdd384663a7f458b3..1a43281a7193baf013c51a389f9420a2e9dbcee1 100644 (file)
@@ -437,7 +437,44 @@ AC_DEFUN([WX_VERSIONED_SYMBOLS],
         else
           wx_cv_version_script=no
         fi
+
+        dnl There's a problem in some old linkers with --version-script that
+        dnl can cause linking to fail when you have objects with vtables in
+        dnl libs 3 deep.  This is known to happen in netbsd and openbsd with
+        dnl ld 2.11.2.
+        dnl 
+        dnl To test for this we need to make some shared libs and
+        dnl unfortunately we can't be sure of the right way to do that. If the
+        dnl first two compiles don't succeed then it looks like the test isn't
+        dnl working and the result is ignored, but if OTOH the first two
+        dnl succeed but the third does not then the bug has been detected and
+        dnl the --version-script flag is dropped.
+        if test $wx_cv_version_script = yes
+        then
+          echo "struct B { virtual ~B() { } }; \
+                struct D : public B { }; \
+                void F() { D d; }" > conftest.cpp
+
+          if AC_TRY_COMMAND([
+                $CXX -shared -fPIC -o conftest1.output $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.cpp
+                -Wl,--version-script,conftest.sym >/dev/null 2>/dev/null]) &&
+             AC_TRY_COMMAND([
+                $CXX -shared -fPIC -o conftest2.output $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.cpp
+                -Wl,--version-script,conftest.sym conftest1.output >/dev/null 2>/dev/null])
+          then
+            if AC_TRY_COMMAND([
+                  $CXX -shared -fPIC -o conftest3.output $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.cpp
+                  -Wl,--version-script,conftest.sym conftest2.output conftest1.output >/dev/null 2>/dev/null])
+            then
+              wx_cv_version_script=yes
+            else
+              wx_cv_version_script=no
+            fi
+          fi
+        fi
+
         rm -f conftest.output conftest.stderr conftest.sym conftest.cpp
+        rm -f conftest1.output conftest2.output conftest3.output
       ])
       if test $wx_cv_version_script = yes ; then
         LDFLAGS_VERSIONING="-Wl,--version-script,$1"
index 6fb554895132acd7cd0bc22cf1d1a125c07f2de5..02978ca96f7b13defb251ad1de00123407471764 100644 (file)
@@ -450,7 +450,44 @@ AC_DEFUN([WX_VERSIONED_SYMBOLS],
         else
           wx_cv_version_script=no
         fi
+
+        dnl There's a problem in some old linkers with --version-script that
+        dnl can cause linking to fail when you have objects with vtables in
+        dnl libs 3 deep.  This is known to happen in netbsd and openbsd with
+        dnl ld 2.11.2.
+        dnl 
+        dnl To test for this we need to make some shared libs and
+        dnl unfortunately we can't be sure of the right way to do that. If the
+        dnl first two compiles don't succeed then it looks like the test isn't
+        dnl working and the result is ignored, but if OTOH the first two
+        dnl succeed but the third does not then the bug has been detected and
+        dnl the --version-script flag is dropped.
+        if test $wx_cv_version_script = yes
+        then
+          echo "struct B { virtual ~B() { } }; \
+                struct D : public B { }; \
+                void F() { D d; }" > conftest.cpp
+
+          if AC_TRY_COMMAND([
+                $CXX -shared -fPIC -o conftest1.output $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.cpp
+                -Wl,--version-script,conftest.sym >/dev/null 2>/dev/null]) &&
+             AC_TRY_COMMAND([
+                $CXX -shared -fPIC -o conftest2.output $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.cpp
+                -Wl,--version-script,conftest.sym conftest1.output >/dev/null 2>/dev/null])
+          then
+            if AC_TRY_COMMAND([
+                  $CXX -shared -fPIC -o conftest3.output $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.cpp
+                  -Wl,--version-script,conftest.sym conftest2.output conftest1.output >/dev/null 2>/dev/null])
+            then
+              wx_cv_version_script=yes
+            else
+              wx_cv_version_script=no
+            fi
+          fi
+        fi
+
         rm -f conftest.output conftest.stderr conftest.sym conftest.cpp
+        rm -f conftest1.output conftest2.output conftest3.output
       ])
       if test $wx_cv_version_script = yes ; then
         LDFLAGS_VERSIONING="-Wl,--version-script,$1"
index f90aa33c0df443763388c52b36a22735e705d31d..09504b3a7c204a81de74f9ce13de2d1425a76362 100755 (executable)
--- a/configure
+++ b/configure
@@ -29332,7 +29332,48 @@ else
         else
           wx_cv_version_script=no
         fi
+
+                                                                                                if test $wx_cv_version_script = yes
+        then
+          echo "struct B { virtual ~B() { } }; \
+                struct D : public B { }; \
+                void F() { D d; }" > conftest.cpp
+
+          if { ac_try='
+                $CXX -shared -fPIC -o conftest1.output $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.cpp
+                -Wl,--version-script,conftest.sym >/dev/null 2>/dev/null'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+             { ac_try='
+                $CXX -shared -fPIC -o conftest2.output $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.cpp
+                -Wl,--version-script,conftest.sym conftest1.output >/dev/null 2>/dev/null'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }
+          then
+            if { ac_try='
+                  $CXX -shared -fPIC -o conftest3.output $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.cpp
+                  -Wl,--version-script,conftest.sym conftest2.output conftest1.output >/dev/null 2>/dev/null'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }
+            then
+              wx_cv_version_script=yes
+            else
+              wx_cv_version_script=no
+            fi
+          fi
+        fi
+
         rm -f conftest.output conftest.stderr conftest.sym conftest.cpp
+        rm -f conftest1.output conftest2.output conftest3.output
 
 fi
 echo "$as_me:$LINENO: result: $wx_cv_version_script" >&5