Skip to content
Snippets Groups Projects
Commit 3055166e authored by Boris Kolpackov's avatar Boris Kolpackov
Browse files

Disable SSE2 test for SunCC. Restore original CXXFLAGS if SSE2 is unusable.

git-svn-id: https://svn.apache.org/repos/asf/xerces/c/trunk@904402 13f79535-47bb-0310-9956-ffa450edef68
parent 63b79f13
No related branches found
No related tags found
No related merge requests found
...@@ -237,9 +237,9 @@ AC_SUBST([pkgconfigdir]) ...@@ -237,9 +237,9 @@ AC_SUBST([pkgconfigdir])
# Allow the user to disable the SSE2 support # Allow the user to disable the SSE2 support
# #
AC_ARG_ENABLE(sse2, AC_ARG_ENABLE(sse2,
AC_HELP_STRING([--disable-sse2],[disable SSE2 optimizations]), AC_HELP_STRING([--disable-sse2],[disable SSE2 optimizations]),
[have_sse2=${enableval}], [have_sse2=${enableval}],
[have_sse2=yes]) [have_sse2=yes])
###################################################### ######################################################
...@@ -295,7 +295,7 @@ AC_DEFINE_UNQUOTED([XERCES_XMLCH_T], [$xerces_cv_type_xmlch], [Define to the 16 ...@@ -295,7 +295,7 @@ AC_DEFINE_UNQUOTED([XERCES_XMLCH_T], [$xerces_cv_type_xmlch], [Define to the 16
AC_MSG_CHECKING([whether the compiler chokes on a placement operator delete]) AC_MSG_CHECKING([whether the compiler chokes on a placement operator delete])
AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[#include <stdlib.h> AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[#include <stdlib.h>
class XMemory class XMemory
{ {
public : public :
...@@ -315,6 +315,8 @@ AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[#include <stdlib.h> ...@@ -315,6 +315,8 @@ AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[#include <stdlib.h>
) )
if test "$have_sse2" = "yes"; then if test "$have_sse2" = "yes"; then
no_sse2_CXXFLAGS="$CXXFLAGS"
save_CXXFLAGS="$CXXFLAGS" save_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS -msse2" CXXFLAGS="$CXXFLAGS -msse2"
AC_MSG_CHECKING([whether we need to add -msse2]) AC_MSG_CHECKING([whether we need to add -msse2])
...@@ -326,18 +328,22 @@ if test "$have_sse2" = "yes"; then ...@@ -326,18 +328,22 @@ if test "$have_sse2" = "yes"; then
if test x"$msse2_ok" = xno; then if test x"$msse2_ok" = xno; then
CXXFLAGS="$save_CXXFLAGS" CXXFLAGS="$save_CXXFLAGS"
fi fi
# Sun CC option test. Currently disabled since it doesn't work. Also note
save_CXXFLAGS="$CXXFLAGS" # that Sun CC will accept -msse2 (i.e., it won't fail) but will keep issuing
CXXFLAGS="$CXXFLAGS -xarch=sse2" # warnings. So if enabled this test needs to be moved before -msse2 and if
AC_MSG_CHECKING([whether we need to add -xarch=sse2]) # it passes, then -msse2 should be skipped.
AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[#include <emmintrin.h>]], [[__m128i one;]])], #
[xarchsse2_ok=yes], # save_CXXFLAGS="$CXXFLAGS"
[xarchsse2_ok=no] # CXXFLAGS="$CXXFLAGS -xarch=sse2"
) # AC_MSG_CHECKING([whether we need to add -xarch=sse2])
AC_MSG_RESULT($xarchsse2_ok) # AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[#include <emmintrin.h>]], [[__m128i one;]])],
if test x"$xarchsse2_ok" = xno; then # [xarchsse2_ok=yes],
CXXFLAGS="$save_CXXFLAGS" # [xarchsse2_ok=no]
fi # )
# AC_MSG_RESULT($xarchsse2_ok)
# if test x"$xarchsse2_ok" = xno; then
# CXXFLAGS="$save_CXXFLAGS"
# fi
AC_MSG_CHECKING([for intrin.h usability]) AC_MSG_CHECKING([for intrin.h usability])
AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[#include <intrin.h>]], AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[#include <intrin.h>]],
...@@ -414,13 +420,20 @@ if test "$have_sse2" = "yes"; then ...@@ -414,13 +420,20 @@ if test "$have_sse2" = "yes"; then
]])], ]])],
[ [
AC_MSG_RESULT([yes]) AC_MSG_RESULT([yes])
sse2_usable=yes
AC_DEFINE_UNQUOTED([XERCES_HAVE_SSE2_INTRINSIC], 1, [Define to have SSE2 instruction used at runtime]) AC_DEFINE_UNQUOTED([XERCES_HAVE_SSE2_INTRINSIC], 1, [Define to have SSE2 instruction used at runtime])
], ],
[ [
AC_MSG_RESULT([no]) AC_MSG_RESULT([no])
sse2_usable=no
] ]
)
)
# Restore original CXXFLAGS if SSE2 is not usable.
#
if test "$sse2_usable" = "no"; then
CXXFLAGS="$no_sse2_CXXFLAGS"
fi
fi fi
AS_IF([test x$ac_cv_type_size_t = xyes], AS_IF([test x$ac_cv_type_size_t = xyes],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment