diff options
author | Chris Liddell <chris.liddell@artifex.com> | 2013-06-19 08:53:01 +0100 |
---|---|---|
committer | Chris Liddell <chris.liddell@artifex.com> | 2013-06-19 08:53:01 +0100 |
commit | 1c9ac1bc3caaad5d2ea9e277d1b89a5c56b31c5c (patch) | |
tree | 053ccdfc69d25f5ca177a46cb47ed8be98ccde0f | |
parent | fea396d5d3202bf3c6b1207b5c8a17b979d0bb4f (diff) | |
download | ghostpdl-1c9ac1bc3caaad5d2ea9e277d1b89a5c56b31c5c.tar.gz |
Bug 694357: allow override of gcc's __SSE__ define
OpenJPEG uses gcc's "built-in" preprocessor define of __SSE__ to determine
whether to use its SSE2 code. As we have a configure option to disable SSE2
use in Ghostscript, that option now also overrides the gcc define thus
disabling SSE2 in OpenJPEG, too.
This currently only works for gcc.
No cluster differences.
-rw-r--r-- | gs/configure.ac | 78 |
1 files changed, 43 insertions, 35 deletions
diff --git a/gs/configure.ac b/gs/configure.ac index 230ac0191..2224ffc36 100644 --- a/gs/configure.ac +++ b/gs/configure.ac @@ -286,6 +286,39 @@ else fi fi +dnl -------------------------------------------------- +dnl check for sse2 intrinsics +dnl -------------------------------------------------- + +AC_MSG_CHECKING([sse2 support]) +save_cflags=$CFLAGS +CFLAGS="$CFLAGS $OPT_CFLAGS" + +HAVE_SSE2="" +AC_LINK_IFELSE( + [AC_LANG_PROGRAM([#include <emmintrin.h>], [ + __m128i input1; + unsigned char buf1[[128]]; + input1 = _mm_loadu_si128((const __m128i *)buf1); + return(0); + ])], + [HAVE_SSE2="-DHAVE_SSE2"], [HAVE_SSE2=""]) + +AC_ARG_ENABLE([sse2], AC_HELP_STRING([--disable-sse2], + [Do not use sse2 instrinsics]), [ + if test "x$enable_sse2" = xno; then + HAVE_SSE2="" + fi]) + +if test "x$HAVE_SSE2" != x; then + AC_MSG_RESULT(yes) +else + AC_MSG_RESULT(no) +fi + +AC_SUBST(HAVE_SSE2) +CFLAGS=$save_cflags + dnl -------------------------------------------------- dnl Enable thread safe build @@ -1313,6 +1346,14 @@ fi OPENJPEGDIR=$srcdir/openjpeg +JPX_SSE_CFLAGS="" + +if test "x$HAVE_SSE2" = "x" ; then + if test $ac_cv_prog_gcc = yes; then + JPX_SSE_CFLAGS="-U__SSE__" + fi +fi + AC_ARG_ENABLE([openjpeg], AC_HELP_STRING([--disable-openjpeg], [Do not use OpenJPEG for JPX decoding])) @@ -1327,9 +1368,9 @@ if test "x$JPX_DECODER" = "x"; then AC_CHECK_FUNCS([memalign], [have_memalign=1]) if test "x$have_memalign" = "x1"; then - JPX_AUTOCONF_CFLAGS="-DUSE_OPENJPEG_JP2" + JPX_AUTOCONF_CFLAGS="-DUSE_OPENJPEG_JP2 $JPX_SSE_CFLAGS" else - JPX_AUTOCONF_CFLAGS="-DUSE_OPENJPEG_JP2 -D\"memalign(a,b)=malloc(b)\"" + JPX_AUTOCONF_CFLAGS="-DUSE_OPENJPEG_JP2 $JPX_SSE_CFLAGS -D\"memalign(a,b)=malloc(b)\"" fi JPXDEVS='$(PSD)jpx.dev' @@ -2001,39 +2042,6 @@ AC_CHECK_FUNC([sqrtf], [SQRTF_SUBST=], [SQRTF_SUBST="-Dsqrtf=\"(float)sqrt\""]) AC_SUBST(SQRTF_SUBST) dnl -------------------------------------------------- -dnl check for sse2 intrinsics -dnl -------------------------------------------------- - -AC_MSG_CHECKING([sse2 support]) -save_cflags=$CFLAGS -CFLAGS="$CFLAGS $OPT_CFLAGS" - -HAVE_SSE2="" -AC_LINK_IFELSE( - [AC_LANG_PROGRAM([#include <emmintrin.h>], [ - __m128i input1; - unsigned char buf1[[128]]; - input1 = _mm_loadu_si128((const __m128i *)buf1); - return(0); - ])], - [HAVE_SSE2="-DHAVE_SSE2"], [HAVE_SSE2=""]) - -AC_ARG_ENABLE([sse2], AC_HELP_STRING([--disable-sse2], - [Do not use sse2 instrinsics]), [ - if test "x$enable_sse2" = xno; then - HAVE_SSE2="" - fi]) - -if test "x$HAVE_SSE2" != x; then - AC_MSG_RESULT(yes) -else - AC_MSG_RESULT(no) -fi - -AC_SUBST(HAVE_SSE2) -CFLAGS=$save_cflags - -dnl -------------------------------------------------- dnl check for byte swap intrinsics dnl -------------------------------------------------- AC_MSG_CHECKING([byteswap support]) |