+dnl checks for functions
+AC_CHECK_FUNCS(strverscmp access fsync fflush)
+
+
+# Check target architecture
+
+# Check for Win32
+AC_MSG_CHECKING([for some Win32 platform])
+case "$target_os" in
+ mingw* | cygwin*)
+ platform_win32=yes
+ AC_DEFINE(PLATFORM_WIN32, 1, [Build on win32 OS])
+ ;;
+ *)
+ platform_win32=no
+ ;;
+esac
+AC_MSG_RESULT([$platform_win32])
+AM_CONDITIONAL(PLATFORM_WIN32, test "$platform_win32" = "yes")
+
+AC_MSG_CHECKING([for native Win32])
+case "$target_os" in
+ mingw*)
+ os_win32=yes
+ AC_DEFINE(OS_WIN32, 1, [Build on native win32 OS])
+ os_unix=no
+ PATHSEP=';'
+ ;;
+ *)
+ os_win32=no
+ os_unix=yes
+ PATHSEP=':'
+ ;;
+esac
+AC_MSG_RESULT([$os_win32])
+AC_SUBST(PATHSEP)
+AM_CONDITIONAL(OS_WIN32, test "$os_win32" = "yes")
+AM_CONDITIONAL(OS_UNIX, test "$os_unix" = "yes")
+
+if test "$os_win32" = "yes"; then
+ AC_CHECK_PROG(ms_librarian, lib.exe, yes, no)
+ AC_CHECK_TOOL(WINDRES, windres, :)
+else
+ WINDRES=":"
+fi
+
+AM_CONDITIONAL(MS_LIB_AVAILABLE, test x$ms_librarian = xyes)
+AM_CONDITIONAL(HAVE_WINDRES, test "x$WINDRES" != "x:")
+AC_SUBST(WINDRES)
+
+AC_MSG_CHECKING(for libpthread)
+have_libpthread=no
+AC_CHECK_LIB([pthread], [main],
+ [AC_CHECK_HEADER([pthread.h],
+ have_libpthread=yes,
+ have_libpthread=no)],
+ [AC_MSG_ERROR([Can't find the POSIX thread libraries])], [-lpthread])
+if test "x${have_libpthread}" = "xyes"; then
+ LIBPTHREAD='-lpthread'
+ AC_DEFINE(HAVE_LIBPTHREAD, 1, [Define if pthread is available])
+else
+ AC_MSG_WARN([POSIX thread header not installed])
+fi
+AC_MSG_RESULT([${have_libpthread}])
+