Fixed building with pthreads and the pth library
--HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40416
This commit is contained in:
parent
151ff4a5c6
commit
9d7dc6149a
2 changed files with 18 additions and 6 deletions
14
configure.in
14
configure.in
|
@ -1138,8 +1138,6 @@ CheckPTHREAD()
|
||||||
AC_ARG_ENABLE(pthread-sem,
|
AC_ARG_ENABLE(pthread-sem,
|
||||||
[ --enable-pthread-sem use pthread semaphores [default=yes]],
|
[ --enable-pthread-sem use pthread semaphores [default=yes]],
|
||||||
, enable_pthread_sem=yes)
|
, enable_pthread_sem=yes)
|
||||||
ac_save_cflags="$CFLAGS"
|
|
||||||
ac_save_libs="$LIBS"
|
|
||||||
case "$target" in
|
case "$target" in
|
||||||
*-*-bsdi*)
|
*-*-bsdi*)
|
||||||
pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
|
pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
|
||||||
|
@ -1187,9 +1185,12 @@ CheckPTHREAD()
|
||||||
pthread_lib="-lpthread"
|
pthread_lib="-lpthread"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
CFLAGS="$CFLAGS $pthread_cflags"
|
|
||||||
LIBS="$LIBS $pthread_lib"
|
|
||||||
if test x$enable_threads = xyes -a x$enable_pthreads = xyes; then
|
if test x$enable_threads = xyes -a x$enable_pthreads = xyes; then
|
||||||
|
# Save the original compiler flags and libraries
|
||||||
|
ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
|
||||||
|
# Add the pthread compiler flags and libraries
|
||||||
|
CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
|
||||||
|
# Check to see if we have pthread support on this system
|
||||||
AC_MSG_CHECKING(for pthreads)
|
AC_MSG_CHECKING(for pthreads)
|
||||||
use_pthreads=no
|
use_pthreads=no
|
||||||
AC_TRY_LINK([
|
AC_TRY_LINK([
|
||||||
|
@ -1201,6 +1202,9 @@ CheckPTHREAD()
|
||||||
use_pthreads=yes
|
use_pthreads=yes
|
||||||
])
|
])
|
||||||
AC_MSG_RESULT($use_pthreads)
|
AC_MSG_RESULT($use_pthreads)
|
||||||
|
# Restore the compiler flags and libraries
|
||||||
|
CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
|
||||||
|
# Do futher testing if we have pthread support...
|
||||||
if test x$use_pthreads = xyes; then
|
if test x$use_pthreads = xyes; then
|
||||||
CFLAGS="$CFLAGS $pthread_cflags -DSDL_USE_PTHREADS"
|
CFLAGS="$CFLAGS $pthread_cflags -DSDL_USE_PTHREADS"
|
||||||
SDL_CFLAGS="$SDL_CFLAGS $pthread_cflags"
|
SDL_CFLAGS="$SDL_CFLAGS $pthread_cflags"
|
||||||
|
@ -1269,8 +1273,6 @@ CheckPTHREAD()
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
CFLAGS="$ac_save_cflags"
|
|
||||||
LIBS="$ac_save_libs"
|
|
||||||
|
|
||||||
AC_MSG_CHECKING(whether semun is defined in /usr/include/sys/sem.h)
|
AC_MSG_CHECKING(whether semun is defined in /usr/include/sys/sem.h)
|
||||||
have_semun=no
|
have_semun=no
|
||||||
|
|
|
@ -41,6 +41,9 @@ static char rcsid =
|
||||||
#if _POSIX_THREAD_SYSCALL_SOFT
|
#if _POSIX_THREAD_SYSCALL_SOFT
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef ENABLE_PTH
|
||||||
|
#include <pth.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(DISABLE_THREADS) || defined(FORK_HACK)
|
#if defined(DISABLE_THREADS) || defined(FORK_HACK)
|
||||||
#define USE_ITIMER
|
#define USE_ITIMER
|
||||||
|
@ -142,6 +145,12 @@ Uint32 SDL_GetTicks (void)
|
||||||
|
|
||||||
void SDL_Delay (Uint32 ms)
|
void SDL_Delay (Uint32 ms)
|
||||||
{
|
{
|
||||||
|
#ifdef ENABLE_PTH
|
||||||
|
pth_time_t tv;
|
||||||
|
tv.tv_sec = ms/1000;
|
||||||
|
tv.tv_usec = (ms%1000)*1000;
|
||||||
|
pth_nap(tv);
|
||||||
|
#else
|
||||||
int was_error;
|
int was_error;
|
||||||
|
|
||||||
#ifdef USE_NANOSLEEP
|
#ifdef USE_NANOSLEEP
|
||||||
|
@ -189,6 +198,7 @@ void SDL_Delay (Uint32 ms)
|
||||||
was_error = select(0, NULL, NULL, NULL, &tv);
|
was_error = select(0, NULL, NULL, NULL, &tv);
|
||||||
#endif /* USE_NANOSLEEP */
|
#endif /* USE_NANOSLEEP */
|
||||||
} while ( was_error && (errno == EINTR) );
|
} while ( was_error && (errno == EINTR) );
|
||||||
|
#endif /* ENABLE_PTH */
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_ITIMER
|
#ifdef USE_ITIMER
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue