From 671fe6ffb308a6d6057084e246e08e1555140b4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig?= Date: Wed, 21 Sep 2011 12:32:44 +0000 Subject: allow to set SIMD as cmdline arg default is 'none' svn path=/trunk/externals/zexy/; revision=15333 --- src/acinclude.m4 | 34 ++++++++++++++++++++++++++++++++++ src/configure.ac | 2 +- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/src/acinclude.m4 b/src/acinclude.m4 index daf0c11..7922bc8 100644 --- a/src/acinclude.m4 +++ b/src/acinclude.m4 @@ -160,3 +160,37 @@ if test "$fat_binary" != no; then undefine([Name]) fi ])# AC_CHECK_FAT + +AC_DEFUN([AC_CHECK_SIMD], +[ +AC_ARG_ENABLE(simd, + [ --enable-simd=ARCHS + enable SIMD optimization; + valid arguments are: SSE2 + ], + [simd=$enableval], [simd=no]) +if test "$simd" != no; then + AC_MSG_CHECKING([SIMD optimization]) + + # Respect SIMD given to --enable-simd if present. + if test "$simd" != yes; then + SIMD=`echo "$simd" | tr ',' ' '` + else + # Choose a default set of architectures based upon platform. + SIMD="SSE2" + fi + AC_MSG_RESULT([$SIMD]) + + for smd in $SIMD + do + case "${smd}" in + SSE2|sse2) + AC_CHECK_CFLAGS([-mfpmath=sse -msse]) + ;; + *) + AC_MSG_RESULT([unknown SIMD instructions: ${smd}]) + ;; + esac + done +fi +])# AC_CHECK_SIMD diff --git a/src/configure.ac b/src/configure.ac index d0fc17e..f015216 100644 --- a/src/configure.ac +++ b/src/configure.ac @@ -164,7 +164,7 @@ if test "x$enable_PIC" != "xno"; then AC_CHECK_CFLAGS([-fPIC]) fi -AC_CHECK_CFLAGS([-mfpmath=sse -msse]) +AC_CHECK_SIMD dnl if we don't have $LD set, we set it to $(CC) dnl LD=${LD:=$CC} -- cgit v1.2.1