Rework trade route removal messages in the case a city is lost.
[freeciv.git] / m4 / qt.m4
blob4c5f5613f2f4820cd08b5b083c25f878edbc7960
1 # Detect Qt headers and libraries and set flag variables
3 AC_DEFUN([FC_QT],
5   AC_LANG_PUSH([C++])
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
14 FC_QT_COMPILETEST
15 for TEST_PATH in $POTENTIAL_PATHS
17   if test "x$qt_headers" != "xyes" ; then
18     FC_QT_COMPILETEST($TEST_PATH)
19   fi
20 done])
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
31 FC_QT_LINKTEST
32 for TEST_PATH in $POTENTIAL_PATHS
34   if test "x$qt_libs" != "xyes" ; then
35     FC_QT_LINKTEST($TEST_PATH)
36   fi
37 done])
39   fi
41   AC_LANG_POP([C++])
43   if test "x$qt_libs" = "xyes" ; then
44     AC_MSG_RESULT([found])
45     fc_qt_usable=true
46   else
47     AC_MSG_RESULT([not found])
48     fc_qt_usable=false
49   fi
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"
57   else
58     CPPFADD=""
59   fi
61   CPPFLAGS_SAVE="$CPPFLAGS"
62   CPPFLAGS="${CPPFLAGS}${CPPFADD}"
63   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <QApplication>]],
64 [[QApplication app(0, 0);]])],
65     [qt_headers=yes
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"
75   else
76     LIBSADD=" -lQtGui -lQtCore"
77   fi
79   CPPFLAGS_SAVE="$CPPFLAGS"
80   CPPFLAGS="$CPPFLAGS $FC_QT_CPPFLAGS"
81   LIBS_SAVE="$LIBS"
82   LIBS="${LIBS}${LIBSADD}"
83   AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <QApplication>]],
84 [[QApplication app(0, 0);]])],
85 [qt_libs=yes
86  FC_QT_LIBS="${FC_QT_LIBS}${LIBSADD}"])
87  LIBS="$LIBS_SAVE"
88  CPPFLAGS="$CPPFLAGS_SAVE"