diff configure.in @ 1015:2cdcf67e9300

run image loader in separate thread this feature is disabled by default for now, it must be enabled by configure --enable-threads
author nadvornik
date Sat, 30 Aug 2008 20:15:47 +0000
parents fe82830ab8fd
children 98f8d5746b92
line wrap: on
line diff
--- a/configure.in	Sat Aug 30 13:04:06 2008 +0000
+++ b/configure.in	Sat Aug 30 20:15:47 2008 +0000
@@ -167,21 +167,6 @@
 AM_CONDITIONAL(HAVE_WINDRES, test "x$WINDRES" != "x:")
 AC_SUBST(WINDRES)
 
-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_CHECKING(for libpthread)
-AC_MSG_RESULT([${have_libpthread}])
-
 dnl reasonable guesses for where stuff is installed
 if test "x$prefix" = "xNONE"; then
   prefix="/usr/local"
@@ -189,7 +174,26 @@
   prefix=$prefix
 fi
 
+AM_PATH_GLIB_2_0(2.4.0,,AC_MSG_ERROR(GLIB >= 2.4.0 not installed.))
 AM_PATH_GTK_2_0(2.4.0,,AC_MSG_ERROR(GTK+ >= 2.4.0 not installed.))
+
+have_gthread="no"
+AC_ARG_ENABLE([threads],
+  AC_HELP_STRING([--enable-threads], [enable thread support]),
+[
+if test "x${enableval}" = "xyes"; then
+  PKG_CHECK_MODULES(GTHREAD, [gthread-2.0], have_gthread="yes", [AC_MSG_WARN("No thread support in glib")])
+fi
+], )
+
+
+if test "x$have_gthread" != "xno"; then
+        AC_DEFINE(HAVE_GTHREAD, 1, Define if you have gthread library)
+        GLIB_CFLAGS="$GTHREAD_CFLAGS"
+        GLIB_LIBS="$GTHREAD_LIBS"
+fi
+
+
 AC_PATH_PROGS(GDK_PIXBUF_CSOURCE, "gdk-pixbuf-csource")
 AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
 
@@ -376,7 +380,7 @@
   CXXFLAGS:      $CXXFLAGS
   Gtk:           $GTK_CFLAGS
   Glib:          $GLIB_CFLAGS
-  Thread:        $LIBPTHREAD
+  Thread:        $GTHREAD_LIBS
   Others:	 $LCMS_LIBS $EXIV2_LIBS
 
 Localization: