1if test "x$ac_cv_header_pthread_h" = "xyes"; then
2	save_LIBS="$LIBS"
3	HAVE_PTHREAD=yes
4	case "$host_vendor-$host_os" in
5		*android*)  dnl android has all pthread* functions in the libc.
6			;;
7		*ps3*)  dnl ps3toolchain doesn't have a working pthread yet
8			HAVE_PTHREAD=no
9			;;
10		*qnx*)  dnl qnx has all pthread* functions in the libc.
11			;;
12		*openbsd*)
13			LIBS="$LIBS -pthread"
14			AC_TRY_LINK(
15				[#include <pthread.h>],
16				[pthread_attr_t type;
17				 pthread_attr_setstacksize(&type, 0x100000);],
18				[PTHREAD_LDFLAGS=-pthread],
19				[PTHREAD_LDFLAGS=-lpthread]
20			)
21			;;
22		*)  LIBS="$LIBS -lpthread"
23			AC_TRY_LINK(
24				[#include <pthread.h>],
25				[pthread_attr_t type;
26				 pthread_attr_setstacksize(&type, 0x100000);],
27				[PTHREAD_LDFLAGS=-lpthread],
28				[PTHREAD_LDFLAGS=-pthread]
29			)
30			;;
31	esac
32	LIBS="$save_LIBS"
33	PTHREAD_CFLAGS=-D_REENTRANT
34fi
35if test "x$HAVE_PTHREAD" = "xyes"; then
36	 AC_DEFINE(HAVE_PTHREAD, 1, [Define if you have working pthread])
37fi
38AC_SUBST(PTHREAD_LDFLAGS)
39AC_SUBST(PTHREAD_CFLAGS)
40