OSDN Git Service

android: Fix build with bionic.
authorChia-I Wu <olv@lunarg.com>
Sun, 26 Sep 2010 16:19:43 +0000 (00:19 +0800)
committerChia-I Wu <olvaffe@gmail.com>
Wed, 16 Mar 2011 12:18:39 +0000 (20:18 +0800)
src/gallium/auxiliary/os/os_thread.h
src/gallium/auxiliary/util/u_math.h
src/gallium/include/pipe/p_compiler.h
src/gallium/include/pipe/p_config.h
src/glsl/ralloc.c
src/mesa/main/imports.c
src/mesa/main/imports.h
src/mesa/main/querymatrix.c

index 8173d4c..3ad7ce6 100644 (file)
@@ -307,7 +307,7 @@ typedef int64_t pipe_condvar;
  * pipe_barrier
  */
 
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_HAIKU) || defined(PIPE_OS_EMBEDDED)
+#if (defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_HAIKU) || defined(PIPE_OS_EMBEDDED)) && !defined(PIPE_OS_ANDROID)
 
 typedef pthread_barrier_t pipe_barrier;
 
index e3d4c06..0065356 100644 (file)
@@ -199,6 +199,16 @@ roundf(float x)
 #endif /* _MSC_VER */
 
 
+#ifdef PIPE_OS_ANDROID
+
+static INLINE
+double log2(double d)
+{
+   return log(d) / M_LN2;
+}
+
+#endif
+
 
 
 
index 3441db6..ec9f105 100644 (file)
@@ -67,7 +67,9 @@ extern "C" {
 
 
 #if !defined(__HAIKU__) && !defined(__USE_MISC)
+#if !defined(PIPE_OS_ANDROID)
 typedef unsigned int       uint;
+#endif
 typedef unsigned short     ushort;
 #endif
 typedef unsigned char      ubyte;
index 74a1fa2..988430c 100644 (file)
 #define PIPE_OS_UNIX
 #endif
 
+/*
+ * Android defines __linux__ so PIPE_OS_LINUX and PIPE_OS_UNIX will also be
+ * defined.
+ */
+#if defined(ANDROID)
+#define PIPE_OS_ANDROID
+#endif
+
 #if defined(__FreeBSD__)
 #define PIPE_OS_FREEBSD
 #define PIPE_OS_BSD
index 6a5eac6..757ab5c 100644 (file)
 #endif
 #endif
 
+#ifdef ANDROID
+#define SIZE_MAX UINT32_MAX
+#endif
+
 #define CANARY 0x5A1106
 
 struct ralloc_header
index bf89815..2ff21fa 100644 (file)
@@ -753,7 +753,7 @@ _mesa_strdup( const char *s )
 float
 _mesa_strtof( const char *s, char **end )
 {
-#if defined(_GNU_SOURCE) && !defined(__CYGWIN__) && !defined(__FreeBSD__)
+#if defined(_GNU_SOURCE) && !defined(__CYGWIN__) && !defined(__FreeBSD__) && !defined(ANDROID)
    static locale_t loc = NULL;
    if (!loc) {
       loc = newlocale(LC_CTYPE_MASK, "C", NULL);
index ce7baab..7c990a4 100644 (file)
@@ -116,6 +116,7 @@ typedef union { GLfloat f; GLint i; } fi_type;
 #endif
 
 
+
 /**
  * \name Work-arounds for platforms that lack C99 math functions
  */
@@ -134,7 +135,13 @@ typedef union { GLfloat f; GLint i; } fi_type;
 #define exp2f(f) ((float) exp2(f))
 #define floorf(f) ((float) floor(f))
 #define logf(f) ((float) log(f))
+
+#ifdef ANDROID
+#define log2f(f) ((float) (log(f) / M_LN2))
+#else
 #define log2f(f) ((float) log2(f))
+#endif
+
 #define powf(x,y) ((float) pow(x,y))
 #define sinf(f) ((float) sin(f))
 #define sinhf(f) ((float) sinh(f))
index 944ad43..11c7b06 100644 (file)
@@ -73,7 +73,8 @@ fpclassify(double x)
 #elif defined(__APPLE__) || defined(__CYGWIN__) || defined(__FreeBSD__) || \
      defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || \
      (defined(__sun) && defined(__C99FEATURES__)) || defined(__MINGW32__) || \
-     (defined(__sun) && defined(__GNUC__))
+     (defined(__sun) && defined(__GNUC__)) || \
+     defined(ANDROID)
 
 /* fpclassify is available. */