1 # Detect Qt headers and libraries and set flag variables
7 AC_MSG_CHECKING([Qt headers])
9 AC_ARG_WITH([qt-includes],
10 [ --with-qt-includes path to Qt includes],
11 [FC_QT_COMPILETEST([$withval])],
12 [POTENTIAL_PATHS="/usr/include /usr/include/qt4"
13 dnl First test without any additional include paths to see if it works already
15 for TEST_PATH in $POTENTIAL_PATHS
17 if test "x$qt_headers" != "xyes" ; then
18 FC_QT_COMPILETEST($TEST_PATH)
22 if test "x$qt_headers" = "xyes" ; then
23 AC_MSG_RESULT([found])
25 AC_MSG_CHECKING([Qt libraries])
26 AC_ARG_WITH([qt-libs],
27 [ --with-qt-libs path to Qt libraries],
28 [FC_QT_LINKTEST([$withval])],
29 [POTENTIAL_PATHS="/usr/lib/qt4"
30 dnl First test without any additional library paths to see if it works already
32 for TEST_PATH in $POTENTIAL_PATHS
34 if test "x$qt_libs" != "xyes" ; then
35 FC_QT_LINKTEST($TEST_PATH)
43 if test "x$qt_libs" = "xyes" ; then
44 AC_MSG_RESULT([found])
47 AC_MSG_RESULT([not found])
52 dnl Test if Qt headers are found from given path
53 AC_DEFUN([FC_QT_COMPILETEST],
55 if test "x$1" != "x" ; then
56 CPPFADD=" -I$1 -I$1/QtCore -I$1/QtGui"
61 CPPFLAGS_SAVE="$CPPFLAGS"
62 CPPFLAGS="${CPPFLAGS}${CPPFADD}"
63 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <QApplication>]],
64 [[QApplication app(0, 0);]])],
66 FC_QT_CPPFLAGS="${FC_QT_CPPFLAGS}${CPPFADD}"])
67 CPPFLAGS="$CPPFLAGS_SAVE"
70 dnl Test Qt application linking with current flags
71 AC_DEFUN([FC_QT_LINKTEST],
73 if test "x$1" != "x" ; then
74 LIBSADD=" -L$1 -lQtGui -lQtCore"
76 LIBSADD=" -lQtGui -lQtCore"
79 CPPFLAGS_SAVE="$CPPFLAGS"
80 CPPFLAGS="$CPPFLAGS $FC_QT_CPPFLAGS"
82 LIBS="${LIBS}${LIBSADD}"
83 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <QApplication>]],
84 [[QApplication app(0, 0);]])],
86 FC_QT_LIBS="${FC_QT_LIBS}${LIBSADD}"])
88 CPPFLAGS="$CPPFLAGS_SAVE"