comparison configure.in @ 1324:42e95163d553

Favor using pthread_mutexattr_settype() on Linux.
author Sam Lantinga <slouken@libsdl.org>
date Fri, 03 Feb 2006 06:33:54 +0000
parents a557f907de1e
children 450721ad5436
comparison
equal deleted inserted replaced
1323:be736c197ceb 1324:42e95163d553
1199 dnl This is used on Linux for glibc binary compatibility (Doh!) 1199 dnl This is used on Linux for glibc binary compatibility (Doh!)
1200 AC_ARG_ENABLE(pthread-sem, 1200 AC_ARG_ENABLE(pthread-sem,
1201 [ --enable-pthread-sem use pthread semaphores [default=yes]], 1201 [ --enable-pthread-sem use pthread semaphores [default=yes]],
1202 , enable_pthread_sem=yes) 1202 , enable_pthread_sem=yes)
1203 case "$target" in 1203 case "$target" in
1204 *-*-linux*)
1205 pthread_cflags="-D_REENTRANT -D_GNU_SOURCE"
1206 pthread_lib="-lpthread"
1207 ;;
1204 *-*-bsdi*) 1208 *-*-bsdi*)
1205 pthread_cflags="-D_REENTRANT -D_THREAD_SAFE" 1209 pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
1206 pthread_lib="" 1210 pthread_lib=""
1207 ;; 1211 ;;
1208 *-*-darwin*) 1212 *-*-darwin*)
1286 SDL_LIBS="$SDL_LIBS $pthread_lib" 1290 SDL_LIBS="$SDL_LIBS $pthread_lib"
1287 1291
1288 # Check to see if recursive mutexes are available 1292 # Check to see if recursive mutexes are available
1289 AC_MSG_CHECKING(for recursive mutexes) 1293 AC_MSG_CHECKING(for recursive mutexes)
1290 has_recursive_mutexes=no 1294 has_recursive_mutexes=no
1291 AC_TRY_LINK([ 1295 if test x$has_recursive_mutexes = xno; then
1292 #include <pthread.h> 1296 AC_TRY_COMPILE([
1293 ],[ 1297 #include <pthread.h>
1294 pthread_mutexattr_t attr; 1298 ],[
1295 #if defined(linux) && !(defined(__arm__) && defined(QWS)) 1299 pthread_mutexattr_t attr;
1296 pthread_mutexattr_setkind_np(&attr, PTHREAD_MUTEX_RECURSIVE_NP); 1300 pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
1297 #else 1301 ],[
1298 pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); 1302 has_recursive_mutexes=yes
1299 #endif 1303 CFLAGS="$CFLAGS -DPTHREAD_RECURSIVE_MUTEX"
1300 ],[ 1304 ])
1301 has_recursive_mutexes=yes 1305 fi
1302 ]) 1306 if test x$has_recursive_mutexes = xno; then
1303 # Some systems have broken recursive mutex implementations 1307 AC_TRY_COMPILE([
1304 case "$target" in 1308 #include <pthread.h>
1305 *-*-darwin*) 1309 ],[
1306 has_recursive_mutexes=no 1310 pthread_mutexattr_t attr;
1307 ;; 1311 pthread_mutexattr_setkind_np(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
1308 *-*-solaris*) 1312 ],[
1309 has_recursive_mutexes=no 1313 has_recursive_mutexes=yes
1310 ;; 1314 CFLAGS="$CFLAGS -DPTHREAD_RECURSIVE_MUTEX_NP"
1311 esac 1315 ])
1316 fi
1312 AC_MSG_RESULT($has_recursive_mutexes) 1317 AC_MSG_RESULT($has_recursive_mutexes)
1313 if test x$has_recursive_mutexes != xyes; then 1318 if test x$has_recursive_mutexes = xno; then
1314 CFLAGS="$CFLAGS -DPTHREAD_NO_RECURSIVE_MUTEX" 1319 CFLAGS="$CFLAGS -DPTHREAD_NO_RECURSIVE_MUTEX"
1315 fi 1320 fi
1316 1321
1317 # Check to see if pthread semaphore support is missing 1322 # Check to see if pthread semaphore support is missing
1318 if test x$enable_pthread_sem = xyes; then 1323 if test x$enable_pthread_sem = xyes; then