diff -ru a/configure.in b/configure.in
--- a/configure.in	Wed Nov 22 23:42:56 2006
+++ b/configure.in	Wed Nov 22 23:30:04 2006
@@ -76,6 +76,8 @@
 fi
 ])
 
+dnl check for lrintf()
+AC_SEARCH_LIBS(lrintf,m,[AC_DEFINE([HAVE_LRINTF], [1], [Define if lrintf exists])], [])
 
 MY_CHECK_TYPEDEF_FROM_INCLUDE([float32_t temp],
         [#include <sys/types.h>,
diff -ru a/libfaad/bits.h b/libfaad/bits.h
--- a/libfaad/bits.h	Wed Nov 22 23:43:10 2006
+++ b/libfaad/bits.h	Wed Nov 22 23:44:20 2006
@@ -58,7 +58,7 @@
 
 #if defined (_WIN32) && !defined(_WIN32_WCE) && !defined(__MINGW32__)
 #define BSWAP(a) __asm mov eax,a __asm bswap eax __asm mov a, eax
-#elif defined(LINUX) || defined(DJGPP) || defined(__MINGW32__)
+#elif defined(LINUX) || defined(DJGPP) || (defined(__MINGW32__) && !defined(__MINGWCE__))
 #define BSWAP(a) __asm__ ( "bswapl %0\n" : "=r" (a) : "0" (a) )
 #else
 #define BSWAP(a) \
diff -ru a/libfaad/common.h b/libfaad/common.h
--- a/libfaad/common.h	Wed Nov 22 23:43:04 2006
+++ b/libfaad/common.h	Wed Nov 22 23:45:04 2006
@@ -147,7 +147,7 @@
 
 /* END COMPILE TIME DEFINITIONS */
 
-#if defined(_WIN32) && !defined(__MINGW32__)
+#if defined(_WIN32) && !defined(__MINGW32__) && !defined(__MINGWCE__)
 
 #include <stdlib.h>
 
@@ -288,8 +288,11 @@
       *y2 = MUL_F(x2, c1) - MUL_F(x1, c2);
   }
 
-
-  #if defined(_WIN32) && !defined(__MINGW32__)
+#ifndef HAVE_LRINTF
+  #if defined(__MINGWCE__)
+  #elif defined(__MINGW32__) || defined(__APPLE__)
+    #define HAS_LRINTF
+  #elif defined(_WIN32)
     #define HAS_LRINTF
     static INLINE int lrintf(float f)
     {
@@ -315,7 +318,7 @@
         return i;
     }
   #endif
-
+#endif
 
   #ifdef __ICL /* only Intel C compiler has fmath ??? */
 
