Add automake support for Qt - use --with-qt as a configure script

argument.

svn path=/trunk/; revision=41647
This commit is contained in:
Guy Harris 2012-03-18 23:35:53 +00:00
parent f79a5f32b7
commit 994d2b544e
5 changed files with 390 additions and 49 deletions

View File

@ -378,6 +378,26 @@ else
wireshark_LDFLAGS = -export-dynamic
endif
#
# XXX - hack to force C++ linking.
#
nodist_EXTRA_wireshark_SOURCES = dummy.cpp
#
# UI code for Wireshark with Qt.
#
wireshark_QT_UI_LIBS = \
ui/qt/libui.a \
@Qt_LIBS@
#
# UI code for Wireshark with GTK+.
#
wireshark_GTK_UI_LIBS = \
ui/gtk/libgtkui.a \
ui/gtk/libgtkui_dirty.a \
@GTK_LIBS@ -lm
# Libraries and plugin flags with which to link wireshark.
#
# Note that Wireshark doesn't have to be linked with @GLIB_LIBS@, as
@ -386,8 +406,7 @@ endif
# @GTK_LIBS@ (as those are also needed for X applications, and GTK+
# applications are X applications).
wireshark_LDADD = \
ui/gtk/libgtkui.a \
ui/gtk/libgtkui_dirty.a \
@UI_LIBS@ \
ui/libui.a \
codecs/libcodec.a \
wiretap/libwiretap.la \
@ -396,7 +415,6 @@ wireshark_LDADD = \
@SSL_LIBS@ \
$(plugin_ldadd) \
@PCAP_LIBS@ \
@GTK_LIBS@ -lm \
@C_ARES_LIBS@ \
@ADNS_LIBS@ \
@KRB5_LIBS@ \
@ -953,7 +971,7 @@ endif
endif
DIST_SUBDIRS = asn1 codecs doc epan ui ui/cli ui/gtk help packaging plugins tools wiretap wsutil docbook
DIST_SUBDIRS = asn1 codecs doc epan ui ui/cli ui/gtk ui/qt help packaging plugins tools wiretap wsutil docbook
if HAVE_PLUGINS
SUBDIRS = tools wsutil wiretap epan plugins packaging help ui @wireshark_SUBDIRS@ ui/cli . doc

View File

@ -102,6 +102,7 @@ SHARK_COMMON_CAPTURE_INCLUDES = \
wireshark_SOURCES = \
$(WIRESHARK_COMMON_SRC) \
$(SHARK_COMMON_CAPTURE_SRC) \
ui/qt/main.cpp \
airpcap_loader.c \
capture.c \
capture_info.c \

View File

@ -221,12 +221,16 @@ if test "x$with_gcrypt" = "xyes"; then
)
fi
AC_ARG_WITH([qt],
AC_HELP_STRING( [--with-qt=@<:@yes/no@:>@],
[use Qt instead of GTK+ @<:@default=no@:>@]),
with_qt="$withval", with_qt="no")
AC_ARG_WITH([gtk3],
AC_HELP_STRING( [--with-gtk3=@<:@yes/no@:>@],
[use GTK+ 3.0 instead of 2.0 @<:@default=no@:>@]),
with_gtk3="$withval", with_gtk3="no")
# libsmi
# FIXME: currently the path argument to with-libsmi is being ignored
AX_LIBSMI
@ -793,34 +797,73 @@ docdir=`(
)`
AC_DEFINE_UNQUOTED(DOC_DIR, "$docdir", [Directory for docs])
# GTK checks; we require GTK+ 2.12 or later.
# We don't add $GLIB_LIBS to LIBS, because we don't want to force all
# programs to be built with GTK+.
# GTK+ and Qt checks; we require GTK+ 2.12 or later, and, for now,
# don't require any particular version of Qt (except perhaps by
# implication, as older versions might not support pkgconfig).
#
# We only do those if we're going to be building Wireshark;
# otherwise, we don't have any GUI to build, so we don't use
# GTK+ or Qt.
#
# We don't add $GTK_LIBS or $Qt_LIBS to LIBS, because we don't want to
# force all programs to be built with GTK+ or Qt.
#
if test "x$enable_wireshark" = "xyes"; then
if test "x$with_gtk3" = "xyes"; then
AM_PATH_GTK_3_0(3.0.0,
[
CFLAGS="$CFLAGS $GTK_CFLAGS"
CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"
have_gtk=yes
AC_DEFINE(HAVE_GTK, 1,
[Define to 1 if compiling with GTK])
], have_gtk=no)
else
AM_PATH_GTK_2_0(2.12.0,
if test "x$with_qt" = "xyes"; then
PKG_CHECK_MODULES([Qt], [QtCore QtGui],
[
CFLAGS="$CFLAGS $GTK_CFLAGS"
CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"
have_gtk=yes
AC_DEFINE(HAVE_GTK, 1,
[Define to 1 if compiling with GTK])
], have_gtk=no)
CFLAGS="$CFLAGS $Qt_CFLAGS"
CXXFLAGS="$CXXFLAGS $Qt_CFLAGS"
#
# XXX - greasy hack to make ui/gtk/recent.c
# compile.
#
CPPFLAGS="-DQT_GUI_LIB $CPPFLAGS"
UI_LIBS='$(wireshark_QT_UI_LIBS)'
have_qt=yes
],
[
AC_MSG_ERROR([Qt is not available])
])
#
# We don't know whether we have GTK+, but we
# won't be using it, so it's as if we don't
# have it.
#
have_gtk=no
else
#
# Not Qt - either GTK+ 3.x or 2.x.
#
if test "x$with_gtk3" = "xyes"; then
AM_PATH_GTK_3_0(3.0.0,
[
CFLAGS="$CFLAGS $GTK_CFLAGS"
CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"
have_gtk=yes
UI_LIBS='$(wireshark_GTK_UI_LIBS)'
AC_DEFINE(HAVE_GTK, 1,
[Define to 1 if compiling with GTK])
], have_gtk=no)
else
AM_PATH_GTK_2_0(2.12.0,
[
CFLAGS="$CFLAGS $GTK_CFLAGS"
CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"
have_gtk=yes
UI_LIBS='$(wireshark_GTK_UI_LIBS)'
AC_DEFINE(HAVE_GTK, 1,
[Define to 1 if compiling with GTK])
], have_gtk=no)
fi
fi
else
have_qt=no
have_gtk=no
fi
AC_SUBST(UI_LIBS)
# GLib checks; we require GLib 2.14 or later, and require gmodule
# support, as we need that for dynamically loading plugins.
@ -838,20 +881,38 @@ fi
if test "$have_gtk" = "no" ; then
#
# We don't have GTK+.
# If they didn't explicitly say "--disable-wireshark", fail (so
# that, unless they explicitly indicated that they don't want
# Wireshark, we stop so they know they won't be getting
# Wireshark unless they fix the GTK+ problem).
#
if test "x$enable_wireshark" = "xyes"; then
if test "x$with_gtk3" = "xyes"; then
AC_MSG_ERROR([GTK+ 3.0 or later isn't available, so Wireshark can't be compiled])
else
AC_MSG_ERROR([GTK+ 2.12 or later isn't available, so Wireshark can't be compiled])
if test "$have_qt" = "yes" ; then
#
# However, we do have Qt, and thus will be building
# Wireshark (if the user had explicitly disabled
# Wireshark, we wouldn't have looked for Qt, so we
# wouldn't think we had it, and thus wouldn't be here).
#
wireshark_bin="wireshark\$(EXEEXT)"
wireshark_man="wireshark.1"
wireshark_SUBDIRS="codecs ui/qt"
else
#
# We don't have Qt, either, which means we have no UI
# toolkit.
#
# If they didn't explicitly say "--disable-wireshark",
# fail (so that, unless they explicitly indicated that
# they don't want Wireshark, we stop so they know they
# won't be getting Wireshark unless they fix the GTK+/Qt
# problem).
#
if test "x$enable_wireshark" = "xyes"; then
if test "x$with_gtk3" = "xyes"; then
AC_MSG_ERROR([GTK+ 3.0 or later isn't available, so Wireshark can't be compiled])
else
AC_MSG_ERROR([Neither Qt nor GTK+ 2.12 or later are available, so Wireshark can't be compiled])
fi
fi
wireshark_bin=""
wireshark_man=""
fi
wireshark_bin=""
wireshark_man=""
# Use GLIB_CFLAGS
AM_PATH_GLIB_2_0(2.14.0,
[
@ -860,8 +921,9 @@ if test "$have_gtk" = "no" ; then
], AC_MSG_ERROR(GLib 2.14 or later distribution not found.), gthread gmodule)
else
#
# We have GTK+, and thus will be building Wireshark unless the
# user explicitly disabled it.
# We have GTK+, and thus will be building Wireshark (if the user
# had explicitly disabled Wireshark, we wouldn't have looked for
# GTK+, so we wouldn't think we had it, and thus wouldn't be here).
#
wireshark_bin="wireshark\$(EXEEXT)"
wireshark_man="wireshark.1"
@ -1991,6 +2053,7 @@ AC_OUTPUT(
ui/gtk/Makefile
ui/gtk/doxygen.cfg
ui/cli/Makefile
ui/qt/Makefile
help/Makefile
packaging/Makefile
packaging/macosx/Info.plist
@ -2028,16 +2091,20 @@ dnl AC_CONFIG_FILES([tools/setuid-root.pl], [chmod +x tools/setuid-root.pl])
# Pretty messages
if test "x$have_gtk" = "xyes"; then
if test "x$with_gtk3" = "xyes"; then
gui_lib_message=" (with GTK+ 3"
else
gui_lib_message=" (with GTK+ 2"
fi
if test "x$have_ige_mac" = "xyes"; then
gui_lib_message="$gui_lib_message and Mac OS X integration)"
else
gui_lib_message="$gui_lib_message)"
if test "x$have_qt" = "xyes"; then
gui_lib_message=" (with Qt)"
else
if test "x$have_gtk" = "xyes"; then
if test "x$with_gtk3" = "xyes"; then
gui_lib_message=" (with GTK+ 3"
else
gui_lib_message=" (with GTK+ 2"
fi
if test "x$have_ige_mac" = "xyes"; then
gui_lib_message="$gui_lib_message and Mac OS X integration)"
else
gui_lib_message="$gui_lib_message)"
fi
fi
fi

121
ui/qt/Makefile.am Normal file
View File

@ -0,0 +1,121 @@
# Makefile.am
# Automake file for the Qt interface routines for Wireshark
#
# $Id$
#
# Wireshark - Network traffic analyzer
# By Gerald Combs <gerald@wireshark.org>
# Copyright 1998 Gerald Combs
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
include Makefile.common
include ../../Makefile.am.inc
if HAVE_WARNINGS_AS_ERRORS
AM_CLEAN_CFLAGS = -Werror
endif
noinst_LIBRARIES = libui.a
CLEANFILES = \
libui.a \
*~
MAINTAINERCLEANFILES = \
$(GENERATED_FILES) \
Makefile.in
RUNLEX=$(top_srcdir)/tools/runlex.sh
libui_a_SOURCES = \
$(WIRESHARK_QT_SRC) \
$(GENERATED_C_FILES) \
$(GENERATED_H_FILES) \
$(noinst_HEADERS) \
$(WIRESHARK_TAP_SRC)
libui_a_CFLAGS = $(AM_CLEAN_CFLAGS)
libui_a_DEPENDENCIES =
# Common headers
AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/wiretap $(LIBGCRYPT_CFLAGS) $(LIBGNUTLS_CFLAGS) $(PORTAUDIO_INCLUDES)
#
# For building .moc.cpp files from .h files by running moc
# and building .rcc.cpp files from .qrc files by running rcc
#
SUFFIXES = .moc.cpp .qrc .rcc.cpp
.h.moc.cpp:
moc -o $@ $<
.qrc.rcc.cpp:
rcc -name `basename $< .qrc` -o $@ $<
main_window.h: ui_main_window.h
ui_main_window.h: main_window.ui
uic $< -o $@
doxygen:
if HAVE_DOXYGEN
$(DOXYGEN) doxygen.cfg
endif # HAVE_DOXYGEN
checkapi: checkapi-base checkapi-todo
checkapi-base:
$(PERL) ../tools/checkAPIs.pl -g deprecated-gtk \
$(WIRESHARK_GTK_SRC) \
$(WIRESHARK_TAP_SRC) \
capture_if_details_dlg_win32.c
checkapi-todo:
$(PERL) ../tools/checkAPIs.pl -M -g deprecated-gtk-todo \
$(WIRESHARK_GTK_SRC) \
$(WIRESHARK_TAP_SRC) \
capture_if_details_dlg_win32.c
expert_indicators.h:
echo "/* This file was automatically generated. DO NOT EDIT. */" > $@
echo >> $@
for elevel in chat error none note warn ; do \
gdk-pixbuf-csource --raw --name=expert_$${elevel}_pb_data ../../image/expert_$${elevel}.png >> $@ ;\
done
network_icons.h:
echo "/* This file was automatically generated. DO NOT EDIT. */" > $@
echo >> $@
for icon in bluetooth usb wired wireless ; do \
gdk-pixbuf-csource --raw --name=network_$${icon}_pb_data ../../image/toolbar/network_$${icon}_16.png >> $@ ;\
done
remote_icons.h:
echo "/* This file was automatically generated. DO NOT EDIT. */" > $@
echo >> $@
for icon in arrow globe sat ; do \
gdk-pixbuf-csource --raw --name=remote_$${icon}_pb_data ../../image/toolbar/remote_$${icon}_16.png >> $@ ;\
done
EXTRA_DIST = \
$(GENERATOR_FILES) \
doxygen.cfg.in \
libui.vcproj \
Makefile.common \
Makefile.nmake \
CMakeLists.txt \
Makefile_custom.common

134
ui/qt/Makefile.common Normal file
View File

@ -0,0 +1,134 @@
# Makefile.common
# Contains the stuff from Makefile.am and Makefile.nmake that is
# a) common to both files and
# b) portable between both files
#
# $Id$
#
# Wireshark - Network traffic analyzer
# By Gerald Combs <gerald@wireshark.org>
# Copyright 1998 Gerald Combs
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
include Makefile_custom.common
# Generated header files that we want in the distribution.
GENERATED_HEADER_FILES =
# Generated C source files that we want in the distribution.
GENERATED_C_FILES =
GENERATED_H_FILES =
DIRTY_GENERATED_C_FILES =
# All the generated files we want in the distribution.
GENERATED_FILES = \
$(GENERATED_HEADER_FILES) \
$(GENERATED_C_FILES) \
$(GENERATED_H_FILES) \
$(DIRTY_GENERATED_C_FILES)
# Files that generate compileable files
GENERATOR_FILES =
#
# Headers that have to be run through moc.
#
MOC_HDRS = \
byte_view_tab.h \
byte_view_text.h \
capture_file_dialog.h \
capture_info_dialog.h \
capture_interface_dialog.h \
color_dialog.h \
color_utils.h \
display_filter_combo.h \
display_filter_edit.h \
fileset_dialog.h \
interface_tree.h \
label_stack.h \
main_status_bar.h \
main_welcome.h \
main_window.h \
monospace_font.h \
packet_list.h \
packet_list_model.h \
progress_dialog.h \
proto_tree.h \
recent_file_status.h \
simple_dialog_qt.h \
wireshark_application.h
#
# The .moc.cpp files generated from them.
# We do *not* include these in the distribution; if you have the Qt SDK
# installed, so that you can build Qt-based applications, you have moc
# installed.
#
MOC_SRC = $(MOC_HDRS:.h=.moc.cpp)
#
# .qrc files.
#
QRC_FILES = \
display_filter.qrc \
i18n.qrc \
toolbar.qrc \
welcome.qrc
#
# The .rcc.cpp files generated from them.
# We do *not* include these in the distribution; if you have the Qt SDK
# installed, so that you can build Qt-based applications, you have moc
# installed.
#
QRC_SRC = $(QRC_FILES:.qrc=.rcc.cpp)
WIRESHARK_QT_SRC = \
$(MOC_SRC) \
$(QRC_SRC) \
byte_view_tab.cpp \
byte_view_text.cpp \
capture_file_dialog.cpp \
capture_info_dialog.cpp \
capture_interface_dialog.cpp \
color_dialog.cpp \
color_utils.cpp \
display_filter_combo.cpp \
display_filter_edit.cpp \
fileset_dialog.cpp \
interface_tree.cpp \
label_stack.cpp \
main_status_bar.cpp \
main_welcome.cpp \
main_window.cpp \
monospace_font.cpp \
packet_list.cpp \
packet_list_model.cpp \
packet_list_record.cpp \
progress_dialog.cpp \
proto_tree.cpp \
qt_ui_utils.cpp \
recent_file_status.cpp \
simple_dialog_qt.cpp \
wireshark_application.cpp
noinst_HEADERS = \
$(MOC_HDRS) \
packet_list_record.h \
qt_ui_utils.h