summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorJan Engelhardt <jengelh@medozas.de>2010-03-27 13:23:42 +0000
committerAlbert Astals Cid <aacid@kde.org>2010-03-27 13:23:42 +0000
commitb53f9b203598555d6d706c3804aba013b8566921 (patch)
treeb5ce4ad7eaefb3bf8b4735d2593ea9ac24b16752 /m4
parent320d4cee46e108498440179d8f9eab22cd5383d9 (diff)
make qt3 detection use pkgconfig
Diffstat (limited to 'm4')
-rw-r--r--m4/qt.m4101
1 files changed, 8 insertions, 93 deletions
diff --git a/m4/qt.m4 b/m4/qt.m4
index 8de2628c..91cabc37 100644
--- a/m4/qt.m4
+++ b/m4/qt.m4
@@ -1,101 +1,16 @@
# POPPLER_FIND_QT(VARIABLE-PREFIX, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
#
-# Check whether the Qt libraries are available. Adapted from
-# OpenOffice.org configure.in
+# Check whether the Qt3 libraries are available.
#
# --------------------------------------------------------------
AC_DEFUN([POPPLER_FIND_QT],
[
-dnl Search paths for Qt
-if test "$build_cpu" != "x86_64" ; then
- qt_incdirs="$QTINC /usr/local/qt/include /usr/include/qt /usr/include /usr/X11R6/include/X11/qt /usr/X11R6/include/qt /usr/lib/qt3/include /usr/lib/qt/include /usr/share/qt3/include"
- qt_libdirs="$QTLIB /usr/local/qt/lib /usr/lib/qt /usr/lib /usr/X11R6/lib/X11/qt /usr/X11R6/lib/qt /usr/lib/qt3/lib /usr/lib/qt/lib /usr/share/qt3/lib"
-else
- qt_incdirs="$QTINC /usr/local/qt/include /usr/include/qt /usr/include /usr/X11R6/include/X11/qt /usr/X11R6/include/qt /usr/lib64/qt3/include /usr/lib64/qt/include /usr/share/qt3/include /usr/lib/qt3/include /usr/lib/qt/include"
- qt_libdirs="$QTLIB /usr/local/qt/lib64 /usr/lib64/qt /usr/lib64 /usr/X11R6/lib64/X11/qt /usr/X11R6/lib64/qt /usr/lib64/qt3/lib64 /usr/lib64/qt/lib64 /usr/share/qt3/lib64 /usr/local/qt/lib /usr/lib/qt /usr/lib /usr/X11R6/lib/X11/qt /usr/X11R6/lib/qt /usr/lib/qt3/lib /usr/lib/qt/lib /usr/share/qt3/lib"
-fi
-if test -n "$QTDIR" ; then
- qt_incdirs="$QTDIR/include $qt_incdirs"
- if test "$build_cpu" != "x86_64" ; then
- qt_libdirs="$QTDIR/lib $qt_libdirs"
- else
- qt_libdirs="$QTDIR/lib64 $QTDIR/lib $qt_libdirs"
- fi
-fi
-
-dnl What to test
-qt_test_include="qstyle.h"
-qt_test_la_library="libqt-mt.la"
-qt_test_library="libqt-mt.so"
-
-dnl Check for Qt headers
-AC_MSG_CHECKING([for Qt headers])
-qt_incdir="no"
-for it in $qt_incdirs ; do
- if test -r "$it/$qt_test_include" ; then
- qt_incdir="$it"
- break
- fi
-done
-AC_MSG_RESULT([$qt_incdir])
-
-dnl Check for Qt libraries
-AC_MSG_CHECKING([for Qt libraries])
-qt_libdir="no"
-for qt_check in $qt_libdirs ; do
- if test -r "$qt_check/$qt_test_la_library" ; then
- qt_libdir="$qt_check"
- break
- fi
-
- if test -r "$qt_check/$qt_test_library" ; then
- qt_libdir="$qt_check"
- break
- fi
-done
-AC_MSG_RESULT([$qt_libdir])
-
-if test "x$qt_libdir" != "xno" ; then
- if test "x$qt_incdir" != "xno" ; then
- have_qt=yes
- fi
-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 -L$qt_libdir -lqt-mt"
- 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="$qtpthread -L$qt_libdir -lqt-mt"
- ifelse([$2], , :, [$2])
-else
- ifelse([$3], , [AC_MSG_FAILURE(dnl
-[Qt development libraries not found])],
- [$3])
-fi
+PKG_CHECK_MODULES([libqt3], [qt-mt], [
+ ifelse([$2], , :, [$2])
+], [
+ ifelse([$3], ,
+ [AC_MSG_FAILURE([Qt development libraries not found])],
+ [$3])
])
-
+])