]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
Check if compiler can compile mmx and sse2 code in configure
authorAndreas Öman <andreas@lonelycoder.com>
Wed, 6 Jan 2010 21:24:16 +0000 (21:24 +0000)
committerAndreas Öman <andreas@lonelycoder.com>
Wed, 6 Jan 2010 21:24:16 +0000 (21:24 +0000)
Makefile
configure
src/ffdecsa/ffdecsa_interface.c
src/ffdecsa/ffdecsa_mmx.c
src/ffdecsa/ffdecsa_sse2.c
support/configure.inc

index 1a492a407dbb57469756ce1ddce85a29554590fc..d4f41566b5fa88ab82924ba76acea0c340ff3efa 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -94,9 +94,10 @@ SRCS += src/cwc.c \
        src/capmt.c \
        src/krypt.c \
        src/ffdecsa/ffdecsa_interface.c \
-       src/ffdecsa/ffdecsa_int.c \
-       src/ffdecsa/ffdecsa_mmx.c \
-       src/ffdecsa/ffdecsa_sse2.c \
+       src/ffdecsa/ffdecsa_int.c
+
+SRCS-${CONFIG_MMX}  += src/ffdecsa/ffdecsa_mmx.c
+SRCS-${CONFIG_SSE2} += src/ffdecsa/ffdecsa_sse2.c
 
 LDFLAGS += -lcrypt
 
index 193314bf8622be4b3f70b9a50d07eb9a0a231c81..aecfc7a13aa095ac03178cb90a66a5fa454c0c23 100755 (executable)
--- a/configure
+++ b/configure
@@ -74,6 +74,16 @@ int main() {
 EOF
     $CC 2>/dev/null $TMPDIR/1.c -o $TMPDIR/1.bin 
 }
+
+
+checkccarg() {
+    cat >$TMPDIR/1.c <<EOF
+int main() {
+ return 0;
+}
+EOF
+    $CC 2>/dev/null $TMPDIR/1.c -o $TMPDIR/1.bin $1
+}
     
 
 if [ "x$CC" != "x" ]; then
@@ -90,6 +100,15 @@ else
     die
 fi
 
+
+if checkccarg "-mmmx"; then
+   enable mmx
+fi
+
+if checkccarg "-msse2"; then
+   enable sse2
+fi
+
 echo >>${CONFIG_MAK} $CC_CONFIG_MAK 
 
 #
index e600785a45b36163d2d5685d5e2c63f147a592d1..117fba4e85cf6dd4d27ca05b50b52f975f0bd387 100644 (file)
@@ -18,7 +18,7 @@
  *  You should have received a copy of the GNU General Public License
  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
-
+#include "config.h"
 #include "tvhead.h"
 #include "FFdecsa.h"
 
@@ -59,8 +59,11 @@ static csafuncs_t funcs_##x = { \
 };
 
 MAKEFUNCS(32int);
-#if defined(__i386__) || defined(__x86_64__)
+#ifdef CONFIG_MMX
 MAKEFUNCS(64mmx);
+#endif
+
+#ifdef CONFIG_SSE2
 MAKEFUNCS(128sse2);
 #endif
 
@@ -167,17 +170,21 @@ ffdecsa_init(void)
     if(max_std_level >= 1){
       cpuid(1, eax, ebx, ecx, std_caps);
 
+#ifdef CONFIG_SSE2
       if (std_caps & (1<<26)) {
        current = funcs_128sse2;
        tvhlog(LOG_INFO, "CSA", "Using SSE2 128bit parallel descrambling");
        return;
       }
+#endif
 
+#ifdef CONFIG_MMX
       if (std_caps & (1<<23)) {
        current = funcs_64mmx;
        tvhlog(LOG_INFO, "CSA", "Using MMX 64bit parallel descrambling");
        return;
       }
+#endif
     }
 #if defined(__i386__)
   }
index 71cdcc93ba21ef69da7181bc9d296f2e56f30a4d..bd6452c4107a4c4babac16e8ab1ed6536ff5185d 100644 (file)
@@ -1,4 +1,2 @@
-#if defined(__i386__) || defined(__x86_64__)
 #define PARALLEL_MODE PARALLEL_64_MMX
 #include "FFdecsa.c"
-#endif
index af5868a3d13153798a41503f28f0b6499ddd9d7a..b24a1e83abcab35fd90a455c5af59e0a2e2a1047 100644 (file)
@@ -1,4 +1,2 @@
-#if defined(__i386__) || defined(__x86_64__)
 #define PARALLEL_MODE PARALLEL_128_SSE2
 #include "FFdecsa.c"
-#endif
index f7671b1c519614b9f29f2c3386f81059689318eb..72df3c18c860d54a46d69097a971d9b1c713a7a1 100644 (file)
@@ -22,6 +22,8 @@ RELEASENAME=`head -n1 ${TOPDIR}/ChangeLog | awk '{print $2}' | sed s/\(// | sed
 CONFIG_LIST="
  cwc
  avahi
+ mmx
+ sse2
 "
 
 die() {