summaryrefslogtreecommitdiff
path: root/acinclude.m4
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <wakeroid@gmail.com>2009-09-13 10:13:43 +0200
committerGravatar Alexey Yakovenko <wakeroid@gmail.com>2009-09-13 10:13:43 +0200
commit9af0aa32c1e32e7ac841c624e0c4f383430e2efd (patch)
treea281840577f9732c843bb63e844cf3cda5e46580 /acinclude.m4
parentea5dabc28a719e57b59ea0852f89cb0002caa43b (diff)
desktop icons, launcher update, minor libsidplay2 patches
Diffstat (limited to 'acinclude.m4')
-rw-r--r--acinclude.m494
1 files changed, 83 insertions, 11 deletions
diff --git a/acinclude.m4 b/acinclude.m4
index 2fc21e91..81aeedfb 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -108,13 +108,30 @@ AC_LANG_POP([C])
])
-
# ===========================================================================
-# http://autoconf-archive.cryp.to/ax_ext.html
+# http://www.nongnu.org/autoconf-archive/ax_ext.html
# ===========================================================================
#
+# SYNOPSIS
#
-# COPYLEFT
+# AX_EXT
+#
+# DESCRIPTION
+#
+# Find supported SIMD extensions by requesting cpuid. When an SIMD
+# extension is found, the -m"simdextensionname" is added to SIMD_FLAGS
+# (only if compilator support it) (ie : if "sse2" is available "-msse2" is
+# added to SIMD_FLAGS)
+#
+# This macro calls:
+#
+# AC_SUBST(SIMD_FLAGS)
+#
+# And defines:
+#
+# HAVE_MMX / HAVE_SSE / HAVE_SSE2 / HAVE_SSE3 / HAVE_SSSE3
+#
+# LICENSE
#
# Copyright (c) 2008 Christophe Tournayre <turn3r@users.sourceforge.net>
#
@@ -124,28 +141,83 @@ AC_LANG_POP([C])
AC_DEFUN([AX_EXT],
[
- #AC_REQUIRE([AX_GCC_X86_CPUID])
+ AC_REQUIRE([AX_GCC_X86_CPUID])
AX_GCC_X86_CPUID(0x00000001)
ecx=`echo $ax_cv_gcc_x86_cpuid_0x00000001 | cut -d ":" -f 3`
edx=`echo $ax_cv_gcc_x86_cpuid_0x00000001 | cut -d ":" -f 4`
-
if test "x$edx" = "xunknown"; then
+ ax_have_mmx_ext=no
+ ax_have_sse_ext=no
+ ax_have_sse_ext=no
ax_have_sse2_ext=no
-
+ ax_have_sse3_ext=no
+ ax_have_ssse3_ext=no
else
- AC_CACHE_CHECK([whether sse2 is supported], [ax_have_sse2_ext],
+
+ AC_CACHE_CHECK([whether mmx is supported], [ax_have_mmx_ext],
+ [
+ ax_have_mmx_ext=no
+ if test "$((0x$edx>>23&0x01))" = 1; then
+ ax_have_mmx_ext=yes
+ fi
+ ])
+
+ AC_CACHE_CHECK([whether sse is supported], [ax_have_sse_ext],
+ [
+ ax_have_sse_ext=no
+ if test "$((0x$edx>>25&0x01))" = 1; then
+ ax_have_sse_ext=yes
+ fi
+ ])
+
+ AC_CACHE_CHECK([whether sse2 is supported], [ax_have_sse2_ext],
[
ax_have_sse2_ext=no
if test "$((0x$edx>>26&0x01))" = 1; then
ax_have_sse2_ext=yes
fi
])
- fi
- if test "$ax_have_sse2_ext" = yes; then
- AC_DEFINE(HAVE_SSE2, , [Support SSE2 (Streaming SIMD Extensions 2) instructions])
- AX_CHECK_COMPILER_FLAGS(-msse2, SIMD_FLAGS="$SIMD_FLAGS -msse2", [])
+ AC_CACHE_CHECK([whether sse3 is supported], [ax_have_sse3_ext],
+ [
+ ax_have_sse3_ext=no
+ if test "$((0x$ecx&0x01))" = 1; then
+ ax_have_sse3_ext=yes
+ fi
+ ])
+
+ AC_CACHE_CHECK([whether ssse3 is supported], [ax_have_ssse3_ext],
+ [
+ ax_have_ssse3_ext=no
+ if test "$((0x$ecx>>9&0x01))" = 1; then
+ ax_have_ssse3_ext=yes
+ fi
+ ])
+
+ if test "$ax_have_mmx_ext" = yes; then
+ AC_DEFINE(HAVE_MMX,,[Support mmx instructions])
+ AX_CHECK_COMPILER_FLAGS(-mmmx, SIMD_FLAGS="$SIMD_FLAGS -mmmx", [])
+ fi
+
+ if test "$ax_have_sse_ext" = yes; then
+ AC_DEFINE(HAVE_SSE,,[Support SSE (Streaming SIMD Extensions) instructions])
+ AX_CHECK_COMPILER_FLAGS(-msse, SIMD_FLAGS="$SIMD_FLAGS -msse", [])
+ fi
+
+ if test "$ax_have_sse2_ext" = yes; then
+ AC_DEFINE(HAVE_SSE2,,[Support SSE2 (Streaming SIMD Extensions 2) instructions])
+ AX_CHECK_COMPILER_FLAGS(-msse2, SIMD_FLAGS="$SIMD_FLAGS -msse2", [])
+ fi
+
+ if test "$ax_have_sse3_ext" = yes; then
+ AC_DEFINE(HAVE_SSE3,,[Support SSE3 (Streaming SIMD Extensions 3) instructions])
+ AX_CHECK_COMPILER_FLAGS(-msse3, SIMD_FLAGS="$SIMD_FLAGS -msse3", [])
+ fi
+
+ if test "$ax_have_ssse3_ext" = yes; then
+ AC_DEFINE(HAVE_SSSE3,,[Support SSSE3 (Supplemental Streaming SIMD Extensions 3) instructions])
+ fi
fi
AC_SUBST(SIMD_FLAGS)