[060ba4] | 1 | dnl @synopsis BNV_HAVE_QT [--with-Qt-dir=DIR] [--with-Qt-lib-dir=DIR] [--with-Qt-lib=LIB]
|
---|
| 2 | dnl @synopsis BNV_HAVE_QT [--with-Qt-include-dir=DIR] [--with-Qt-bin-dir=DIR] [--with-Qt-lib-dir=DIR] [--with-Qt-lib=LIB]
|
---|
| 3 | dnl
|
---|
| 4 | dnl @summary Search for Trolltech's Qt GUI framework.
|
---|
| 5 | dnl
|
---|
| 6 | dnl Searches common directories for Qt include files, libraries and Qt
|
---|
| 7 | dnl binary utilities. The macro supports several different versions of
|
---|
| 8 | dnl the Qt framework being installed on the same machine. Without
|
---|
| 9 | dnl options, the macro is designed to look for the latest library,
|
---|
| 10 | dnl i.e., the highest definition of QT_VERSION in qglobal.h. By use of
|
---|
| 11 | dnl one or more options a different library may be selected. There are
|
---|
| 12 | dnl two different sets of options. Both sets contain the option
|
---|
| 13 | dnl --with-Qt-lib=LIB which can be used to force the use of a
|
---|
| 14 | dnl particular version of the library file when more than one are
|
---|
| 15 | dnl available. LIB must be in the form as it would appear behind the
|
---|
| 16 | dnl "-l" option to the compiler. Examples for LIB would be "qt-mt" for
|
---|
| 17 | dnl the multi-threaded version and "qt" for the regular version. In
|
---|
| 18 | dnl addition to this, the first set consists of an option
|
---|
| 19 | dnl --with-Qt-dir=DIR which can be used when the installation conforms
|
---|
| 20 | dnl to Trolltech's standard installation, which means that header files
|
---|
| 21 | dnl are in DIR/include, binary utilities are in DIR/bin and the library
|
---|
| 22 | dnl is in DIR/lib. The second set of options can be used to indicate
|
---|
| 23 | dnl individual locations for the header files, the binary utilities and
|
---|
| 24 | dnl the library file, in addition to the specific version of the
|
---|
| 25 | dnl library file.
|
---|
| 26 | dnl
|
---|
| 27 | dnl The following shell variable is set to either "yes" or "no":
|
---|
| 28 | dnl
|
---|
| 29 | dnl have_qt
|
---|
| 30 | dnl
|
---|
| 31 | dnl Additionally, the following variables are exported:
|
---|
| 32 | dnl
|
---|
| 33 | dnl QT_CXXFLAGS
|
---|
| 34 | dnl QT_LIBS
|
---|
| 35 | dnl QT_MOC
|
---|
| 36 | dnl QT_RCC
|
---|
| 37 | dnl QT_UIC
|
---|
| 38 | dnl QT_DIR
|
---|
| 39 | dnl
|
---|
| 40 | dnl which respectively contain an "-I" flag pointing to the Qt include
|
---|
| 41 | dnl directory (and "-DQT_THREAD_SUPPORT" when LIB is "qt-mt"), link
|
---|
| 42 | dnl flags necessary to link with Qt and X, the name of the meta object
|
---|
| 43 | dnl compiler and the user interface compiler both with full path, and
|
---|
| 44 | dnl finaly the variable QTDIR as Trolltech likes to see it defined (if
|
---|
| 45 | dnl possible).
|
---|
| 46 | dnl
|
---|
| 47 | dnl Example lines for Makefile.in:
|
---|
| 48 | dnl
|
---|
| 49 | dnl CXXFLAGS = @QT_CXXFLAGS@
|
---|
| 50 | dnl MOC = @QT_MOC@
|
---|
| 51 | dnl
|
---|
| 52 | dnl After the variables have been set, a trial compile and link is
|
---|
| 53 | dnl performed to check the correct functioning of the meta object
|
---|
| 54 | dnl compiler. This test may fail when the different detected elements
|
---|
| 55 | dnl stem from different releases of the Qt framework. In that case, an
|
---|
| 56 | dnl error message is emitted and configure stops.
|
---|
| 57 | dnl
|
---|
| 58 | dnl No common variables such as $LIBS or $CFLAGS are polluted.
|
---|
| 59 | dnl
|
---|
| 60 | dnl Options:
|
---|
| 61 | dnl
|
---|
| 62 | dnl --with-Qt-dir=DIR: DIR is equal to $QTDIR if you have followed the
|
---|
| 63 | dnl installation instructions of Trolltech. Header files are in
|
---|
| 64 | dnl DIR/include, binary utilities are in DIR/bin and the library is in
|
---|
| 65 | dnl DIR/lib.
|
---|
| 66 | dnl
|
---|
| 67 | dnl --with-Qt-include-dir=DIR: Qt header files are in DIR.
|
---|
| 68 | dnl
|
---|
| 69 | dnl --with-Qt-bin-dir=DIR: Qt utilities such as moc and uic are in DIR.
|
---|
| 70 | dnl
|
---|
| 71 | dnl --with-Qt-lib-dir=DIR: The Qt library is in DIR.
|
---|
| 72 | dnl
|
---|
| 73 | dnl --with-Qt-lib=LIB: Use -lLIB to link with the Qt library.
|
---|
| 74 | dnl
|
---|
| 75 | dnl If some option "=no" or, equivalently, a --without-Qt-* version is
|
---|
| 76 | dnl given in stead of a --with-Qt-*, "have_qt" is set to "no" and the
|
---|
| 77 | dnl other variables are set to the empty string.
|
---|
| 78 | dnl
|
---|
| 79 | dnl @category InstalledPackages
|
---|
| 80 | dnl @author Bastiaan Veelo <Bastiaan@Veelo.net>
|
---|
| 81 | dnl @version 2006-03-12
|
---|
| 82 | dnl @license AllPermissive
|
---|
| 83 | dnl
|
---|
| 84 | dnl Note by Frederik Heber <heber@ins.uni-bonn.de>
|
---|
| 85 | dnl added fix from RTXI manual:
|
---|
| 86 | dnl if configure throws with "syntax error in line blabla" when checking Qt,
|
---|
| 87 | dnl then it is because of empty if-then-else construct, add line with single
|
---|
| 88 | dnl colon ":" in it to (leave bnv_qt_lib_dir defined).
|
---|
| 89 | dnl
|
---|
| 90 | dnl Second Note by Frederik Heber <heber@ins.uni-bonn.de>
|
---|
| 91 | dnl some changes by me, to get it working with Qt4 and Qwt
|
---|
| 92 | dnl - bnv_qt_include_dir is now list of dirs, extended to -I<> syntax
|
---|
| 93 | dnl - all subdirs of qt-include directory
|
---|
| 94 | dnl - look for lib[[Qq]]t not only libqt
|
---|
| 95 | dnl
|
---|
| 96 | dnl Third Note by Frederik Heber <heber@ins.uni-bonn.de>
|
---|
| 97 | dnl added QT_RCC flag
|
---|
| 98 | dnl
|
---|
| 99 | dnl Fourth Note by Frederik Heber <heber@ins.uni-bonn.de>
|
---|
| 100 | dnl some changes to get it working with Ubuntu 10.04
|
---|
| 101 | dnl - bn_qt_lib_dir is now issued when specified --with-qt-dir
|
---|
| 102 | dnl - removed libXt and libXi which are just shared libs linked in
|
---|
| 103 | dnl the other libs
|
---|
| 104 |
|
---|
| 105 | dnl Copyright (C) 2001, 2002, 2003, 2005, 2006 Bastiaan Veelo
|
---|
| 106 |
|
---|
| 107 | dnl THANKS! This code includes bug fixes and contributions made by:
|
---|
| 108 | dnl Tim McClarren,
|
---|
| 109 | dnl Dennis R. Weilert,
|
---|
| 110 | dnl Qingning Huo,
|
---|
| 111 | dnl Brian Mingus,
|
---|
| 112 | dnl Jens Hannemann,
|
---|
| 113 | dnl Pavel Roskin,
|
---|
| 114 | dnl Scott J. Bertin.
|
---|
| 115 |
|
---|
| 116 | dnl ChangeLog
|
---|
| 117 | dnl 2006-03-12 * Hide output of ls and fix an m4 quoting problem (due to Scott J. Bertin).
|
---|
| 118 | dnl 2006-02-13 * Check compiler return value instead of parsing the error stream,
|
---|
| 119 | dnl which detected warnings as false negatives (due to Jens Hannemann).
|
---|
| 120 | dnl 2006-02-02 * Spelling of "Success".
|
---|
| 121 | dnl * Fixed unsave test for $bnv_qt_lib without quotes.
|
---|
| 122 | dnl * Put dnl in front of all comments.
|
---|
| 123 | dnl * Changed -l$bnv_qt_lib_dir into -L$bnv_qt_lib_dir (all due to Pavel Roskin).
|
---|
| 124 | dnl 2006-01-19 * Support for 64bit architectures.
|
---|
| 125 | dnl * Updated documentation.
|
---|
| 126 | dnl 2006-01-18: * Fix "cat: bnv_qt_test.c: No such file or directory" (due to Jens Hannemann).
|
---|
| 127 | dnl * Hide output of failing ls.
|
---|
| 128 | dnl 2006-01-11: * Check in /Developer on Mac OS X; Check in $QTDIR (due to Brian Mingus).
|
---|
| 129 |
|
---|
| 130 | dnl Calls BNV_PATH_QT_DIRECT (contained in this file) as a subroutine.
|
---|
| 131 | AC_DEFUN([BNV_HAVE_QT],
|
---|
| 132 | [
|
---|
| 133 | AC_REQUIRE([AC_PROG_CXX])
|
---|
| 134 | AC_REQUIRE([AC_PATH_X])
|
---|
| 135 | AC_REQUIRE([AC_PATH_XTRA])
|
---|
| 136 |
|
---|
| 137 | AC_MSG_CHECKING(for Qt)
|
---|
| 138 |
|
---|
| 139 | AC_ARG_WITH([Qt-dir],
|
---|
| 140 | [ --with-Qt-dir=DIR DIR is equal to $QTDIR if you have followed the
|
---|
| 141 | installation instructions of Trolltech. Header
|
---|
| 142 | files are in DIR/include, binary utilities are
|
---|
| 143 | in DIR/bin. The library is in DIR/lib, unless
|
---|
| 144 | --with-Qt-lib-dir is also set.])
|
---|
| 145 | AC_ARG_WITH([Qt-include-dir],
|
---|
| 146 | [ --with-Qt-include-dir=DIR
|
---|
| 147 | Qt header files are in DIR])
|
---|
| 148 | AC_ARG_WITH([Qt-bin-dir],
|
---|
| 149 | [ --with-Qt-bin-dir=DIR Qt utilities such as moc and uic are in DIR])
|
---|
| 150 | AC_ARG_WITH([Qt-lib-dir],
|
---|
| 151 | [ --with-Qt-lib-dir=DIR The Qt library is in DIR])
|
---|
| 152 | AC_ARG_WITH([Qt-lib],
|
---|
| 153 | [ --with-Qt-lib=LIB Use -lLIB to link with the Qt library])
|
---|
| 154 | if test x"$with_Qt_dir" = x"no" ||
|
---|
| 155 | test x"$with_Qt_include-dir" = x"no" ||
|
---|
| 156 | test x"$with_Qt_bin_dir" = x"no" ||
|
---|
| 157 | test x"$with_Qt_lib_dir" = x"no" ||
|
---|
| 158 | test x"$with_Qt_lib" = x"no"; then
|
---|
| 159 | # user disabled Qt. Leave cache alone.
|
---|
| 160 | have_qt="User disabled Qt."
|
---|
| 161 | else
|
---|
| 162 | # "yes" is a bogus option
|
---|
| 163 | if test x"$with_Qt_dir" = xyes; then
|
---|
| 164 | with_Qt_dir=
|
---|
| 165 | fi
|
---|
| 166 | if test x"$with_Qt_include_dir" = xyes; then
|
---|
| 167 | with_Qt_include_dir=
|
---|
| 168 | fi
|
---|
| 169 | if test x"$with_Qt_bin_dir" = xyes; then
|
---|
| 170 | with_Qt_bin_dir=
|
---|
| 171 | fi
|
---|
| 172 | if test x"$with_Qt_lib_dir" = xyes; then
|
---|
| 173 | with_Qt_lib_dir=
|
---|
| 174 | fi
|
---|
| 175 | if test x"$with_Qt_lib" = xyes; then
|
---|
| 176 | with_Qt_lib=
|
---|
| 177 | fi
|
---|
| 178 | # No Qt unless we discover otherwise
|
---|
| 179 | have_qt=no
|
---|
| 180 | # Check whether we are requested to link with a specific version
|
---|
| 181 | if test x"$with_Qt_lib" != x; then
|
---|
| 182 | bnv_qt_lib="$with_Qt_lib"
|
---|
| 183 | fi
|
---|
| 184 | # Check whether we were supplied with an answer already
|
---|
| 185 | if test x"$with_Qt_dir" != x; then
|
---|
| 186 | have_qt=yes
|
---|
| 187 | bnv_qt_dir="$with_Qt_dir"
|
---|
| 188 | if test x`echo $with_Qt_dir | grep qt3` != x; then
|
---|
| 189 | # qt3
|
---|
| 190 | bnv_qt_include_dir="$with_Qt_dir/include"
|
---|
| 191 | else
|
---|
| 192 | # Qt4
|
---|
| 193 | bnv_qt_include_dir="$with_Qt_dir/include"
|
---|
| 194 | # FH: due to laziness of certain programmers and to simulate qmake
|
---|
| 195 | # bhavior, we have to add all subdirectories, too
|
---|
| 196 | for dir in `ls $with_Qt_dir/include`
|
---|
| 197 | do
|
---|
| 198 | bnv_qt_include_dir="${bnv_qt_include_dir} $with_Qt_dir/include/$dir"
|
---|
| 199 | done
|
---|
| 200 | fi
|
---|
| 201 | bnv_qt_bin_dir="$with_Qt_dir/bin"
|
---|
| 202 | if test x"$with_Qt_lib_dir" != x; then
|
---|
| 203 | bnv_qt_lib_dir="$with_Qt_lib_dir"
|
---|
| 204 | else
|
---|
| 205 | bnv_qt_lib_dir="$with_Qt_dir/lib"
|
---|
| 206 | fi
|
---|
| 207 | # Only search for the lib if the user did not define one already
|
---|
| 208 | if test x"$bnv_qt_lib" = x; then
|
---|
| 209 | bnv_qt_lib="`ls $bnv_qt_lib_dir/lib[[Qq]]t* | sed -n 1p |
|
---|
| 210 | sed s@$bnv_qt_lib_dir/lib@@ | [sed s@[.].*@@]`"
|
---|
| 211 | fi
|
---|
| 212 | bnv_qt_LIBS="-L$bnv_qt_lib_dir -l$bnv_qt_lib $X_PRE_LIBS $X_LIBS -lX11 -lXext $X_EXTRA_LIBS"
|
---|
| 213 | else
|
---|
| 214 | # Use cached value or do search, starting with suggestions from
|
---|
| 215 | # the command line
|
---|
| 216 | AC_CACHE_VAL(bnv_cv_have_qt,
|
---|
| 217 | [
|
---|
| 218 | # We are not given a solution and there is no cached value.
|
---|
| 219 | bnv_qt_dir=NO
|
---|
| 220 | bnv_qt_include_dir=NO
|
---|
| 221 | bnv_qt_lib_dir=NO
|
---|
| 222 | if test x"$bnv_qt_lib" = x; then
|
---|
| 223 | bnv_qt_lib=NO
|
---|
| 224 | fi
|
---|
| 225 | BNV_PATH_QT_DIRECT
|
---|
| 226 | if test "$bnv_qt_dir" = NO ||
|
---|
| 227 | test "$bnv_qt_include_dir" = NO ||
|
---|
| 228 | test "$bnv_qt_lib_dir" = NO ||
|
---|
| 229 | test "$bnv_qt_lib" = NO; then
|
---|
| 230 | # Problem with finding complete Qt. Cache the known absence of Qt.
|
---|
| 231 | bnv_cv_have_qt="have_qt=no"
|
---|
| 232 | else
|
---|
| 233 | # Record where we found Qt for the cache.
|
---|
| 234 | bnv_cv_have_qt="have_qt=yes \
|
---|
| 235 | bnv_qt_dir=$bnv_qt_dir \
|
---|
| 236 | bnv_qt_include_dir=$bnv_qt_include_dir \
|
---|
| 237 | bnv_qt_bin_dir=$bnv_qt_bin_dir \
|
---|
| 238 | bnv_qt_LIBS=\"$bnv_qt_LIBS\""
|
---|
| 239 | fi
|
---|
| 240 | ])dnl
|
---|
| 241 | eval "$bnv_cv_have_qt"
|
---|
| 242 | fi # all $bnv_qt_* are set
|
---|
| 243 | fi # $have_qt reflects the system status
|
---|
| 244 | if test x"$have_qt" = xyes; then
|
---|
| 245 | # FH: expect a list of dirs and add all
|
---|
| 246 | for dir in $bnv_qt_include_dir
|
---|
| 247 | do
|
---|
| 248 | QT_CXXFLAGS="${QT_CXXFLAGS} -I${dir}"
|
---|
| 249 | done
|
---|
| 250 | if test x"$bnv_qt_lib" = xqt-mt; then
|
---|
| 251 | QT_CXXFLAGS="$QT_CXXFLAGS -DQT_THREAD_SUPPORT"
|
---|
| 252 | fi
|
---|
| 253 | QT_DIR="$bnv_qt_dir"
|
---|
| 254 | QT_LIBS="$bnv_qt_LIBS"
|
---|
| 255 | # If bnv_qt_dir is defined, utilities are expected to be in the
|
---|
| 256 | # bin subdirectory
|
---|
| 257 | if test x"$bnv_qt_dir" != x; then
|
---|
| 258 | if test -x "$bnv_qt_dir/bin/uic"; then
|
---|
| 259 | QT_UIC="$bnv_qt_dir/bin/uic"
|
---|
| 260 | else
|
---|
| 261 | # Old versions of Qt don't have uic
|
---|
| 262 | QT_UIC=
|
---|
| 263 | fi
|
---|
| 264 | QT_MOC="$bnv_qt_dir/bin/moc"
|
---|
| 265 | QT_RCC="$bnv_qt_dir/bin/rcc"
|
---|
| 266 | else
|
---|
| 267 | # Or maybe we are told where to look for the utilities
|
---|
| 268 | if test x"$bnv_qt_bin_dir" != x; then
|
---|
| 269 | if test -x "$bnv_qt_bin_dir/uic"; then
|
---|
| 270 | QT_UIC="$bnv_qt_bin_dir/uic"
|
---|
| 271 | else
|
---|
| 272 | # Old versions of Qt don't have uic
|
---|
| 273 | QT_UIC=
|
---|
| 274 | fi
|
---|
| 275 | QT_MOC="$bnv_qt_bin_dir/moc"
|
---|
| 276 | QT_RCC="$bnv_qt_bin_dir/rcc"
|
---|
| 277 | else
|
---|
| 278 | # Last possibility is that they are in $PATH
|
---|
| 279 | QT_UIC="`which uic`"
|
---|
| 280 | QT_MOC="`which moc`"
|
---|
| 281 | QT_RCC="`which rcc`"
|
---|
| 282 | fi
|
---|
| 283 | fi
|
---|
| 284 | # All variables are defined, report the result
|
---|
| 285 | AC_MSG_RESULT([$have_qt:
|
---|
| 286 | QT_CXXFLAGS=$QT_CXXFLAGS
|
---|
| 287 | QT_DIR=$QT_DIR
|
---|
| 288 | QT_LIBS=$QT_LIBS
|
---|
| 289 | QT_UIC=$QT_UIC
|
---|
| 290 | QT_MOC=$QT_MOC
|
---|
| 291 | QT_RCC=$QT_RCC])
|
---|
| 292 | else
|
---|
| 293 | # Qt was not found
|
---|
| 294 | QT_CXXFLAGS=
|
---|
| 295 | QT_DIR=
|
---|
| 296 | QT_LIBS=
|
---|
| 297 | QT_UIC=
|
---|
| 298 | QT_MOC=
|
---|
| 299 | QT_RCC=
|
---|
| 300 | AC_MSG_RESULT($have_qt)
|
---|
| 301 | fi
|
---|
| 302 | AC_SUBST(QT_CXXFLAGS)
|
---|
| 303 | AC_SUBST(QT_DIR)
|
---|
| 304 | AC_SUBST(QT_LIBS)
|
---|
| 305 | AC_SUBST(QT_UIC)
|
---|
| 306 | AC_SUBST(QT_MOC)
|
---|
| 307 | AC_SUBST(QT_RCC)
|
---|
| 308 |
|
---|
| 309 | #### Being paranoid:
|
---|
| 310 | if test x"$have_qt" = xyes; then
|
---|
| 311 | AC_MSG_CHECKING(correct functioning of Qt installation)
|
---|
| 312 | AC_CACHE_VAL(bnv_cv_qt_test_result,
|
---|
| 313 | [
|
---|
| 314 | cat > bnv_qt_test.h << EOF
|
---|
| 315 | #include <qobject.h>
|
---|
| 316 | class Test : public QObject
|
---|
| 317 | {
|
---|
| 318 | Q_OBJECT
|
---|
| 319 | public:
|
---|
| 320 | Test() {}
|
---|
| 321 | ~Test() {}
|
---|
| 322 | public slots:
|
---|
| 323 | void receive() {}
|
---|
| 324 | signals:
|
---|
| 325 | void send();
|
---|
| 326 | };
|
---|
| 327 | EOF
|
---|
| 328 |
|
---|
| 329 | cat > bnv_qt_main.$ac_ext << EOF
|
---|
| 330 | #include "bnv_qt_test.h"
|
---|
| 331 | #include <qapplication.h>
|
---|
| 332 | int main( int argc, char **argv )
|
---|
| 333 | {
|
---|
| 334 | QApplication app( argc, argv );
|
---|
| 335 | Test t;
|
---|
| 336 | QObject::connect( &t, SIGNAL(send()), &t, SLOT(receive()) );
|
---|
| 337 | }
|
---|
| 338 | EOF
|
---|
| 339 |
|
---|
| 340 | bnv_cv_qt_test_result="failure"
|
---|
| 341 | bnv_try_1="$QT_MOC bnv_qt_test.h -o moc_bnv_qt_test.$ac_ext >/dev/null 2>/dev/null"
|
---|
| 342 | AC_TRY_EVAL(bnv_try_1)
|
---|
| 343 | if test x"$ac_status" != x0; then
|
---|
| 344 | echo "$bnv_err_1" >&AC_FD_CC
|
---|
| 345 | echo "configure: could not run $QT_MOC on:" >&AC_FD_CC
|
---|
| 346 | cat bnv_qt_test.h >&AC_FD_CC
|
---|
| 347 | else
|
---|
| 348 | bnv_try_2="$CXX $QT_CXXFLAGS -c $CXXFLAGS -o moc_bnv_qt_test.o moc_bnv_qt_test.$ac_ext >/dev/null 2>/dev/null"
|
---|
| 349 | AC_TRY_EVAL(bnv_try_2)
|
---|
| 350 | if test x"$ac_status" != x0; then
|
---|
| 351 | echo "$bnv_err_2" >&AC_FD_CC
|
---|
| 352 | echo "configure: could not compile:" >&AC_FD_CC
|
---|
| 353 | cat moc_bnv_qt_test.$ac_ext >&AC_FD_CC
|
---|
| 354 | else
|
---|
| 355 | bnv_try_3="$CXX $QT_CXXFLAGS -c $CXXFLAGS -o bnv_qt_main.o bnv_qt_main.$ac_ext >/dev/null 2>/dev/null"
|
---|
| 356 | AC_TRY_EVAL(bnv_try_3)
|
---|
| 357 | if test x"$ac_status" != x0; then
|
---|
| 358 | echo "$bnv_err_3" >&AC_FD_CC
|
---|
| 359 | echo "configure: could not compile:" >&AC_FD_CC
|
---|
| 360 | cat bnv_qt_main.$ac_ext >&AC_FD_CC
|
---|
| 361 | else
|
---|
| 362 | bnv_try_4="$CXX $QT_LIBS $LIBS -o bnv_qt_main bnv_qt_main.o moc_bnv_qt_test.o >/dev/null 2>/dev/null"
|
---|
| 363 | AC_TRY_EVAL(bnv_try_4)
|
---|
| 364 | if test x"$ac_status" != x0; then
|
---|
| 365 | echo "$bnv_err_4" >&AC_FD_CC
|
---|
| 366 | else
|
---|
| 367 | bnv_cv_qt_test_result="success"
|
---|
| 368 | fi
|
---|
| 369 | fi
|
---|
| 370 | fi
|
---|
| 371 | fi
|
---|
| 372 | ])dnl AC_CACHE_VAL bnv_cv_qt_test_result
|
---|
| 373 | AC_MSG_RESULT([$bnv_cv_qt_test_result]);
|
---|
| 374 | if test x"$bnv_cv_qt_test_result" = "xfailure"; then
|
---|
| 375 | AC_MSG_ERROR([Failed to find matching components of a complete
|
---|
| 376 | Qt installation. Try using more options,
|
---|
| 377 | see ./configure --help.])
|
---|
| 378 | fi
|
---|
| 379 |
|
---|
| 380 | rm -f bnv_qt_test.h moc_bnv_qt_test.$ac_ext moc_bnv_qt_test.o \
|
---|
| 381 | bnv_qt_main.$ac_ext bnv_qt_main.o bnv_qt_main
|
---|
| 382 | fi
|
---|
| 383 | ])
|
---|
| 384 |
|
---|
| 385 | dnl Internal subroutine of BNV_HAVE_QT
|
---|
| 386 | dnl Set bnv_qt_dir bnv_qt_include_dir bnv_qt_bin_dir bnv_qt_lib_dir bnv_qt_lib
|
---|
| 387 | AC_DEFUN([BNV_PATH_QT_DIRECT],
|
---|
| 388 | [
|
---|
| 389 | ## Binary utilities ##
|
---|
| 390 | if test x"$with_Qt_bin_dir" != x; then
|
---|
| 391 | bnv_qt_bin_dir=$with_Qt_bin_dir
|
---|
| 392 | fi
|
---|
| 393 | ## Look for header files ##
|
---|
| 394 | if test x"$with_Qt_include_dir" != x; then
|
---|
| 395 | bnv_qt_include_dir="$with_Qt_include_dir"
|
---|
| 396 | else
|
---|
| 397 | # The following header file is expected to define QT_VERSION.
|
---|
| 398 | qt_direct_test_header=qglobal.h
|
---|
| 399 | # Look for the header file in a standard set of common directories.
|
---|
| 400 | # FH: added some more system directories, also fuer qt4
|
---|
| 401 | bnv_include_path_list="
|
---|
| 402 | /usr/include
|
---|
| 403 | `ls -dr ${QTDIR}/include 2>/dev/null`
|
---|
| 404 | `ls -dr /usr/share/qt*/include/ 2>/dev/null`
|
---|
| 405 | `ls -dr /usr/share/qt*/include/Qt/ 2>/dev/null`
|
---|
| 406 | `ls -dr /usr/include/qt* 2>/dev/null`
|
---|
| 407 | `ls -dr /usr/lib/qt*/include 2>/dev/null`
|
---|
| 408 | `ls -dr /usr/local/qt*/include 2>/dev/null`
|
---|
| 409 | `ls -dr /opt/qt*/include 2>/dev/null`
|
---|
| 410 | `ls -dr /Developer/qt*/include 2>/dev/null`
|
---|
| 411 | "
|
---|
| 412 | for bnv_dir in $bnv_include_path_list; do
|
---|
| 413 | if test -r "$bnv_dir/$qt_direct_test_header"; then
|
---|
| 414 | bnv_dirs="$bnv_dirs $bnv_dir"
|
---|
| 415 | fi
|
---|
| 416 | done
|
---|
| 417 | # Now look for the newest in this list
|
---|
| 418 | bnv_prev_ver=0
|
---|
| 419 | for bnv_dir in $bnv_dirs; do
|
---|
| 420 | bnv_this_ver=`egrep -w '#define QT_VERSION' $bnv_dir/$qt_direct_test_header | sed s/'#define QT_VERSION'//`
|
---|
| 421 | if expr $bnv_this_ver '>' $bnv_prev_ver > /dev/null; then
|
---|
| 422 | bnv_qt_include_dir=$bnv_dir
|
---|
| 423 | bnv_prev_ver=$bnv_this_ver
|
---|
| 424 | fi
|
---|
| 425 | done
|
---|
| 426 | fi dnl Found header files.
|
---|
| 427 |
|
---|
| 428 | # Are these headers located in a traditional Trolltech installation?
|
---|
| 429 | # That would be $bnv_qt_include_dir stripped from its last element:
|
---|
| 430 | bnv_possible_qt_dir=`dirname $bnv_qt_include_dir`
|
---|
| 431 | if (test -x $bnv_possible_qt_dir/bin/moc) &&
|
---|
| 432 | ((ls $bnv_possible_qt_dir/lib/lib[[Qq]]t* > /dev/null 2>/dev/null) ||
|
---|
| 433 | (ls $bnv_possible_qt_dir/lib64/lib[[Qq]]t* > /dev/null 2>/dev/null)); then
|
---|
| 434 | # Then the rest is a piece of cake
|
---|
| 435 | bnv_qt_dir=$bnv_possible_qt_dir
|
---|
| 436 | bnv_qt_bin_dir="$bnv_qt_dir/bin"
|
---|
| 437 | if test x"$with_Qt_lib_dir" != x; then
|
---|
| 438 | bnv_qt_lib_dir="$with_Qt_lib_dir"
|
---|
| 439 | else
|
---|
| 440 | if (test -d $bnv_qt_dir/lib64); then
|
---|
| 441 | bnv_qt_lib_dir="$bnv_qt_dir/lib64"
|
---|
| 442 | else
|
---|
| 443 | bnv_qt_lib_dir="$bnv_qt_dir/lib"
|
---|
| 444 | fi
|
---|
| 445 | fi
|
---|
| 446 | # Only look for lib if the user did not supply it already
|
---|
| 447 | if test x"$bnv_qt_lib" = xNO; then
|
---|
| 448 | bnv_qt_lib="`ls $bnv_qt_lib_dir/lib[[Qq]]t* | sed -n 1p |
|
---|
| 449 | sed s@$bnv_qt_lib_dir/lib@@ | [sed s@[.].*@@]`"
|
---|
| 450 | fi
|
---|
| 451 | bnv_qt_LIBS="-L$bnv_qt_lib_dir -l$bnv_qt_lib $X_PRE_LIBS $X_LIBS -lX11 -lXext $X_EXTRA_LIBS"
|
---|
| 452 | else
|
---|
| 453 | # There is no valid definition for $QTDIR as Trolltech likes to see it
|
---|
| 454 | bnv_qt_dir=
|
---|
| 455 | ## Look for Qt library ##
|
---|
| 456 | if test x"$with_Qt_lib_dir" != x; then
|
---|
| 457 | bnv_qt_lib_dir="$with_Qt_lib_dir"
|
---|
| 458 | # Only look for lib if the user did not supply it already
|
---|
| 459 | if test x"$bnv_qt_lib" = xNO; then
|
---|
| 460 | bnv_qt_lib="`ls $bnv_qt_lib_dir/lib[[Qq]]t* | sed -n 1p |
|
---|
| 461 | sed s@$bnv_qt_lib_dir/lib@@ | [sed s@[.].*@@]`"
|
---|
| 462 | fi
|
---|
| 463 | bnv_qt_LIBS="-L$bnv_qt_lib_dir -l$bnv_qt_lib $X_PRE_LIBS $X_LIBS -lX11 -lXext $X_EXTRA_LIBS"
|
---|
| 464 | else
|
---|
| 465 | # Normally, when there is no traditional Trolltech installation,
|
---|
| 466 | # the library is installed in a place where the linker finds it
|
---|
| 467 | # automatically.
|
---|
| 468 | # If the user did not define the library name, try with qt
|
---|
| 469 | if test x"$bnv_qt_lib" = xNO; then
|
---|
| 470 | bnv_qt_lib=qt
|
---|
| 471 | fi
|
---|
| 472 | qt_direct_test_header=qapplication.h
|
---|
| 473 | qt_direct_test_main="
|
---|
| 474 | int argc;
|
---|
| 475 | char ** argv;
|
---|
| 476 | QApplication app(argc,argv);
|
---|
| 477 | "
|
---|
| 478 | # See if we find the library without any special options.
|
---|
| 479 | # Don't add top $LIBS permanently yet
|
---|
| 480 | bnv_save_LIBS="$LIBS"
|
---|
| 481 | LIBS="-l$bnv_qt_lib $X_PRE_LIBS $X_LIBS -lX11 -lXext $X_EXTRA_LIBS"
|
---|
| 482 | bnv_qt_LIBS="$LIBS"
|
---|
| 483 | bnv_save_CXXFLAGS="$CXXFLAGS"
|
---|
| 484 | CXXFLAGS="-I$bnv_qt_include_dir"
|
---|
| 485 | AC_TRY_LINK([#include <$qt_direct_test_header>],
|
---|
| 486 | $qt_direct_test_main,
|
---|
| 487 | [
|
---|
| 488 | # Success.
|
---|
| 489 | # We can link with no special library directory.
|
---|
| 490 | bnv_qt_lib_dir=
|
---|
| 491 | ], [
|
---|
| 492 | # That did not work. Try the multi-threaded version
|
---|
| 493 | echo "Non-critical error, please neglect the above." >&AC_FD_CC
|
---|
| 494 | bnv_qt_lib=qt-mt
|
---|
| 495 | LIBS="-l$bnv_qt_lib $X_PRE_LIBS $X_LIBS -lX11 -lXext $X_EXTRA_LIBS"
|
---|
| 496 | AC_TRY_LINK([#include <$qt_direct_test_header>],
|
---|
| 497 | $qt_direct_test_main,
|
---|
| 498 | [
|
---|
| 499 | # Success.
|
---|
| 500 | # We can link with no special library directory.
|
---|
| 501 | bnv_qt_lib_dir=
|
---|
| 502 | ], [
|
---|
| 503 | # That did not work. Try the OpenGL version
|
---|
| 504 | echo "Non-critical error, please neglect the above." >&AC_FD_CC
|
---|
| 505 | bnv_qt_lib=qt-gl
|
---|
| 506 | LIBS="-l$bnv_qt_lib $X_PRE_LIBS $X_LIBS -lX11 -lXext $X_EXTRA_LIBS"
|
---|
| 507 | AC_TRY_LINK([#include <$qt_direct_test_header>],
|
---|
| 508 | $qt_direct_test_main,
|
---|
| 509 | [
|
---|
| 510 | # Success.
|
---|
| 511 | # We can link with no special library directory.
|
---|
| 512 | bnv_qt_lib_dir=
|
---|
| 513 | ], [
|
---|
| 514 | # That did not work. Maybe a library version I don't know about?
|
---|
| 515 | echo "Non-critical error, please neglect the above." >&AC_FD_CC
|
---|
| 516 | # Look for some Qt lib in a standard set of common directories.
|
---|
| 517 | bnv_dir_list="
|
---|
| 518 | `echo $bnv_qt_includes | sed ss/includess`
|
---|
| 519 | /lib
|
---|
| 520 | /usr/lib64
|
---|
| 521 | /usr/lib
|
---|
| 522 | /usr/local/lib64
|
---|
| 523 | /usr/local/lib
|
---|
| 524 | /opt/lib64
|
---|
| 525 | /opt/lib
|
---|
| 526 | `ls -dr /usr/lib64/qt* 2>/dev/null`
|
---|
| 527 | `ls -dr /usr/lib64/qt*/lib64 2>/dev/null`
|
---|
| 528 | `ls -dr /usr/lib/qt* 2>/dev/null`
|
---|
| 529 | `ls -dr /usr/local/qt* 2>/dev/null`
|
---|
| 530 | `ls -dr /opt/qt* 2>/dev/null`
|
---|
| 531 | "
|
---|
| 532 | for bnv_dir in $bnv_dir_list; do
|
---|
| 533 | if ls $bnv_dir/lib[[Qq]]t* >/dev/null 2>/dev/null; then
|
---|
| 534 | # Gamble that it's the first one...
|
---|
| 535 | bnv_qt_lib="`ls $bnv_dir/lib[[Qq]]t* | sed -n 1p |
|
---|
| 536 | sed s@$bnv_dir/lib@@ | sed s/[[.]].*//`"
|
---|
| 537 | bnv_qt_lib_dir="$bnv_dir"
|
---|
| 538 | break
|
---|
| 539 | fi
|
---|
| 540 | done
|
---|
| 541 | # Try with that one
|
---|
| 542 | LIBS="-l$bnv_qt_lib $X_PRE_LIBS $X_LIBS -lX11 -lXext $X_EXTRA_LIBS"
|
---|
| 543 | AC_TRY_LINK([#include <$qt_direct_test_header>],
|
---|
| 544 | $qt_direct_test_main,
|
---|
| 545 | [
|
---|
| 546 | # Success.
|
---|
| 547 | # We can link with no special library directory.
|
---|
| 548 | bnv_qt_lib_dir=
|
---|
| 549 | ], [
|
---|
| 550 | :
|
---|
| 551 | # Leave bnv_qt_lib_dir defined
|
---|
| 552 | ])
|
---|
| 553 | ])
|
---|
| 554 | ])
|
---|
| 555 | ])
|
---|
| 556 | if test x"$bnv_qt_lib_dir" != x; then
|
---|
| 557 | bnv_qt_LIBS="-L$bnv_qt_lib_dir $LIBS"
|
---|
| 558 | else
|
---|
| 559 | bnv_qt_LIBS="$LIBS"
|
---|
| 560 | fi
|
---|
| 561 | LIBS="$bnv_save_LIBS"
|
---|
| 562 | CXXFLAGS="$bnv_save_CXXFLAGS"
|
---|
| 563 | fi dnl $with_Qt_lib_dir was not given
|
---|
| 564 | fi dnl Done setting up for non-traditional Trolltech installation
|
---|
| 565 | ])
|
---|