+ *)
+ AC_MSG_CHECKING([for the pthreads library -l$flag])
+ THREADS_LINK="-l$flag"
+ ;;
+ esac
+
+ save_LIBS="$LIBS"
+ save_CFLAGS="$CFLAGS"
+ LIBS="$THREADS_LINK $LIBS"
+ CFLAGS="$THREADS_CFLAGS $CFLAGS"
+
+ AC_TRY_LINK([#include <pthread.h>],
+ [pthread_create(0,0,0,0);],
+ THREADS_OK=yes)
+
+ LIBS="$save_LIBS"
+ CFLAGS="$save_CFLAGS"
+
+ AC_MSG_RESULT($THREADS_OK)
+ if test "x$THREADS_OK" = "xyes"; then
+ break;
+ fi
+
+ THREADS_LINK=""
+ THREADS_CFLAGS=""
+ done
+
+ if test "x$THREADS_OK" != "xyes"; then
+ wxUSE_THREADS=no
+ AC_MSG_WARN([No thread support on this system... disabled])
+ else
+ dnl yes, these special compiler flags should be used with the
+ dnl linker as well
+ LIBS="$THREADS_LINK $THREADS_CFLAGS $LIBS"
+
+ AC_MSG_CHECKING([if more special flags are required for pthreads])
+ flag=no
+ case "${host}" in
+ *-aix* | *-freebsd*)
+ flag="-D_THREAD_SAFE"
+ ;;
+ *solaris* | alpha*-osf*)
+ flag="-D_REENTRANT"
+ ;;
+ esac
+ AC_MSG_RESULT(${flag})
+ if test "x$flag" != xno; then
+ THREADS_CFLAGS="$THREADS_CFLAGS $flag"
+ fi
+
+ if test "x$THREADS_CFLAGS" != "x"; then
+ dnl don't add these options to CPPFLAGS as cpp might not know them
+ CFLAGS="$CFLAGS $THREADS_CFLAGS"
+ CXXFLAGS="$CXXFLAGS $THREADS_CFLAGS"
+ fi
+ fi