# header.
#
# However, it might also happen on some others OSes with some erroneous
- # system manipulations where multiple versions of libcap might co-exist
+ # system manipulations where multiple versions of libpcap might co-exist
# e.g. hand made symbolic link from libpcap.so -> libpcap.so.0.8 but
# having the pcap header version 0.7.
#
LUA_LIBS="-llua -lm"
LUA_INCLUDES=""
fi
- AC_DEFINE(HAVE_LUA, 1, [Define to use Lua ${lua_ver}])
+ AC_DEFINE(HAVE_LUA, 1, [Define to use Lua])
want_lua=yes
],[
# Lua found
#
LUA_LIBS=" -llua${lua_ver} -lm"
- AC_DEFINE(HAVE_LUA, 1, [Define to use Lua ${lua_ver}])
+ AC_DEFINE(HAVE_LUA, 1, [Define to use Lua])
want_lua=yes
],[
#
])
#
-# AC_WIRESHARK_GCC_CFLAGS_CHECK
+# AC_WIRESHARK_COMPILER_FLAGS_CHECK
#
-# $1 : cflags to test
+# $1 : flags to test
# $2 : if supplied, C for C-only flags, CXX for C++-only flags
# $3 : if supplied, a program to try to compile with the flag
# and, if the compile fails when -Werror is turned on,
# We do this because not all such options are necessarily supported by
# the version of the particular compiler we're using.
#
-AC_DEFUN([AC_WIRESHARK_GCC_CFLAGS_CHECK],
+AC_DEFUN([AC_WIRESHARK_COMPILER_FLAGS_CHECK],
[GCC_OPTION="$1"
can_add_to_cflags=""
can_add_to_cxxflags=""
#
AC_MSG_CHECKING(whether we can add $GCC_OPTION to CFLAGS)
CFLAGS_saved="$CFLAGS"
- if expr "$GCC_OPTION" : "-W.*" >/dev/null
+ if expr "x$GCC_OPTION" : "x-W.*" >/dev/null
then
CFLAGS="$CFLAGS $ac_wireshark_unknown_warning_option_error $GCC_OPTION"
- elif expr "$GCC_OPTION" : "-f.*" >/dev/null
+ elif expr "x$GCC_OPTION" : "x-f.*" >/dev/null
then
CFLAGS="$CFLAGS -Werror $GCC_OPTION"
fi
#
AC_MSG_CHECKING(whether we can add $GCC_OPTION to CXXFLAGS)
CXXFLAGS_saved="$CXXFLAGS"
- if expr "$GCC_OPTION" : "-W.*" >/dev/null
+ if expr "x$GCC_OPTION" : "x-W.*" >/dev/null
then
CXXFLAGS="$CXXFLAGS $ac_wireshark_unknown_warning_option_error $GCC_OPTION"
- elif expr "$GCC_OPTION" : "-f.*" >/dev/null
+ elif expr "x$GCC_OPTION" : "x-f.*" >/dev/null
then
CXXFLAGS="$CXXFLAGS -Werror $GCC_OPTION"
fi
LIBS="$ac_save_LIBS"
])
+# Based on AM_PATH_GTK in gtk-2.0.m4.
+
+dnl AC_WIRESHARK_QT_MODULE_CHECK([MODULE, MINIMUM-VERSION, [ACTION-IF-FOUND,
+dnl [ACTION-IF-NOT-FOUND]]])
+dnl Test for a particular Qt module and add the flags and libraries
+dnl for it to Qt_CFLAGS and Qt_LIBS.
+dnl
+AC_DEFUN([AC_WIRESHARK_QT_MODULE_CHECK],
+[
+ #
+ # Version of the module we're checking for.
+ # Default to 4.0.0.
+ #
+ min_qt_version=ifelse([$2], ,4.0.0,$2)
+
+ #
+ # 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....)
+ #
+ for modprefix in Qt5 Qt
+ do
+ 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`"
+ found_$1=yes
+ break
+ else
+ AC_MSG_RESULT(no)
+ fi
+ done
+
+ if test "x$found_$1" = "xyes"; then
+ # Run Action-If-Found
+ ifelse([$3], , :, [$3])
+ else
+ # Run Action-If-Not-Found
+ ifelse([$4], , :, [$4])
+ fi
+])
+
+dnl AC_WIRESHARK_QT_CHECK([MINIMUM-VERSION, [ACTION-IF-FOUND,
+dnl [ACTION-IF-NOT-FOUND]]])
+dnl Test for Qt and define Qt_CFLAGS and Qt_LIBS.
+dnl
+AC_DEFUN([AC_WIRESHARK_QT_CHECK],
+[
+ 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
+ #
+ # 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, , [no_qt=yes])
+ fi
+
+ if test x"$no_qt" = x ; then
+ #
+ # We need the Gui module as well.
+ #
+ AC_WIRESHARK_QT_MODULE_CHECK(Gui, $1, , [no_qt=yes])
+ fi
+
+ if test x"$no_qt" = x ; then
+ #
+ # Qt 5.0 appears to move the widgets out of Qt GUI
+ # 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)
+
+ #
+ # Qt 5.0 also appears to move the printing support into
+ # the Qt PrintSupport module.
+ #
+ AC_WIRESHARK_QT_MODULE_CHECK(PrintSupport, $1)
+
+ #
+ # While we're at it, look for QtMacExtras. (Presumably
+ # if we're not building for OS X, it won't be present.)
+ #
+ # XXX - is there anything in QtX11Extras or QtWinExtras
+ # that we should be using?
+ #
+ AC_WIRESHARK_QT_MODULE_CHECK(MacExtras, $1,
+ AC_DEFINE(QT_MACEXTRAS_LIB, 1, [Define if we have QtMacExtras]))
+
+ AC_SUBST(Qt_LIBS)
+
+ # Run Action-If-Found
+ ifelse([$2], , :, [$2])
+ else
+ # Run Action-If-Not-Found
+ ifelse([$3], , :, [$3])
+ fi
+
+])
+
#
# AC_WIRESHARK_PYTHON_CHECK
#
fi
# ])
])
+
+#
+# AC_WIRESHARK_CLANG_CHECK
+#
+# Check if either our C or C++ compiler is Clang
+#
+AC_DEFUN([AC_WIRESHARK_CLANG_CHECK], [
+
+ AC_MSG_CHECKING(if $CC is Clang)
+ AC_COMPILE_IFELSE([
+ AC_LANG_SOURCE([[
+#ifndef __clang__
+CC is not __clang__
+#endif
+ ]])],
+ [
+ CC_IS_CLANG='yes'
+ CFLAGS="$CFLAGS -Qunused-arguments"
+ ],
+ CC_IS_CLANG='no'
+ )
+ AC_MSG_RESULT("$CC_IS_CLANG")
+
+ AC_MSG_CHECKING(if $CXX is Clang)
+ AC_LANG_PUSH([C++])
+ AC_COMPILE_IFELSE([
+ AC_LANG_SOURCE([[
+#ifndef __clang__
+CXX is not __clang__
+#endif
+ ]])],
+ [
+ CXX_IS_CLANG='yes'
+ CXXFLAGS="$CXXFLAGS -Qunused-arguments"
+ ],
+ CXX_IS_CLANG='no'
+ )
+ AC_LANG_POP([C++])
+ AC_MSG_RESULT("$CXX_IS_CLANG")
+
+])
+