diff options
-rw-r--r-- | acinclude.m4 | 248 | ||||
-rw-r--r-- | configure.ac | 93 |
2 files changed, 208 insertions, 133 deletions
diff --git a/acinclude.m4 b/acinclude.m4 index 9a3d0f36c5..7c5aa1e7ab 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -1948,6 +1948,61 @@ AC_DEFUN([AC_WIRESHARK_OSX_INTEGRATION_CHECK], # Based on AM_PATH_GTK in gtk-2.0.m4. +dnl AC_WIRESHARK_QT_MODULE_CHECK_WITH_QT_VERSION([MODULE, MINIMUM-VERSION, +dnl REQUESTED-MAJOR_VERSION, [ACTION-IF-FOUND, [ACTION-IF-NOT-FOUND]]]) +dnl Test for a particular Qt module, for a particular Qt major version, +dnl and, if we find it add the flags and libraries for it to Qt_CFLAGS +dnl and Qt_LIBS. +dnl +AC_DEFUN([AC_WIRESHARK_QT_MODULE_CHECK_WITH_QT_VERSION], +[ + case "$3" in + + 4) + # + # Check for Qt 4. + # + modprefix="Qt" + # + # Version of the module we're checking for. + # Default to 4.0.0. + # + min_qt_version=ifelse([$2], ,4.0.0,$2) + ;; + + 5) + # + # Check for Qt 5. + # + modprefix="Qt5" + # + # Version of the module we're checking for. + # Default to 5.0.0. + # + min_qt_version=5.0.0 + ;; + + *) + AC_MSG_ERROR([Qt version $3 is not a known Qt version]) + ;; + esac + + pkg_config_module="${modprefix}$1" + AC_MSG_CHECKING(for $pkg_config_module - version >= $min_qt_version) + if $PKG_CONFIG --atleast-version $min_qt_version $pkg_config_module; then + mod_version=`$PKG_CONFIG --modversion $pkg_config_module` + AC_MSG_RESULT(yes (version $mod_version)) + Qt_CFLAGS="$Qt_CFLAGS `$PKG_CONFIG --cflags $pkg_config_module`" + Qt_LIBS="$Qt_LIBS `$PKG_CONFIG --libs $pkg_config_module`" + # Run Action-If-Found + ifelse([$4], , :, [$4]) + else + AC_MSG_RESULT(no) + # Run Action-If-Not-Found + ifelse([$5], , :, [$5]) + fi +]) + dnl AC_WIRESHARK_QT_MODULE_CHECK([MODULE, MINIMUM-VERSION, dnl REQUESTED-MAJOR_VERSION, [ACTION-IF-FOUND, [ACTION-IF-NOT-FOUND]]]) dnl Test for a particular Qt module and add the flags and libraries @@ -1958,49 +2013,30 @@ AC_DEFUN([AC_WIRESHARK_QT_MODULE_CHECK], # # Prior to Qt 5, modules were named QtXXX. # In Qt 5, they're named Qt5XXX. - # - # Try the Qt 5 version first. - # (And be prepared to add Qt6 at some point....) + # This will need to change to handle future major Qt releases. # case "$3" in yes|unspecified) # # Check for all versions of Qt we support. + # Try the Qt 5 version first. # - modprefixes="Qt5 Qt" - major_version="" - # - # Version of the module we're checking for. - # Default to 4.0.0. - # - min_qt_version=ifelse([$2], ,4.0.0,$2) + versions="5 4" ;; 4) # # Check for Qt 4. # - modprefixes="Qt" - major_version=" version 4" - # - # Version of the module we're checking for. - # Default to 4.0.0. - # - min_qt_version=ifelse([$2], ,4.0.0,$2) + versions="4" ;; 5) # # Check for Qt 5. # - modprefixes="Qt5" - major_version=" version 5" - # - # Version of the module we're checking for. - # Default to 5.0.0. - # - min_qt_version=5.0.0 + versions="5" ;; *) @@ -2008,23 +2044,18 @@ AC_DEFUN([AC_WIRESHARK_QT_MODULE_CHECK], ;; esac - for modprefix in $modprefixes + for version in $versions do - pkg_config_module="${modprefix}$1" - AC_MSG_CHECKING(for $pkg_config_module$major_version - version >= $min_qt_version) - if $PKG_CONFIG --atleast-version $min_qt_version $pkg_config_module; then - mod_version=`$PKG_CONFIG --modversion $pkg_config_module` - AC_MSG_RESULT(yes (version $mod_version)) - Qt_CFLAGS="$Qt_CFLAGS `$PKG_CONFIG --cflags $pkg_config_module`" - Qt_LIBS="$Qt_LIBS `$PKG_CONFIG --libs $pkg_config_module`" - found_$1=yes - break - else - AC_MSG_RESULT(no) + AC_WIRESHARK_QT_MODULE_CHECK_WITH_QT_VERSION($1, $2, + $version, [foundit=yes], [foundit=no]) + if test "x$foundit" = "xyes"; then + break fi done - if test "x$found_$1" = "xyes"; then + if test "x$foundit" = "xyes"; then + # Remember which version of Qt we found + qt_version=$version # Run Action-If-Found ifelse([$4], , :, [$4]) else @@ -2039,37 +2070,24 @@ dnl Test for Qt and define Qt_CFLAGS and Qt_LIBS. dnl AC_DEFUN([AC_WIRESHARK_QT_CHECK], [ - no_qt="" - - AC_PATH_TOOL(PKG_CONFIG, pkg-config, no) - - if test x$PKG_CONFIG != xno ; then - if pkg-config --atleast-pkgconfig-version 0.7 ; then - : - else - echo *** pkg-config too old; version 0.7 or better required. - no_qt=yes - PKG_CONFIG=no - fi - else - no_qt=yes - fi + qt_version_to_check="$2" - if test x"$no_qt" = x ; then - # - # OK, we have an adequate version of pkg-config. - # - # Check for the Core module; if we don't have that, - # we don't have Qt. - # - AC_WIRESHARK_QT_MODULE_CHECK(Core, $1, $2, , [no_qt=yes]) - fi + # + # Check for the Core module; if we don't have that, + # we don't have Qt. If we *do* have it, we know what + # version it is, so only check for that version of + # other modules. + # + AC_WIRESHARK_QT_MODULE_CHECK(Core, $1, $qt_version_to_check, + [qt_version_to_check=$qt_version], + [no_qt=yes]) if test x"$no_qt" = x ; then # # We need the Gui module as well. # - AC_WIRESHARK_QT_MODULE_CHECK(Gui, $1, $2, , [no_qt=yes]) + AC_WIRESHARK_QT_MODULE_CHECK(Gui, $1, $qt_version_to_check, , + [no_qt=yes]) fi if test x"$no_qt" = x ; then @@ -2078,19 +2096,19 @@ AC_DEFUN([AC_WIRESHARK_QT_CHECK], # to Qt Widgets; look for the Widgets module, but # don't fail if we don't have it. # - AC_WIRESHARK_QT_MODULE_CHECK(Widgets, $1, $2) + AC_WIRESHARK_QT_MODULE_CHECK(Widgets, $1, $qt_version_to_check) # # Qt 5.0 also appears to move the printing support into # the Qt PrintSupport module. # - AC_WIRESHARK_QT_MODULE_CHECK(PrintSupport, $1, $2) + AC_WIRESHARK_QT_MODULE_CHECK(PrintSupport, $1, $qt_version_to_check) # # Qt 5.0 added multimedia widgets in the Qt # MultimediaWidgets module. # - AC_WIRESHARK_QT_MODULE_CHECK(MultimediaWidgets, $1, $2, + AC_WIRESHARK_QT_MODULE_CHECK(MultimediaWidgets, $1, $qt_version_to_check, AC_DEFINE(QT_MULTIMEDIAWIDGETS_LIB, 1, [Define if we have QtMultimediaWidgets])) # @@ -2100,7 +2118,7 @@ AC_DEFUN([AC_WIRESHARK_QT_CHECK], # XXX - is there anything in QtX11Extras or QtWinExtras # that we should be using? # - AC_WIRESHARK_QT_MODULE_CHECK(MacExtras, $1, $2, + AC_WIRESHARK_QT_MODULE_CHECK(MacExtras, $1, $qt_version_to_check, AC_DEFINE(QT_MACEXTRAS_LIB, 1, [Define if we have QtMacExtras])) AC_SUBST(Qt_LIBS) @@ -2113,3 +2131,101 @@ AC_DEFUN([AC_WIRESHARK_QT_CHECK], fi ]) + +dnl AC_WIRESHARK_QT_TOOL_CHECK([TOOLPATHVAR, TOOL, REQUESTED-MAJOR_VERSION]) +dnl Test for a particular Qt tool, either for any version of Qt or for +dnl some specific version of Qt +dnl +AC_DEFUN([AC_WIRESHARK_QT_TOOL_CHECK], +[ + if test ! -z "$3"; then + # + # We're building with Qt, so we're looking for a particular + # major version of Qt's flavor of that tool. + # + # If we don't find the tool, we can't build, so we fail. + # + # At least in some versions of Debian/Ubuntu, and perhaps + # other OSes, the Qt build tools are just links to a + # program called "qtchooser", and even if you want to + # build with Qt 5, running the tool might give you the + # Qt 4 version of the tool unless you run the tool with + # a -qt=5 argument. + # + # So we look for qtchooser and, if we find it, use the + # -qt={version} argument, otherwise we look for particular + # tool versions using tool name suffixes. + # + AC_PATH_PROG(QTCHOOSER, qtchooser) + if test ! -z "$QTCHOOSER"; then + # + # We found qtchooser; we assume that means that + # the tool is linked to qtchooser, so that we + # can run it with the -qt={version} flag to get + # the appropriate version of the tool. + # + AC_PATH_PROG($1, $2) + if test "x$$1" = x; then + # + # We can't build Qt Wireshark without that + # tool.. + # + AC_MSG_ERROR(I couldn't find $2; make sure it's installed and in your path) + fi + + # + # Add the -qt={version} argument to it. + # + $1="$$1 -qt=$qt_version" + else + # + # Annoyingly, on some Linux distros (e.g. Debian) + # the Qt 5 tools have no suffix and the Qt 4 tools + # have suffix -qt4. On other distros (e.g. openSUSE) + # the Qt 5 tools have suffix -qt5 and the Qt 4 tools + # have no suffix. + # + # So we check for the tool first with the -qtN suffix + # and then with no suffix. + # + AC_PATH_PROGS($1, [$2-qt$qt_version $2]) + if test "x$$1" = x; then + # + # We can't build Qt Wireshark without that + # tool.. + # + AC_MSG_ERROR(I couldn't find $2-qt$qt_version or $2; make sure it's installed and in your path) + fi + fi + else + # + # We're not building with Qt, so we just want some version + # of the tool. + # + # If we don't find the tool, we shouldn't fail, as the + # user's not building with Qt, and we shouldn't force them + # to have Qt installed if they're not doing so. + # + # "make dist" will fail if they do that, but + # we don't know whether they'll be doing that, + # so this is the best we can do. + # + # For the annoying suffix reasons listed above, we check + # for the tool first with the -qt5 suffix, then with no + # suffix, then with the -qt4 suffix. + # + AC_PATH_PROGS($1, [$2-qt5 $2 $2-qt4]) + if test "x$$1" = x; then + # + # We shouldn't fail here, as the user's not + # building with Qt, and we shouldn't force them + # to have Qt installed if they're not doing so. + # + # "make dist" will fail if they do that, but + # we don't know whether they'll be doing that, + # so this is the best we can do. + # + $1=$$2 + fi + fi +]) diff --git a/configure.ac b/configure.ac index 71deda76f1..dce5764a36 100644 --- a/configure.ac +++ b/configure.ac @@ -244,7 +244,11 @@ AM_CONDITIONAL(HAVE_DOXYGEN, test x$HAVE_DOXYGEN = xyes) # "if" statement, it's safer to call PKG_PROG_PKG_CONFIG directly, see # the comments in acolocal.m4 # -PKG_PROG_PKG_CONFIG +# We want version 0.7 or better. (XXX - explain why. Is that just +# because our Qt tests were originally based on AM_PATH_GTK, and *it* +# requires 0.7 or better?) +# +PKG_PROG_PKG_CONFIG(0.7) if test -z "$PKG_CONFIG"; then AC_MSG_ERROR(I couldn't find pkg-config; make sure it's installed and in your path) fi @@ -1820,75 +1824,30 @@ else fi # -# "make dist" requires that we have the Qt build tools. +# If we're building with Qt, we need the Qt build tools in order to +# build the Wireshark GUI. We've already found Qt, and found a +# particular major version, and we want that version's build tools; +# for example, the Qt 4 version of uic produces files that include +# Qt headers with paths that work with Qt 4 but not Qt 5, so we can't +# use the Qt 4 version of uic if we're building with Qt 5. # -# Annoyingly, on some Linux distros (e.g. Debian) the Qt 5 tools have no -# suffix and the Qt 4 tools have suffix -qt4. On other distros (e.g. openSUSE) -# the Qt 5 tools have suffix -qt5 and the Qt 4 tools have no suffix. Hence -# check for Qt tools in the following suffix order: "-qt5", "", "-qt4". +# If we're *not* building with Qt, "make dist" requires that we have +# the Qt build tools, so we *still* need to look for them. We didn't +# look for Qt, so we don't know what version(s) we have; we look for +# whatever version we can find. # -AC_PATH_PROGS(UIC, [uic-qt5 uic uic-qt4]) -if test "x$UIC" = x; then - if test "x$have_qt" != "xno"; then - # - # If you want to build with Qt, you'd better - # have uic. - # - AC_MSG_ERROR(I couldn't find uic or uic-qt5 or uic-qt4; make sure it's installed and in your path) - else - # - # We shouldn't fail here, as the user's not - # building with Qt, and we shouldn't force them - # to have Qt installed if they're not doing so. - # "make dist" will fail if they do that, but - # we don't know whether they'll be doing that, - # so this is the best we can do. - # - UIC=uic - fi -fi +# XXX - but the above comment about Qt 4 vs. Qt 5 means that if we +# ship files built with the uic from one version of Qt, they won't +# compile with another major version of Qt, so should we be shipping +# those files? If we don't, that means somebody building from a +# source tarball would need to have the Qt tools installed, but +# they'll need other developer packages of Qt *anyway*. +# +AC_WIRESHARK_QT_TOOL_CHECK(UIC, uic, "$qt_version") AC_SUBST(UIC) -AC_PATH_PROGS(MOC, [moc-qt5 moc moc-qt4]) -if test "x$MOC" = x; then - if test "x$have_qt" != "xno"; then - # - # If you want to build with Qt, you'd better - # have moc. - # - AC_MSG_ERROR(I couldn't find moc or moc-qt5 or moc-qt4; make sure it's installed and in your path) - else - # - # We shouldn't fail here, as the user's not - # building with Qt, and we shouldn't force them - # to have Qt installed if they're not doing so. - # "make dist" will fail if they do that, but - # we don't know whether they'll be doing that, - # so this is the best we can do. - # - MOC=moc - fi -fi +AC_WIRESHARK_QT_TOOL_CHECK(MOC, moc, "$qt_version") AC_SUBST(MOC) -AC_PATH_PROGS(RCC, [rcc-qt5 rcc rcc-qt4]) -if test "x$RCC" = x; then - if test "x$have_qt" != "xno"; then - # - # If you want to build with Qt, you'd better - # have moc. - # - AC_MSG_ERROR(I couldn't find rcc or rcc-qt5; make sure it's installed and in your path) - else - # - # We shouldn't fail here, as the user's not - # building with Qt, and we shouldn't force them - # to have Qt installed if they're not doing so. - # "make dist" will fail if they do that, but - # we don't know whether they'll be doing that, - # so this is the best we can do. - # - RCC=rcc - fi -fi +AC_WIRESHARK_QT_TOOL_CHECK(RCC, rcc, "$qt_version") AC_SUBST(RCC) # Error out if a glib header other than a "top level" header @@ -3381,7 +3340,7 @@ fi echo "" echo "The Wireshark package has been configured with the following options." -echo " Build wireshark : $enable_wireshark_qt" +echo " Build wireshark : $enable_wireshark_qt (with Qt $qt_version)" echo " Build wireshark-gtk : $have_gtk""$gtk_lib_message" echo " Build tshark : $enable_tshark" echo " Build tfshark : $enable_tfshark" |