libfreerdp-primitives: fix build on Mac OS X
authorMarc-André Moreau <marcandre.moreau@gmail.com>
Sun, 20 Jan 2013 01:32:14 +0000 (20:32 -0500)
committerMarc-André Moreau <marcandre.moreau@gmail.com>
Sun, 20 Jan 2013 01:32:14 +0000 (20:32 -0500)
libfreerdp/primitives/CMakeLists.txt
libfreerdp/primitives/primitives.c
winpr/include/winpr/thread.h
winpr/libwinpr/thread/process.c
winpr/libwinpr/thread/thread.c

index 9a8827b..ad3c167 100644 (file)
@@ -80,7 +80,7 @@ endif()
 
 set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP/libfreerdp")
 
-if(BUILD_TESTING AND (NOT WIN32))
+if(BUILD_TESTING AND ((NOT WIN32) AND (NOT APPLE)))
        add_subdirectory(test)
 endif()
 
index 3288787..29f6f70 100644 (file)
@@ -61,10 +61,12 @@ static primitives_t* pPrimitives = NULL;
 #endif
 
 /* If GCC */
-# ifdef __GNUC__
+#ifdef __GNUC__
 
-# define xgetbv(_func_, _lo_, _hi_) \
+#ifdef __AVX__
+#define xgetbv(_func_, _lo_, _hi_) \
        __asm__ __volatile__ ("xgetbv" : "=a" (_lo_), "=d" (_hi_) : "c" (_func_))
+#endif
 
 static void cpuid(
        unsigned info, 
@@ -118,6 +120,7 @@ static void set_hints(primitives_hints_t* hints)
        if (c & C_BIT_SSE42)
                hints->x86_flags |= PRIM_X86_SSE42_AVAILABLE;
 
+#ifdef __AVX__
        if ((c & C_BITS_AVX) == C_BITS_AVX)
        {
                int e, f;
@@ -134,14 +137,20 @@ static void set_hints(primitives_hints_t* hints)
                }
        }
        /* TODO: AVX2: set eax=7, ecx=0, cpuid, check ebx-bit5 */
+#endif
 }
-# else
+
+#else
+
 static void set_hints(primitives_hints_t* hints)
 {
        /* x86 non-GCC:  TODO */
 }
-# endif /* __GNUC__ */
+
+#endif /* __GNUC__ */
+
 /* ------------------------------------------------------------------------- */
+
 #elif defined(__arm__) || defined(__ARM_ARCH_7A__) \
        || defined(__ARM_EABI__) || defined(__ARMEL__) || defined(ANDROID)
 #ifndef __arm__
index 7ecc6ec..6f76102 100644 (file)
@@ -107,7 +107,7 @@ WINPR_API BOOL CreateProcessAsUserW(HANDLE hToken, LPCWSTR lpApplicationName, LP
 
 WINPR_API VOID ExitProcess(UINT uExitCode);
 
-WINPR_API HANDLE GetCurrentProcess(VOID);
+WINPR_API HANDLE _GetCurrentProcess(VOID);
 WINPR_API DWORD GetCurrentProcessId(VOID);
 
 WINPR_API BOOL TerminateProcess(HANDLE hProcess, UINT uExitCode);
@@ -125,7 +125,7 @@ WINPR_API HANDLE CreateRemoteThread(HANDLE hProcess, LPSECURITY_ATTRIBUTES lpThr
 
 WINPR_API VOID ExitThread(DWORD dwExitCode);
 
-WINPR_API HANDLE GetCurrentThread(VOID);
+WINPR_API HANDLE _GetCurrentThread(VOID);
 WINPR_API DWORD GetCurrentThreadId(VOID);
 
 WINPR_API DWORD ResumeThread(HANDLE hThread);
@@ -147,6 +147,14 @@ WINPR_API LPVOID TlsGetValue(DWORD dwTlsIndex);
 WINPR_API BOOL TlsSetValue(DWORD dwTlsIndex, LPVOID lpTlsValue);
 WINPR_API BOOL TlsFree(DWORD dwTlsIndex);
 
+#else
+
+/*
+ * GetCurrentProcess / GetCurrentThread cause a conflict on Mac OS X
+ */
+#define _GetCurrentProcess     GetCurrentProcess
+#define _GetCurrentThread      GetCurrentThread
+
 #endif
 
 #endif /* WINPR_THREAD_H */
index 0927734..b5cc878 100644 (file)
@@ -92,7 +92,7 @@ VOID ExitProcess(UINT uExitCode)
 
 }
 
-HANDLE GetCurrentProcess(VOID)
+HANDLE _GetCurrentProcess(VOID)
 {
        return NULL;
 }
index 1ed610a..0755bae 100644 (file)
@@ -128,7 +128,7 @@ VOID ExitThread(DWORD dwExitCode)
        pthread_exit((void*) dwExitCode);
 }
 
-HANDLE GetCurrentThread(VOID)
+HANDLE _GetCurrentThread(VOID)
 {
        return NULL;
 }