2
dnl CONFIGURE_QT([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
3
dnl \author J.E. Hoffmann <je-h@gmx.net>
5
AC_DEFUN([CONFIGURE_QT],
13
qt_includes="/usr/include/qt"
17
if test "$qt_error" = "no"; then
18
AC_MSG_CHECKING([for QT environment variable QTDIR])
19
if test -z "$QTDIR"; then
23
***************** WARNING *****************
25
YOU HAVE NOT SET YOUR 'QTDIR' ENVIRONMENT VARIABLE!!!
27
This is the source of most people's problems when
28
configuring muse. If the configuration fails to find
29
qt, try setting your QTDIR environment variable to
30
the directory where qt is installed.
32
*******************************************
41
qt_includes="$QTDIR/include"
42
qt_libraries="$QTDIR/lib"
43
qt_binaries="$QTDIR/bin"
44
MOC="$qt_binaries/moc";
45
UIC="$qt_binaries/uic";
51
[ --disable-qttest do not try to compile and run a test libqt program],[
60
AC_MSG_ERROR([must use --enable-qttest(=yes/no) or --disable-qttest])
66
AC_ARG_WITH(qt-prefix,
67
[ --with-qt-prefix=PFX where the root of Qt is installed ],
69
qt_includes="$withval/include"
70
qt_libraries="$withval/lib"
71
qt_binaries="$withval/bin"
72
MOC="$qt_binaries/moc";
73
UIC="$qt_binaries/uic";
76
AC_ARG_WITH(qt-includes,
77
[ --with-qt-includes=DIR where the Qt includes are installed ],
79
qt_includes="$withval"
82
AC_ARG_WITH(qt-libraries,
83
[ --with-qt-libraries=DIR where the Qt libraries are installed.],
85
qt_libraries="$withval"
88
AC_ARG_WITH(qt-binaries,
89
[ --with-qt-binaries=DIR where the Qt binaries are installed.],
91
qt_binaries="$withval"
92
MOC="$qt_binaries/moc";
93
UIC="$qt_binaries/uic";
97
[ --with-qt-moc=PROG where the Qt meta object compiler is installed.],
103
[ --with-qt-uic=PROG where the Qt user interface compiler is installed.],
108
if test "$qt_error" = "no"; then
109
saved_CPPFLAGS="$CPPFLAGS"
111
CPPFLAGS="$saved_CPPFLAGS -I$qt_includes"
112
if test -n "$qt_libraries"; then
113
LIBS="$saved_LIBS -L$qt_libraries -lqt-mt -lqui"
114
QT_LIBS="-L$qt_libraries -lqt-mt -lqui"
116
LIBS="$saved_LIBS -lqt-mt -lqui -lm $X11_LIBS"
117
QT_LIBS="-lqt-mt -lqui"
119
AC_MSG_CHECKING([for QT includes ($qt_includes)])
120
AC_CACHE_VAL(qt_includes_found,
123
AC_TRY_CPP([#include <qapplication.h>],
124
qt_includes_found=yes, qt_includes_found=no)
126
if test "$qt_includes_found" = "yes"; then
127
QT_CFLAGS="-I$qt_includes"
135
AC_MSG_CHECKING([for QT libraries ($qt_libraries)])
136
AC_CACHE_VAL(qt_libraries_found,
140
saved_CXXFLAGS="$CXXFLAGS"
142
CXXFLAGS="$QT_CFLAGS $LIBS"
143
LIBS="$QT_LIBS $LIBS"
146
if test "$muse_qttest" = "yes"; then
148
#include <qapplication.h>
149
int main(int argc, char **argv)
151
QApplication app(argc, argv, false);
160
AC_MSG_ERROR([cross compiling unsupported])
163
AC_MSG_RESULT([yes (assumed due to --disable-qttest)])
167
CXXFLAGS="$saved_CXXFLAGS"
171
AC_MSG_CHECKING([for QT moc ($MOC)])
172
output=`eval "$MOC --help 2>&1 | grep Qt"`
173
if test -z "$output"; then
180
AC_MSG_CHECKING([for QT uic ($UIC)])
181
output=`eval "$UIC --help 2>&1 | grep Qt"`
182
if test -z "$output"; then
188
CPPFLAGS="$saved_CPPFLAGS"
192
if test "$qt_error" = "no"; then
193
AC_MSG_CHECKING([for QT version >= $1])
194
qt_major_version=`echo $1 | \
195
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
196
qt_minor_version=`echo $1 | \
197
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
198
qt_micro_version=`echo $1 | \
199
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
200
qt_version="$qt_major_version$qt_minor_version$qt_micro_version"
204
saved_CXXFLAGS="$CXXFLAGS"
206
CXXFLAGS="$QT_CFLAGS $LIBS"
207
LIBS="$QT_LIBS $LIBS"
209
if test "$muse_qttest" = "yes"; then
214
int version = ($qt_major_version << 16)
215
+ ($qt_minor_version << 8)
217
if (QT_VERSION < version) return(1);
226
AC_MSG_ERROR([cross compiling unsupported])
229
AC_MSG_RESULT([yes (assumed due to --disable-qttest)])
233
CXXFLAGS="$saved_CXXFLAGS"
241
if test "$qt_error" = "no"; then
242
ifelse([$2], , :, [$2])
244
ifelse([$3], , :, [$3])