From 33fad0e636d7b43a9d37595ce045318c67457e7a Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Mon, 23 Mar 2015 20:10:08 -0400 Subject: [PATCH] SDL-1.2: Fixed recursive mutexes on Linux (thanks, Ozkan!). --- configure.in | 6 ++++-- src/thread/pthread/SDL_sysmutex.c | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/configure.in b/configure.in index dfae09947..b75fae20f 100644 --- a/configure.in +++ b/configure.in @@ -2022,7 +2022,8 @@ AC_HELP_STRING([--enable-pthread-sem], [use pthread semaphores [[default=yes]]]) AC_MSG_CHECKING(for recursive mutexes) has_recursive_mutexes=no if test x$has_recursive_mutexes = xno; then - AC_TRY_COMPILE([ + AC_TRY_LINK([ + #define _GNU_SOURCE 1 #include ],[ pthread_mutexattr_t attr; @@ -2033,7 +2034,8 @@ AC_HELP_STRING([--enable-pthread-sem], [use pthread semaphores [[default=yes]]]) ]) fi if test x$has_recursive_mutexes = xno; then - AC_TRY_COMPILE([ + AC_TRY_LINK([ + #define _GNU_SOURCE 1 #include ],[ pthread_mutexattr_t attr; diff --git a/src/thread/pthread/SDL_sysmutex.c b/src/thread/pthread/SDL_sysmutex.c index c3b8ce2c3..4b3063831 100644 --- a/src/thread/pthread/SDL_sysmutex.c +++ b/src/thread/pthread/SDL_sysmutex.c @@ -21,6 +21,9 @@ */ #include "SDL_config.h" +#ifndef _GNU_SOURCE +#define _GNU_SOURCE +#endif #include #include "SDL_thread.h"