[poppler] Fwd: poppler qt bindings pthread patch

Stefan Schweizer genstef at gentoo.org
Sat Apr 8 04:46:13 PDT 2006


I am forwarding this on behalf of Diego, please help us to make
poppler working on freeBSD and apply it :)

---------- Forwarded message ----------
From: Diego 'Flameeyes' Pettenò <flameeyes at gentoo.org>
Date: Apr 8, 2006 1:08 PM
Subject: poppler qt bindings pthread patch
To: genstef at gentoo.org

Basically this adds a test if -pthread is needed while linking the qt bindings
(that's the case on FreeBSD, as pthread is not a library).
If it's needed, then it's added to the LIBS variable so that it's used in
linking.

With this, poppler-bindings +qt merges fine on Gentoo/FreeBSD as well as KPDF,
too :)

--
Diego "Flameeyes" Pettenò - http://dev.gentoo.org/~flameeyes/
Gentoo/Alt lead, Gentoo/FreeBSD, Video, AMD64, Sound, PAM, KDE
-------------- next part --------------
Index: poppler-0.5.1/m4/qt.m4
===================================================================
--- poppler-0.5.1.orig/m4/qt.m4
+++ poppler-0.5.1/m4/qt.m4
@@ -53,8 +53,28 @@ if test "x$qt_libdir" != "xno" ; then
 fi
 
 if test "x$have_qt" == "xyes"; then
+    AC_LANG_PUSH([C++])
+    pthread_needed=no
+
+    save_LDFLAGS=$LDFLAGS
+    AC_MSG_CHECKING([if Qt needs -pthread])
+    AC_TRY_LINK([#include <qt.h>], [QString s;], [pthread_needed=no], [pthread_needed=yes])
+    if "x$pthread_needed" = "xyes"; then
+        LDFLAGS="$LDFLAGS -pthread"
+        AC_TRY_LINK([#include <qt.h>], [Qstring s;], [pthread_needed=yes], [pthread_needed=yes])
+	LDFLAGS=$save_LDFLAGS
+    fi
+    AC_MSG_RESULT([$pthread_needed])
+
+    AC_LANG_POP
+
+    qtpthread=''
+    if "x$pthread_needed" = "xyes"; then
+        qtpthread="-pthread"
+    fi
+
     $1[]_CXXFLAGS="-I$qt_incdir"
-    $1[]_LIBS="$qt_libdir/$qt_test_library"
+    $1[]_LIBS="$qtpthread $qt_libdir/$qt_test_library"
     ifelse([$2], , :, [$2])
 else
     ifelse([$3], , [AC_MSG_FAILURE(dnl



More information about the poppler mailing list