1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180
|
# FUN_CHECK_QT()
# check for qt (headers, libs, progs and compilation)
# substs QT_CXXFLAGS, QT_LDFLAGS, and QT_LIBS
AC_DEFUN([FUN_CHECK_QT],
[
AC_REQUIRE([AC_PROG_CXX])
AC_CACHE_SAVE
AC_MSG_NOTICE([checking for Qt])
# Variables we want to fill...
qt_dir=""
qt_dir_include=""
qt_dir_lib=""
qt_dir_bin=""
qt_libs="-lQtGui -lQtCore -lQtAssistantClient -lQtNetwork"
MOC=""
UIC=""
#
# Create configure option for include location...
#
AC_ARG_WITH([qt_dir_include], AC_HELP_STRING([--with-qt_dir_include=DIR],
[location of Qt include files]),
[ qt_dir_include="$withval"
])
#
# Create configure option for lib location...
#
AC_ARG_WITH([qt_dir_lib], AC_HELP_STRING([--with-qt-lib=DIR],
[location of Qt lib files]),
[ qt_dir_lib="$withval"
])
#
# Create configure option for bin location...
#
AC_ARG_WITH([qt_dir_bin], AC_HELP_STRING([--with-qt-bin=DIR],
[location of Qt bin files]),
[ qt_dir_bin="$withval"
])
#
# No include location given? Lets check a few known places.
#
if test "x$qt_dir_include" = x; then
if test -d "/usr/include/QtCore"; then
qt_dir_include="/usr/include"
fi
fi
#
# No lib location given? Lets check a few known places.
#
if test "x$qt_dir_lib" = x; then
qt_dir_lib=default
FUN_QT_COMPILE([], [
if test -e "/usr/lib64/libQtCore.so"; then
qt_dir_lib="/usr/lib64"
elif test -e "/usr/lib/libQtCore.so"; then
qt_dir_lib="/usr/lib"
else
qt_dir_lib=""
fi
])
fi
CXXFLAGS="$ac_cxxflags_save"
LIBS="$ac_libs_save"
#
# No bin location given? Lets check a few known places.
#
if test "x$qt_dir_bin" = x; then
if test -e "/usr/bin/moc"; then
qt_dir_bin="/usr/bin"
fi
fi
#
# Still not found - we fail.
#
if test "x$qt_dir_include" = x; then
AC_MSG_RESULT([no (include try specifying with --with-qt_dir_include or try a different value)])
AC_MSG_ERROR([cannot find Qt!])
fi
#
# Still not found - we fail.
#
if test "x$qt_dir_lib" = x; then
AC_MSG_RESULT([no (lib try specifying with --with-qt-lib or try a different value)])
AC_MSG_ERROR([cannot find Qt!])
fi
#
# Still not found - we fail.
#
if test "x$qt_dir_bin" = x; then
AC_MSG_RESULT([no (bin try specifying with --with-qt-bin or try a different value)])
AC_MSG_ERROR([cannot find Qt!])
fi
AC_MSG_RESULT([yes ($qt_dir_include)])
AC_MSG_RESULT([yes ($qt_dir_lib)])
AC_MSG_RESULT([yes ($qt_dir_bin)])
# qt_dir_include="$qt_dir"/include
# qt_dir_lib="$qt_dir"/lib
# qt_dir_bin="$qt_dir"/bin
AC_CHECK_FILE([$qt_dir_include/QtGui/QWizard], [have_qtwizard=yes], [have_qtwizard=no])
AC_CHECK_FILE([$qt_dir_include/QtGui/QMdiArea], [have_qtmdiarea=yes], [have_qtmdiarea=no])
MOC="$qt_dir_bin"/moc
UIC="$qt_dir_bin"/uic
AC_MSG_NOTICE([qt_dir_lib=$qt_dir_lib])
AC_MSG_NOTICE([LDFLAGS=$LDFLAGS])
AC_MSG_NOTICE([X_LIBS=$X_LIBS])
AC_MSG_CHECKING([whether a simple Qt program compiles])
FUN_QT_COMPILE([AC_MSG_RESULT([yes])], [
AC_MSG_RESULT([no])
AC_MSG_ERROR([cannot compile a Qt program!])
])
AC_SUBST(MOC)
AC_SUBST(UIC)
QT_CXXFLAGS="-I$qt_dir_include -I$qt_dir_include/QtCore -I$qt_dir_include/QtGui -I$qt_dir_include/QtAssistant -I$qt_dir_include/QtNetwork"
AC_SUBST(QT_CXXFLAGS)
if test "x$qt_dir_lib" = xdefault; then
QT_LDFLAGS=""
else
QT_LDFLAGS="-L$qt_dir_lib"
fi
AC_SUBST(QT_LDFLAGS)
QT_LIBS="$qt_libs"
AC_SUBST(QT_LIBS)
have_qt="yes"
])#FUN_CHECK_QT
# FUN_QT_COMPILE
# helper function for FUN_CHECK_QT
# compile a simple qt program
AC_DEFUN([FUN_QT_COMPILE],
[
AC_LANG_PUSH(C++)
ac_cxxflags_save="$CXXFLAGS"
ac_ldflags_save="$LDFLAGS"
ac_libs_save="$LIBS"
CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS -I$qt_dir_include -I$qt_dir_include/QtCore -I$qt_dir_include/QtGui $X_CFLAGS $all_includes"
if test "x$qt_dir_lib" != xdefault; then
LDFLAGS="$LDFLAGS -L$qt_dir_lib"
fi
LIBS="$LIBS $PTHREAD_LIBS $qt_libs"
AC_TRY_LINK([
#include <QMessageBox>
#include <QString>],
[QString s = "hello world";
QMessageBox::information(0, s, "no he is not");
return 0;],
qt_compile=yes, qt_compile=no)
CXXFLAGS="$ac_cxxflags_save"
LDFLAGS="$ac_ldflags_save"
LIBS="$ac_libs_save"
AC_LANG_POP(C++)
AS_IF([test "x$qt_compile" = "xyes"], [$1], [$2])
])#FUN_QT_COMPILE
|