Next: , Previous: , Up: The Macros  


ax_have_qt

Synopsis

AX_HAVE_QT [--with-Qt-dir=DIR] [--with-Qt-lib-dir=DIR] [--with-Qt-lib=LIB]
AX_HAVE_QT [--with-Qt-include-dir=DIR] [--with-Qt-bin-dir=DIR] [--with-Qt-lib-dir=DIR] [--with-Qt-lib=LIB]

Description

Searches common directories for Qt include files, libraries and Qt binary utilities. The macro supports several different versions of the Qt framework being installed on the same machine. Without options, the macro is designed to look for the latest library, i.e., the highest definition of QT_VERSION in qglobal.h. By use of one or more options a different library may be selected. There are two different sets of options. Both sets contain the option –with-Qt-lib=LIB which can be used to force the use of a particular version of the library file when more than one are available. LIB must be in the form as it would appear behind the "-l" option to the compiler. Examples for LIB would be "qt-mt" for the multi-threaded version and "qt" for the regular version. In addition to this, the first set consists of an option –with-Qt-dir=DIR which can be used when the installation conforms to Trolltech’s standard installation, which means that header files are in DIR/include, binary utilities are in DIR/bin and the library is in DIR/lib. The second set of options can be used to indicate individual locations for the header files, the binary utilities and the library file, in addition to the specific version of the library file.

The following shell variable is set to either "yes" or "no":

  have_qt

Additionally, the following variables are exported:

  QT_CXXFLAGS
  QT_LIBS
  QT_MOC
  QT_UIC
  QT_LRELEASE
  QT_LUPDATE
  QT_DIR

which respectively contain an "-I" flag pointing to the Qt include directory (and "-DQT_THREAD_SUPPORT" when LIB is "qt-mt"), link flags necessary to link with Qt and X, the name of the meta object compiler and the user interface compiler both with full path, and finaly the variable QTDIR as Trolltech likes to see it defined (if possible).

Example lines for Makefile.in:

  CXXFLAGS = @QT_CXXFLAGS@
  MOC      = @QT_MOC@

After the variables have been set, a trial compile and link is performed to check the correct functioning of the meta object compiler. This test may fail when the different detected elements stem from different releases of the Qt framework. In that case, an error message is emitted and configure stops.

No common variables such as $LIBS or $CFLAGS are polluted.

Options:

–with-Qt-dir=DIR: DIR is equal to $QTDIR if you have followed the installation instructions of Trolltech. Header files are in DIR/include, binary utilities are in DIR/bin and the library is in DIR/lib.

–with-Qt-include-dir=DIR: Qt header files are in DIR.

–with-Qt-bin-dir=DIR: Qt utilities such as moc and uic are in DIR.

–with-Qt-lib-dir=DIR: The Qt library is in DIR.

–with-Qt-lib=LIB: Use -lLIB to link with the Qt library.

If some option "=no" or, equivalently, a –without-Qt-* version is given in stead of a –with-Qt-*, "have_qt" is set to "no" and the other variables are set to the empty string.

Source Code

Download the latest version of ax_have_qt.m4 or browse the macro’s revision history.

License

Copyright © 2008 Bastiaan Veelo Bastiaan@Veelo.net

Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered as-is, without any warranty.


Next: , Previous: , Up: The Macros