summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorAlbert Astals Cid <aacid@kde.org>2006-04-09 11:05:51 +0000
committerAlbert Astals Cid <aacid@kde.org>2006-04-09 11:05:51 +0000
commitfd251f52efc7748fda91cc77fb9d3966e0f02ac8 (patch)
treea9f71eea6beaafd9a937b71e2bdad7034f5b855f /m4
parent36de9747153a2ea9b3cf86c41e75a521441a2e06 (diff)
m4/qt.m4: Improve for systems that need -pthread to be linked when linking Qt. Patch by Diego Pettenò
Diffstat (limited to 'm4')
-rw-r--r--m4/qt.m428
1 files changed, 27 insertions, 1 deletions
diff --git a/m4/qt.m4 b/m4/qt.m4
index 729628a5..dee9b156 100644
--- a/m4/qt.m4
+++ b/m4/qt.m4
@@ -53,8 +53,34 @@ 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
+ save_CXXFLAGS=$CXXFLAGS
+ save_LIBS=$LIBS
+ CXXFLAGS="$CXXFLAGS -I$qt_incdir"
+ LIBS="$LIBS $qt_libdir/$qt_test_library"
+ AC_MSG_CHECKING([if Qt needs -pthread])
+ AC_TRY_LINK([#include <qt.h>], [QString s;], [pthread_needed=no], [pthread_needed=yes])
+ if test "x$pthread_needed" = "xyes"; then
+ LDFLAGS="$LDFLAGS -pthread"
+ AC_TRY_LINK([#include <qt.h>], [QString s;], [pthread_needed=yes], [pthread_needed=no])
+ fi
+ AC_MSG_RESULT([$pthread_needed])
+ LDFLAGS=$save_LDFLAGS
+ CXXFLAGS=$save_CXXFLAGS
+ LIBS=$save_LIBS
+
+ AC_LANG_POP
+
+ qtpthread=''
+ if test "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