Move move of the Qt checks into AM_PATH_QT.
authormorriss <morriss@f5534014-38df-0310-8fa8-9805f1628bb7>
Fri, 8 Feb 2013 02:51:14 +0000 (02:51 +0000)
committermorriss <morriss@f5534014-38df-0310-8fa8-9805f1628bb7>
Fri, 8 Feb 2013 02:51:14 +0000 (02:51 +0000)
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@47553 f5534014-38df-0310-8fa8-9805f1628bb7

Makefile.am
aclocal-fallback/qt.m4
configure.ac

index 54a963f9186cef576276ee81ed09d9082464d6cc..8fab15e096fc7a8ec9db442e99b5b7fd1562406b 100644 (file)
@@ -370,8 +370,6 @@ wireshark_LDADD = \
        @PORTAUDIO_LIBS@                \
        @GTK_LIBS@                      \
        @Qt_LIBS@                       \
-       @QtWidgets_LIBS@                \
-       @QtPrintSupport_LIBS@           \
        @GLIB_LIBS@                     \
        -lm
 
index 1007e36c089a8ab71e96ffd946cf0acfb564e240..228a7eec35b6b118c58c5e79c466263d92dccde6 100644 (file)
@@ -2,55 +2,84 @@
 # $Id$
 
 dnl AM_PATH_QT([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
-dnl Test for Qt+
-dnl Should also define QT_CFLAGS and QT_LIBS but not done yet...
+dnl Test for Qt+ and define Qt_CFLAGS and Qt_LIBS.
 dnl
 AC_DEFUN([AM_PATH_QT],
 [
 
-  pkg_config_module=QtCore
-
-  no_qt=""
-
-  AC_PATH_PROG(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
-
-  min_qt_version=ifelse([$1], ,4.0.0,$1)
-  AC_MSG_CHECKING(for Qt - version >= $min_qt_version)
-
-  if test x"$no_qt" = x ; then
-    QT_CFLAGS=`$PKG_CONFIG --cflags $pkg_config_module`
-    QT_LIBS=`$PKG_CONFIG --libs $pkg_config_module`
-    qt_config_major_version=`$PKG_CONFIG --modversion $pkg_config_module | \
-           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
-    qt_config_minor_version=`$PKG_CONFIG --modversion $pkg_config_module | \
-           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
-    qt_config_micro_version=`$PKG_CONFIG --modversion $pkg_config_module | \
-           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
-
-    if $PKG_CONFIG --atleast-version $min_qt_version $pkg_config_module; then
-         :
-    else
-         no_qt=yes
-    fi
-  fi
-
-  if test x"$no_qt" = x ; then
-    AC_MSG_RESULT(yes (version $qt_config_major_version.$qt_config_minor_version.$qt_config_micro_version))
-     ifelse([$2], , :, [$2])
-  else
-     ifelse([$3], , :, [$3])
-  fi
+       pkg_config_module="QtCore QtGui"
+
+       no_qt=""
+
+       AC_PATH_PROG(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
+
+       if test x"$no_qt" = x ; then
+               min_qt_version=ifelse([$1], ,4.0.0,$1)
+               AC_MSG_CHECKING(for Qt - version >= $min_qt_version)
+
+               qt_config_major_version=`$PKG_CONFIG --modversion $pkg_config_module | \
+                       head -1 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
+               qt_config_minor_version=`$PKG_CONFIG --modversion $pkg_config_module | \
+                       head -1 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
+               qt_config_micro_version=`$PKG_CONFIG --modversion $pkg_config_module | \
+                       head -1 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
+
+               if $PKG_CONFIG --atleast-version $min_qt_version $pkg_config_module; then
+                       AC_MSG_RESULT(yes (version $qt_config_major_version.$qt_config_minor_version.$qt_config_micro_version))
+               else
+                       no_qt=yes
+                       AC_MSG_RESULT(no)
+               fi
+       fi
+
+       if test x"$no_qt" = x ; then
+               Qt_CFLAGS=`$PKG_CONFIG --cflags $pkg_config_module`
+               Qt_LIBS=`$PKG_CONFIG --libs $pkg_config_module`
+
+               #
+               # Qt 5.0 appears to move the widgets out of Qt GUI
+               # to Qt Widgets; look for QtWidgets and, if we find
+               # it, add its flags to CFLAGS and CXXFLAGS, so that
+               # we find the include files for the widgets.  (If
+               # we don't find it, we assume it's Qt 4.)
+               #
+               if QtWidgets_CFLAGS=`$PKG_CONFIG --cflags QtWidgets 2>/dev/null`; then
+                       Qt_CFLAGS="$Qt_CFLAGS $QtWidgets_CFLAGS"
+                       Qt_LIBS="$Qt_LIBS `$PKG_CONFIG --libs QtWidgets 2>/dev/null`"
+               else
+                       AC_MSG_NOTICE([QtWidgets not found. Assuming Qt4])
+               fi
+
+               #
+               # It also appears to move the printing support into
+               # the QtPrintSupport module.
+               #
+               if QtPrintSupport_CFLAGS=`$PKG_CONFIG --cflags QtPrintSupport 2>/dev/null`; then
+                       Qt_CFLAGS="$Qt_CFLAGS $QtPrintSupport_CFLAGS"
+                       Qt_LIBS="$Qt_LIBS `$PKG_CONFIG --libs QtPrintSupport 2>/dev/null`"
+               else
+                       AC_MSG_NOTICE([QtPrintSupport not found. Assuming Qt4])
+               fi
+
+               AC_SUBST(Qt_LIBS)
+
+               # Run Action-If-Found
+               ifelse([$2], , :, [$2])
+       else
+               # Run Action-If-Not-Found
+               ifelse([$3], , :, [$3])
+       fi
 
 ])
index b9904b8cbe31abf853668fd357658e3613f42d0a..85eb10015b5c196775100dc041180bb43a32151c 100644 (file)
@@ -945,49 +945,19 @@ if test "x$enable_wireshark" = "xyes"; then
                        ])
                AC_LANG_POP([C++])
 
-               PKG_CHECK_MODULES([Qt], [QtCore QtGui],
+               AM_PATH_QT($QT_MIN_VERSION,
                [
                        CFLAGS="$CFLAGS $Qt_CFLAGS"
                        CXXFLAGS="$CXXFLAGS $Qt_CFLAGS"
-                       #
-                       # XXX - greasy hack to make ui/gtk/recent.c
-                       # compile.
-                       #
-                       CPPFLAGS="-DQT_GUI_LIB $CPPFLAGS"
                        have_qt=yes
-               ],
-               [
-                       AC_MSG_ERROR([Qt is not available])
-               ])
-
-               #
-               # Qt 5.0 appears to move the widgets out of Qt GUI
-               # to Qt Widgets; look for QtWidgets and, if we find
-               # it, add its flags to CFLAGS and CXXFLAGS, so that
-               # we find the include files for the widgets.  (If
-               # we don't find it, we assume it's Qt 4.)
-               #
-               PKG_CHECK_MODULES([QtWidgets], [QtWidgets],
-               [
-                       CFLAGS="$CFLAGS $QtWidgets_CFLAGS"
-                       CXXFLAGS="$CXXFLAGS $QtWidgets_CFLAGS"
-               ],
-               AC_MSG_NOTICE([QtWidgets not found. Assuming Qt4]))
+               ]
+               , [AC_MSG_ERROR([Qt is not available])])
 
                #
-               # It also appears to move the printing support into
-               # the QtPrintSupport module.
+               # XXX - greasy hack to make ui/gtk/recent.c
+               # compile.
                #
-               PKG_CHECK_MODULES([QtPrintSupport], [QtPrintSupport],
-               [
-                       CFLAGS="$CFLAGS $QtPrintSupport_CFLAGS"
-                       CXXFLAGS="$CXXFLAGS $QtPrintSupport_CFLAGS"
-               ],
-               AC_MSG_NOTICE([QtPrintSupport not found. Assuming Qt4]))
-
-               # Check for the minimum Qt version
-               # XXX the above checks should be moved into AM_PATH_QT.
-               AM_PATH_QT($QT_MIN_VERSION, , [AC_MSG_ERROR([Qt is not available])])
+               CPPFLAGS="-DQT_GUI_LIB"
 
                #
                # We don't know whether we have GTK+, but we