use -R instead of -Wl,-rpath with Sun CC under Linux too

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46643 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2007-06-22 17:23:54 +00:00
parent e3b13be45a
commit ab595566b1

View File

@ -4132,6 +4132,11 @@ if test "$wxUSE_SHARED" = "yes"; then
dnl use versioned symbols if available on the platform dnl use versioned symbols if available on the platform
WX_VERSIONED_SYMBOLS([\$(wx_top_builddir)/version-script]) WX_VERSIONED_SYMBOLS([\$(wx_top_builddir)/version-script])
dnl test for Sun CC which can be used under both Solaris and Linux
if test "x$SUNCXX" = xyes; then
SAMPLES_RPATH_FLAG="-R\$(wx_top_builddir)/lib"
WXCONFIG_RPATH="-R\$libdir"
else
case "${host}" in case "${host}" in
*-*-linux* | *-*-gnu* ) *-*-linux* | *-*-gnu* )
SAMPLES_RPATH_FLAG="-Wl,-rpath,\$(wx_top_builddir)/lib" SAMPLES_RPATH_FLAG="-Wl,-rpath,\$(wx_top_builddir)/lib"
@ -4139,41 +4144,39 @@ if test "$wxUSE_SHARED" = "yes"; then
;; ;;
*-*-solaris2* ) *-*-solaris2* )
if test "$GCC" = yes ; then dnl here we know that Sun CC is not used as we tested for it above,
dnl newer versions of gcc need -isystem to compile X headers on dnl hence we must be using gcc
dnl Solaris (which use old style C syntax)
CPPFLAGS="-isystem /usr/openwin/include $CPPFLAGS"
dnl gcc may use Sun's ld, in which case -rpath gives a confusing dnl newer versions of gcc need -isystem to compile X headers on
dnl error message. We have to try both -Wl,-rpath and -Wl,-R: dnl Solaris (which use old style C syntax)
saveLdflags="$LDFLAGS" CPPFLAGS="-isystem /usr/openwin/include $CPPFLAGS"
LDFLAGS="$saveLdflags -Wl,-rpath,/"
AC_MSG_CHECKING([if the linker accepts -rpath]) dnl gcc may use Sun's ld, in which case -rpath gives a confusing
AC_TRY_LINK( dnl error message. We have to try both -Wl,-rpath and -Wl,-R:
[],[], saveLdflags="$LDFLAGS"
[ LDFLAGS="$saveLdflags -Wl,-rpath,/"
AC_MSG_RESULT([yes]) AC_MSG_CHECKING([if the linker accepts -rpath])
SAMPLES_RPATH_FLAG="-Wl,-rpath,\$(wx_top_builddir)/lib" AC_TRY_LINK(
WXCONFIG_RPATH="-Wl,-rpath,\$libdir" [],[],
],[ [
AC_MSG_RESULT([no]) AC_MSG_RESULT([yes])
AC_MSG_CHECKING([if the linker accepts -R]) SAMPLES_RPATH_FLAG="-Wl,-rpath,\$(wx_top_builddir)/lib"
LDFLAGS="$saveLdflags -Wl,-R,/" WXCONFIG_RPATH="-Wl,-rpath,\$libdir"
AC_TRY_LINK( ],[
[],[], AC_MSG_RESULT([no])
[ AC_MSG_CHECKING([if the linker accepts -R])
AC_MSG_RESULT([yes]) LDFLAGS="$saveLdflags -Wl,-R,/"
SAMPLES_RPATH_FLAG="-Wl,-R,\$(wx_top_builddir)/lib" AC_TRY_LINK(
WXCONFIG_RPATH="-Wl,-R,\$libdir" [],[],
],[ [
AC_MSG_RESULT([no]) AC_MSG_RESULT([yes])
]) SAMPLES_RPATH_FLAG="-Wl,-R,\$(wx_top_builddir)/lib"
]) WXCONFIG_RPATH="-Wl,-R,\$libdir"
LDFLAGS="$saveLdflags" ],[
else AC_MSG_RESULT([no])
SAMPLES_RPATH_FLAG="-R\$(wx_top_builddir)/lib" ])
WXCONFIG_RPATH="-R\$libdir" ])
fi LDFLAGS="$saveLdflags"
;; ;;
*-*-darwin* ) *-*-darwin* )
@ -4205,6 +4208,7 @@ EOF
;; ;;
esac esac
fi
if test $wxUSE_RPATH = "no"; then if test $wxUSE_RPATH = "no"; then
SAMPLES_RPATH_FLAG='' SAMPLES_RPATH_FLAG=''
@ -5262,6 +5266,10 @@ if test "$TOOLKIT" != "MSW" -a "$USE_OS2" != 1; then
dnl wouldn't be found by it dnl wouldn't be found by it
AC_CACHE_CHECK([for pthread_cleanup_push/pop], wx_cv_func_pthread_cleanup, AC_CACHE_CHECK([for pthread_cleanup_push/pop], wx_cv_func_pthread_cleanup,
[ [
dnl C compiler may treat pthread_cleanup_push() as an undeclared
dnl function and not give a warning even if it's unavailable, so use
dnl the C++ one for this test
AC_LANG_PUSH(C++)
AC_TRY_COMPILE([#include <pthread.h> AC_TRY_COMPILE([#include <pthread.h>
void ThreadCleanupFunc(void *p); void ThreadCleanupFunc(void *p);
], ],
@ -5275,6 +5283,7 @@ if test "$TOOLKIT" != "MSW" -a "$USE_OS2" != 1; then
wx_cv_func_pthread_cleanup=no wx_cv_func_pthread_cleanup=no
] ]
) )
AC_LANG_POP()
]) ])
if test "x$wx_cv_func_pthread_cleanup" = "xyes"; then if test "x$wx_cv_func_pthread_cleanup" = "xyes"; then
AC_DEFINE(wxHAVE_PTHREAD_CLEANUP) AC_DEFINE(wxHAVE_PTHREAD_CLEANUP)