configure.ac: Link PSPPIRE explicitly against gthread.
authorBen Pfaff <blp@cs.stanford.edu>
Sat, 5 May 2012 04:30:49 +0000 (21:30 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Sat, 5 May 2012 17:01:02 +0000 (10:01 -0700)
Seems to be required on OpenSUSE.

PSPPIRE does not make explicit use of threads, but it does use
GTimer.  Thus, it calls g_thread_init() because of the following
note in the documentation for GTimer:

    GTimer uses a higher-quality clock when thread support is
    available.  Therefore, calling g_thread_init() while timers
    are running may lead to unreliable results.  It is best to
    call g_thread_init() before starting any timers, if you are
    using threads at all.

Separately, the documentation for threads in Glib says:

    Calling g_thread_init() with a NULL argument is somewhat more
    relaxed.  You may call any other glib functions in the main
    thread before g_thread_init() as long as g_thread_init() is
    not called from a glib callback, or with any locks held.
    However, many libraries above glib does not support late
    initialization of threads, so doing this should be avoided if
    possible.

    Please note that since version 2.24 the GObject
    initialization function g_type_init() initializes threads
    (with a NULL argument), so most applications, including those
    using Gtk+ will run with threads enabled.  If you want a
    special thread implementation, make sure you call
    g_thread_init() before g_type_init() is called.

Taken together, it seems to imply that PSPPIRE should call
g_thread_init() before g_timer_new(), or the timer might be
unreliable because Glib would call it later for us.  But the
documentation doesn't seem entirely clear.

Reported by Mindaugas.
Bug #36396.

configure.ac
src/ui/gui/automake.mk

index 7d33ca25daf29827ced92b991aa0e05179380989..2f3a8da725ea4e89b84d69b1d926d43f064ba95d 100644 (file)
@@ -73,6 +73,9 @@ AC_ARG_WITH([gui],
 AM_CONDITIONAL([HAVE_GUI], 
                [test "$with_cairo" != no && test "$with_gui" != "no"])
 if test "$with_cairo" != no && test "$with_gui" != "no"; then
+  PKG_CHECK_MODULES([GTHREAD], [gthread-2.0], [],
+    [PSPP_REQUIRED_PREREQ([gthread 2.0 (or use --without-gui)])])
+
   PKG_CHECK_MODULES([GTK], [gtk+-2.0 >= 2.16], [],
     [PSPP_REQUIRED_PREREQ([gtk+ 2.0 version 2.16 or later (or use --without-gui)])])
 
index 96209a019948b38fe05f0a15266076fdd5a0b26a..a7cb1de5905345236a4a1379efbad7d888a13c34 100644 (file)
@@ -74,6 +74,7 @@ src_ui_gui_psppire_LDADD = \
        src/libpspp.la \
        src/libpspp-core.la \
        $(GTK_LIBS) \
+       $(GTHREAD_LIBS) \
        $(GTKSOURCEVIEW_LIBS) \
        $(CAIRO_LIBS) \
        $(LIBINTL) \