diff --git a/libfreerdp/primitives/CMakeLists.txt b/libfreerdp/primitives/CMakeLists.txt index 9a8827bb4..ad3c16761 100644 --- a/libfreerdp/primitives/CMakeLists.txt +++ b/libfreerdp/primitives/CMakeLists.txt @@ -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() diff --git a/libfreerdp/primitives/primitives.c b/libfreerdp/primitives/primitives.c index 3288787e6..29f6f7024 100644 --- a/libfreerdp/primitives/primitives.c +++ b/libfreerdp/primitives/primitives.c @@ -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__ diff --git a/winpr/include/winpr/thread.h b/winpr/include/winpr/thread.h index 7ecc6ec41..6f7610277 100644 --- a/winpr/include/winpr/thread.h +++ b/winpr/include/winpr/thread.h @@ -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 */ diff --git a/winpr/libwinpr/thread/process.c b/winpr/libwinpr/thread/process.c index 092773469..b5cc87858 100644 --- a/winpr/libwinpr/thread/process.c +++ b/winpr/libwinpr/thread/process.c @@ -92,7 +92,7 @@ VOID ExitProcess(UINT uExitCode) } -HANDLE GetCurrentProcess(VOID) +HANDLE _GetCurrentProcess(VOID) { return NULL; } diff --git a/winpr/libwinpr/thread/thread.c b/winpr/libwinpr/thread/thread.c index 1ed610ab2..0755bae6d 100644 --- a/winpr/libwinpr/thread/thread.c +++ b/winpr/libwinpr/thread/thread.c @@ -128,7 +128,7 @@ VOID ExitThread(DWORD dwExitCode) pthread_exit((void*) dwExitCode); } -HANDLE GetCurrentThread(VOID) +HANDLE _GetCurrentThread(VOID) { return NULL; }