[3027f8] | 1 | # Check for Qt compiler flags, linker flags, and binary packages
|
---|
| 2 | AC_DEFUN([gw_CHECK_QT4],
|
---|
| 3 | [
|
---|
| 4 | AC_REQUIRE([AC_PROG_CXX])
|
---|
| 5 | AC_REQUIRE([AC_PATH_X])
|
---|
| 6 |
|
---|
| 7 | AC_MSG_CHECKING([QTDIR])
|
---|
| 8 | AC_ARG_WITH([qtdir], [ --with-qtdir=DIR Qt installation directory [default=$QTDIR]], QTDIR=$withval)
|
---|
| 9 | # Check that QTDIR is defined or that --with-qtdir given
|
---|
| 10 | if test x"$QTDIR" = x ; then
|
---|
| 11 | # some usual Qt-locations
|
---|
| 12 | QT_SEARCH="/usr /usr/lib/qt /usr/X11R6 /usr/local/Trolltech/Qt-4.0.0 /usr/local/Trolltech/Qt-4.0.1 /usr/local/Trolltech/Qt-4.1.0 /usr/local/Trolltech/Qt-4.2.0 /usr/local/Trolltech/Qt-4.2.1 /usr/local/Trolltech/Qt-4.2.2"
|
---|
| 13 | else
|
---|
| 14 | QT_SEARCH=$QTDIR
|
---|
| 15 | QTDIR=""
|
---|
| 16 | fi
|
---|
| 17 | for i in $QT_SEARCH ; do
|
---|
| 18 | QT_INCLUDE_SEARCH="include/qt4 include"
|
---|
| 19 | for j in $QT_INCLUDE_SEARCH ; do
|
---|
| 20 | if test -f $i/$j/Qt/qglobal.h -a x$QTDIR = x ; then
|
---|
| 21 | QTDIR=$i
|
---|
| 22 | QT_INCLUDES=$i/$j
|
---|
| 23 | fi
|
---|
| 24 | done
|
---|
| 25 | done
|
---|
| 26 | if test x"$QTDIR" = x ; then
|
---|
| 27 | AC_MSG_ERROR([*** QTDIR must be defined, or --with-qtdir option given])
|
---|
| 28 | fi
|
---|
| 29 | AC_MSG_RESULT([$QTDIR])
|
---|
| 30 |
|
---|
| 31 | # Change backslashes in QTDIR to forward slashes to prevent escaping
|
---|
| 32 | # problems later on in the build process, mainly for Cygwin build
|
---|
| 33 | # environment using MSVC as the compiler
|
---|
| 34 | QTDIR=`echo $QTDIR | sed 's/\\\\/\\//g'`
|
---|
| 35 |
|
---|
| 36 | AC_MSG_CHECKING([Qt includes])
|
---|
| 37 | # Check where includes are located
|
---|
| 38 | if test x"$QT_INCLUDES" = x ; then
|
---|
| 39 | AC_MSG_ERROR([*** could not find Qt-includes! Make sure you have the Qt-devel-files installed!])
|
---|
| 40 | fi
|
---|
| 41 | AC_MSG_RESULT([$QT_INCLUDES])
|
---|
| 42 |
|
---|
| 43 |
|
---|
| 44 | if test -z "$QTHOSTDIR" ; then
|
---|
| 45 | case "${prefix}" in
|
---|
| 46 | /opt/mingw*)
|
---|
| 47 | QTHOSTDIR=/usr
|
---|
| 48 | ;;
|
---|
| 49 | *)
|
---|
| 50 | if test -n "$QTDIR" ; then
|
---|
| 51 | QTHOSTDIR="$QTDIR"
|
---|
| 52 | else
|
---|
| 53 | QTHOSTDIR=/usr
|
---|
| 54 | fi
|
---|
| 55 | ;;
|
---|
| 56 | esac
|
---|
| 57 | fi
|
---|
| 58 |
|
---|
| 59 |
|
---|
| 60 | # Check that moc is in path
|
---|
| 61 | AC_CHECK_PROG(MOC, moc-qt4, $QTHOSTDIR/bin/moc-qt4,,$QTHOSTDIR/bin/)
|
---|
| 62 | if test x$MOC = x ; then
|
---|
| 63 | AC_CHECK_PROG(MOC, moc, $QTHOSTDIR/bin/moc,,$QTHOSTDIR/bin/)
|
---|
| 64 | if test x$MOC = x ; then
|
---|
| 65 | AC_MSG_ERROR([*** not found! Make sure you have Qt-devel-tools installed!])
|
---|
| 66 | fi
|
---|
| 67 | fi
|
---|
| 68 |
|
---|
| 69 | # Check that uic is in path
|
---|
| 70 | AC_CHECK_PROG(UIC, uic-qt4, $QTHOSTDIR/bin/uic-qt4,,$QTHOSTDIR/bin/)
|
---|
| 71 | if test x$UIC = x ; then
|
---|
| 72 | AC_CHECK_PROG(UIC, uic, $QTHOSTDIR/bin/uic,,$QTHOSTDIR/bin/)
|
---|
| 73 | if test x$UIC = x ; then
|
---|
| 74 | AC_MSG_ERROR([*** not found! Make sure you have Qt-devel-tools installed!])
|
---|
| 75 | fi
|
---|
| 76 | fi
|
---|
| 77 |
|
---|
| 78 | # lupdate is the Qt translation-update utility.
|
---|
| 79 | AC_CHECK_PROG(LUPDATE, lupdate-qt4, $QTHOSTDIR/bin/lupdate-qt4,,$QTHOSTDIR/bin/)
|
---|
| 80 | if test x$LUPDATE = x ; then
|
---|
| 81 | AC_CHECK_PROG(LUPDATE, lupdate, $QTHOSTDIR/bin/lupdate,,$QTHOSTDIR/bin/)
|
---|
| 82 | if test x$MOC = x ; then
|
---|
| 83 | AC_MSG_WARN([*** not found! It's not needed just for compiling but should be part of a proper Qt-devel-tools-installation!])
|
---|
| 84 | fi
|
---|
| 85 | fi
|
---|
| 86 |
|
---|
| 87 | # lrelease is the Qt translation-release utility.
|
---|
| 88 | AC_CHECK_PROG(LRELEASE, lrelease-qt4, $QTHOSTDIR/bin/lrelease-qt4,,$QTHOSTDIR/bin/)
|
---|
| 89 | if test x$LRELEASE = x ; then
|
---|
| 90 | AC_CHECK_PROG(LRELEASE, lrelease, $QTHOSTDIR/bin/lrelease,,$QTHOSTDIR/bin/)
|
---|
| 91 | if test x$MOC = x ; then
|
---|
| 92 | AC_MSG_WARN([*** not found! It's not needed just for compiling but should be part of a proper Qt-devel-tools-installation!])
|
---|
| 93 | fi
|
---|
| 94 | fi
|
---|
| 95 |
|
---|
| 96 | # Calculate Qt include path
|
---|
| 97 | QT_CXXFLAGS="-I$QT_INCLUDES -I$QT_INCLUDES/Qt"
|
---|
| 98 |
|
---|
| 99 | # On unix, figure out if we're doing a static or dynamic link
|
---|
| 100 | case "${host}" in
|
---|
| 101 | *mingw32)
|
---|
| 102 | QT_IS_STATIC=`ls $QTDIR/lib/*.a 2> /dev/null`
|
---|
| 103 | if test "x$QT_IS_STATIC" = x; then
|
---|
| 104 | QT_IS_STATIC="no"
|
---|
| 105 | else
|
---|
| 106 | QT_IS_STATIC="yes"
|
---|
| 107 | fi
|
---|
| 108 | if test x$QT_IS_STATIC = xno ; then
|
---|
| 109 | QT_IS_DYNAMIC=`ls $QTDIR/lib/*.so 2> /dev/null`
|
---|
| 110 | if test "x$QT_IS_DYNAMIC" = x; then
|
---|
| 111 | AC_MSG_ERROR([*** Couldn't find any Qt libraries])
|
---|
| 112 | fi
|
---|
| 113 | fi
|
---|
| 114 | QT_LIB="-L$QTDIR/bin -lQtCore4 -lQtXml4 -lQtNetwork4 -lws2_32"
|
---|
| 115 | QT_LIB_GUI="-lQtGui4"
|
---|
| 116 | # Check that windres is in path
|
---|
| 117 | AC_PATH_PROGS([WINDRES],[i586-mingw32-windres windres],,[${prefix}/bin:$PATH])
|
---|
| 118 | if test x$WINDRES = x ; then
|
---|
| 119 | AC_MSG_ERROR([*** not found! Make sure you have binutils installed!])
|
---|
| 120 | fi
|
---|
| 121 | ;;
|
---|
| 122 | *)
|
---|
| 123 | QT_IS_STATIC=`ls $QTDIR/lib/*.a 2> /dev/null`
|
---|
| 124 | if test "x$QT_IS_STATIC" = x; then
|
---|
| 125 | QT_IS_STATIC="no"
|
---|
| 126 | else
|
---|
| 127 | QT_IS_STATIC="yes"
|
---|
| 128 | fi
|
---|
| 129 | if test x$QT_IS_STATIC = xno ; then
|
---|
| 130 | QT_IS_DYNAMIC=`ls $QTDIR/lib/*.so 2> /dev/null`
|
---|
| 131 | if test "x$QT_IS_DYNAMIC" = x; then
|
---|
| 132 | AC_MSG_ERROR([*** Couldn't find any Qt libraries])
|
---|
| 133 | fi
|
---|
| 134 | fi
|
---|
| 135 | QT_LIB="-L$QTDIR/lib -L$QTDIR/lib/qt4 -lQtCore -lQtXml -lQtNetwork"
|
---|
| 136 | QT_LIB_GUI="-lQtGui"
|
---|
| 137 | ;;
|
---|
| 138 | esac
|
---|
| 139 | AC_MSG_CHECKING([if Qt is static])
|
---|
| 140 | AC_MSG_RESULT([$QT_IS_STATIC])
|
---|
| 141 |
|
---|
| 142 | QT_LIBS="$QT_LIB"
|
---|
| 143 |
|
---|
| 144 |
|
---|
| 145 | case "${host}" in
|
---|
| 146 | *irix*)
|
---|
| 147 | QT_LIBS="$QT_LIB"
|
---|
| 148 | if test $QT_IS_STATIC = yes ; then
|
---|
[861874] | 149 | QT_LIBS="$QT_LIBS -lXext -lX11 -lm -lSM -lICE"
|
---|
[3027f8] | 150 | fi
|
---|
| 151 | ;;
|
---|
| 152 |
|
---|
| 153 | *linux*)
|
---|
| 154 | QT_LIBS="$QT_LIB"
|
---|
| 155 | if test $QT_IS_STATIC = yes ; then
|
---|
[861874] | 156 | QT_LIBS="$QT_LIBS -lXext -lX11 -lm -lSM -lICE -ldl"
|
---|
[3027f8] | 157 | fi
|
---|
| 158 | ;;
|
---|
| 159 |
|
---|
| 160 | *osf*)
|
---|
| 161 | # Digital Unix (aka DGUX aka Tru64)
|
---|
| 162 | QT_LIBS="$QT_LIB"
|
---|
| 163 | if test $QT_IS_STATIC = yes ; then
|
---|
[861874] | 164 | QT_LIBS="$QT_LIBS -lXext -lX11 -lm -lSM -lICE"
|
---|
[3027f8] | 165 | fi
|
---|
| 166 | ;;
|
---|
| 167 |
|
---|
| 168 | *solaris*)
|
---|
| 169 | QT_LIBS="$QT_LIB"
|
---|
| 170 | if test $QT_IS_STATIC = yes ; then
|
---|
[861874] | 171 | QT_LIBS="$QT_LIBS -lXext -lX11 -lm -lSM -lICE -lresolv -lsocket -lnsl"
|
---|
[3027f8] | 172 | fi
|
---|
| 173 | ;;
|
---|
| 174 |
|
---|
| 175 | esac
|
---|
| 176 |
|
---|
| 177 |
|
---|
| 178 | QT_CXXFLAGS="$QT_CXXFLAGS -D_REENTRANT -DQT_NO_DEBUG -DQT_THREAD_SUPPORT"
|
---|
| 179 |
|
---|
| 180 | QT_LDADD="$QT_LIBS"
|
---|
| 181 |
|
---|
| 182 | AC_MSG_CHECKING([QT_CXXFLAGS])
|
---|
| 183 | AC_MSG_RESULT([$QT_CXXFLAGS])
|
---|
| 184 | AC_MSG_CHECKING([QT_LDADD])
|
---|
| 185 | AC_MSG_RESULT([$QT_LDADD])
|
---|
| 186 |
|
---|
| 187 | AC_SUBST(QT_CXXFLAGS)
|
---|
| 188 | AC_SUBST(QT_LDADD)
|
---|
| 189 | AC_SUBST(QT_LIB_GUI)
|
---|
| 190 |
|
---|
| 191 | ])
|
---|
| 192 |
|
---|
| 193 |
|
---|