quakeforge/config.d/pthread.m4
Bill Currie a2f2d4d949 "Check" for the availability of pthreads.
Unfortunately, just because the header is there doesn't mean anything will
actually work :(. Also, the check is based on the host vendor/os for now.
Yes, it's rather lame but it will do for now.

With this, QF will build on an almost fresh ps3toolchain install. Only two
"fixes" are needed:
 o  In $PS3DEV/ppu/powerpc64-ps3-elf: ln -s ../include sys-include
 o  libsamplerate cross-built and installed.
2012-08-19 13:40:42 +09:00

39 lines
1,020 B
Text

if test "x$ac_cv_header_pthread_h" = "xyes"; then
save_LIBS="$LIBS"
HAVE_PTHREAD=yes
case "$host_vendor-$host_os" in
*android*) dnl android has all pthread* functions in the libc.
;;
*ps3*) dnl ps3toolchain doesn't have a working pthread yet
HAVE_PTHREAD=no
;;
*qnx*) dnl qnx has all pthread* functions in the libc.
;;
*openbsd*)
LIBS="$LIBS -pthread"
AC_TRY_LINK(
[#include <pthread.h>],
[pthread_attr_t type;
pthread_attr_setstacksize(&type, 0x100000);],
[PTHREAD_LDFLAGS=-pthread],
[PTHREAD_LDFLAGS=-lpthread]
)
;;
*) LIBS="$LIBS -lpthread"
AC_TRY_LINK(
[#include <pthread.h>],
[pthread_attr_t type;
pthread_attr_setstacksize(&type, 0x100000);],
[PTHREAD_LDFLAGS=-lpthread],
[PTHREAD_LDFLAGS=-pthread]
)
;;
esac
LIBS="$save_LIBS"
PTHREAD_CFLAGS=-D_REENTRANT
fi
if test "x$HAVE_PTHREAD" = "xyes"; then
AC_DEFINE(HAVE_PTHREAD, 1, [Define if you have working pthread])
fi
AC_SUBST(PTHREAD_LDFLAGS)
AC_SUBST(PTHREAD_CFLAGS)