+# threads
+
+if test "x${want_jpip_server}" = "xyes" ; then
+
+ if test "x${have_win32}" = "xno" ; then
+
+ SAVE_CFLAGS=${CFLAGS}
+ CFLAGS="${CFLAGS} -pthread"
+ SAVE_LIBS=${LIBS}
+ LIBS="${LIBS} -pthread"
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM([[
+#include <pthread.h>
+ ]],
+ [[
+pthread_t id;
+id = pthread_self();
+ ]])],
+ [have_pthread="yes"],
+ [have_pthread="no"])
+ CFLAGS=${SAVE_CFLAGS}
+ LIBS=${SAVE_LIBS}
+
+ AC_MSG_CHECKING([whether Pthread library is available])
+ AC_MSG_RESULT([${have_pthread}])
+
+ if ! test "x${have_pthread}" = "xyes" ; then
+ AC_MSG_WARN([Pthread library not found. OpenJPIP server will not be compiled.])
+ want_jpip_server="no"
+ else
+ THREAD_CFLAGS="-pthread"
+ THREAD_LIBS="-pthread"
+ fi
+
+ else
+ THREAD_LIBS="-lws2_32"
+ fi
+
+fi
+
+AC_ARG_VAR([THREAD_CFLAGS], [compiler flag for the thread library])
+AC_SUBST([THREAD_CFLAGS])
+AC_ARG_VAR([THREAD_LIBS], [linker flags for thread library])
+AC_SUBST([THREAD_LIBS])
+
+# libfcgi
+
+if test "x${want_jpip_server}" = "xyes" ; then
+
+ have_fcgi="no"
+ OPJ_CHECK_LIB(
+ [fcgi_stdio.h],
+ [fcgi],
+ [FCGI_Accept],
+ [have_fcgi="yes"],
+ [have_fcgi="no"])
+
+ if ! test "x${have_fcgi}" = "xyes" ; then
+ AC_MSG_WARN([FastCGI library not found. OpenJPIP server will not be compiled.])
+ want_jpip_server="no"
+ fi
+
+fi
+
+# libcurl
+
+if test "x${want_jpip_server}" = "xyes" ; then
+
+ PKG_CHECK_MODULES([LIBCURL], [libcurl],
+ [have_libcurl="yes"],
+ [have_libcurl="no"])