From Dirk via bug #5771: Add heuristic dissector for images and HTTP
[obnox/wireshark/wip.git] / acinclude.m4
index 9709c8bc398e333a5a5e6a8a346b88a7fc30d145..05829bf382c8bce970095e5582c55d72b3a1654c 100644 (file)
@@ -69,6 +69,40 @@ case "$host_os" in
 esac
 ])
 
+#
+# AC_WIRESHARK_TIMEZONE_ABBREV
+#
+
+AC_DEFUN([AC_WIRESHARK_TIMEZONE_ABBREV],
+[
+  AC_CACHE_CHECK([for tm_zone in struct tm],
+    ac_cv_wireshark_have_tm_zone,
+    [
+      AC_TRY_COMPILE(
+        [#include <time.h>],
+        [struct tm t; t.tm_zone;],
+        ac_cv_wireshark_have_tm_zone=yes,
+        ac_cv_wireshark_have_tm_zone=no)
+    ])
+  if test $ac_cv_wireshark_have_tm_zone = yes; then
+    AC_DEFINE(HAVE_TM_ZONE, 1, [Define if tm_zone field exists in struct tm])
+  else
+    AC_CACHE_CHECK([for tzname],
+      ac_cv_wireshark_have_tzname,
+      [
+        AC_TRY_LINK(
+[#include <time.h>
+#include <stdio.h>],
+          [printf("%s", tzname[0]);],
+          ac_cv_wireshark_have_tzname=yes,
+          ac_cv_wireshark_have_tzname=no)
+      ])
+    if test $ac_cv_wireshark_have_tzname = yes; then
+      AC_DEFINE(HAVE_TZNAME, 1, [Define if tzname array exists])
+    fi
+  fi
+])
+
 
 #
 # AC_WIRESHARK_STRUCT_SA_LEN
@@ -295,13 +329,15 @@ AC_DEFUN([AC_WIRESHARK_PCAP_CHECK],
          #
          AC_PATH_PROG(PCAP_CONFIG, pcap-config)
 
-         #
-         # Now check whether it's the libpcap 1.0 version, which
-         # put a space after "-L" - on some platforms, that doesn't
-         # work.
-         #
-         AC_MSG_CHECKING(for broken pcap-config)
          if test -n "$PCAP_CONFIG" ; then
+           #
+           # Found it.
+           #
+           # Now check whether it's the libpcap 1.0 version, which
+           # put a space after "-L" - on some platforms, that doesn't
+           # work.
+           #
+           AC_MSG_CHECKING(for broken pcap-config)
            case "`\"$PCAP_CONFIG\" --libs`" in
 
            "-L "*)
@@ -322,8 +358,8 @@ AC_DEFUN([AC_WIRESHARK_PCAP_CHECK],
          fi
          if test -n "$PCAP_CONFIG" ; then
            #
-           # Found - use it to get the include flags for
-           # libpcap.
+           # Found it, and it's usable; use it to get the include flags
+           # for libpcap.
            #
            CFLAGS="$CFLAGS `\"$PCAP_CONFIG\" --cflags`"
            CPPFLAGS="$CPPFLAGS `\"$PCAP_CONFIG\" --cflags`"
@@ -578,6 +614,7 @@ install a newer version of the header file.])
          AC_CHECK_FUNCS(pcap_datalink_val_to_description)
          AC_CHECK_FUNCS(pcap_list_datalinks pcap_set_datalink pcap_lib_version)
          AC_CHECK_FUNCS(pcap_get_selectable_fd pcap_free_datalinks)
+         AC_CHECK_FUNCS(pcap_create bpf_image)
        fi
        LIBS="$ac_save_LIBS"
 ])
@@ -1380,8 +1417,10 @@ AC_DEFUN([AC_WIRESHARK_KRB5_CHECK],
          CFLAGS="$CFLAGS -I$krb5_dir/include"
          CPPFLAGS="$CPPFLAGS -I$krb5_dir/include"
          ac_heimdal_version=`grep heimdal $krb5_dir/include/krb5.h | head -n 1 | sed 's/^.*heimdal.*$/HEIMDAL/'`
-         ac_mit_version=`grep 'Massachusetts Institute of Technology' $krb5_dir/include/krb5.h | head -n 1 | sed 's/^.*Massachusetts Institute of Technology.*$/MIT/'`
-         ac_krb5_version="$ac_heimdal_version$ac_mit_version"
+         # MIT Kerberos moved krb5.h to krb5/krb5.h starting with release 1.5
+         ac_mit_version_olddir=`grep 'Massachusetts Institute of Technology' $krb5_dir/include/krb5.h | head -n 1 | sed 's/^.*Massachusetts Institute of Technology.*$/MIT/'`
+         ac_mit_version_newdir=`grep 'Massachusetts Institute of Technology' $krb5_dir/include/krb5/krb5.h | head -n 1 | sed 's/^.*Massachusetts Institute of Technology.*$/MIT/'`
+         ac_krb5_version="$ac_heimdal_version$ac_mit_version_olddir$ac_mit_version_newdir"
          if test "x$ac_krb5_version" = "xHEIMDAL"
              KRB5_LIBS="-L$krb5_dir/lib -lkrb5 -lasn1 $SSL_LIBS -lroken -lcrypt"
          then
@@ -1642,6 +1681,36 @@ AC_DEFUN([AC_WIRESHARK_GEOIP_CHECK],
        fi
 ])
 
+#AC_WIRESHARK_GCC_LDFLAGS_CHECK
+#
+# $1 : ldflag(s) to test
+#
+# The macro first determines if the compiler is GCC. Then compile with the
+# defined ldflags. The defined flags are added to LDFLAGS only if the
+# compilation succeeds.
+#
+AC_DEFUN([AC_WIRESHARK_GCC_LDFLAGS_CHECK],
+[GCC_OPTION="$1"
+AC_MSG_CHECKING(whether we can add $GCC_OPTION to LDFLAGS)
+if test "x$GCC" != "x"; then
+  LDFLAGS_saved="$CFLAGS"
+  LDFLAGS="$LDFLAGS $GCC_OPTION"
+  AC_LINK_IFELSE([
+    AC_LANG_SOURCE([[
+               main() { return; }
+                  ]])],
+                  [
+                    AC_MSG_RESULT(yes)
+                  ],
+                  [
+                    AC_MSG_RESULT(no)
+                    LDFLAGS="$LDFLAGS_saved"
+                  ])
+else
+  AC_MSG_RESULT(no)
+fi
+])
+
 #
 # AC_WIRESHARK_GCC_CFLAGS_CHECK
 #
@@ -1674,35 +1743,68 @@ fi
 ])
 
 #
-# AC_WIRESHARK_IGE_MAC_INTEGRATION_CHECK
+# AC_WIRESHARK_OSX_INTEGRATION_CHECK
 #
 # Checks for the presence of OS X integration functions in the GTK+ framework
 # or as a separate library.
 #
-# http://developer.imendio.com/projects/gtk-macosx/integration
+# http://sourceforge.net/apps/trac/gtk-osx/wiki/Integrate
 #
-AC_DEFUN([AC_WIRESHARK_IGE_MAC_INTEGRATION_CHECK],
+# http://live.gnome.org/GTK%2B/OSX/Integration
+#    for the old Carbon-based integration functions
+#
+# http://gtk-osx.sourceforge.net/ige-mac-integration/
+#    for the new Cocoa-based integration functions
+#
+AC_DEFUN([AC_WIRESHARK_OSX_INTEGRATION_CHECK],
 [
        ac_save_CFLAGS="$CFLAGS"
        ac_save_LIBS="$LIBS"
        CFLAGS="$CFLAGS $GTK_CFLAGS"
        LIBS="$GTK_LIBS $LIBS"
-       AC_CHECK_LIB(Gtk, ige_mac_menu_set_menu_bar,
+
+       #
+       # Check for the new integration functions in a -ligemacintegration
+       # library.
+       #
+       AC_CHECK_LIB(igemacintegration, gtk_osxapplication_set_menu_bar,
        [
-               AC_DEFINE(HAVE_IGE_MAC_INTEGRATION, 1,
-                       [Define to 1 if the the Gtk+ framework or a separate library inclues the Imendio IGE Mac OS X Integration functions.])
+               AC_DEFINE(HAVE_GTKOSXAPPLICATION, 1,
+                       [Define to 1 if -ligemacintegration includes the GtkOSXApplication Integration functions.])
                have_ige_mac=yes
                # We don't want gtk stuff in LIBS (which is reset below) so
                # manually set GTK_LIBS (which is more appropriate)
-               GTK_LIBS="$GTK_LIBS -lGtk"
+               GTK_LIBS="$GTK_LIBS -ligemacintegration"
        ])
 
        if test x$have_ige_mac == x
        then
+               #
+               # Not found - check for the old integration functions in
+               # the Gtk framework.
+               #
+               AC_CHECK_LIB(Gtk, ige_mac_menu_set_menu_bar,
+               [
+                       AC_DEFINE(HAVE_IGE_MAC_INTEGRATION, 1,
+                               [Define to 1 if the the Gtk+ framework or a separate library includes the Imendio IGE Mac OS X Integration functions.])
+                       have_ige_mac=yes
+                       # We don't want gtk stuff in LIBS (which is reset below) so
+                       # manually set GTK_LIBS (which is more appropriate)
+                       GTK_LIBS="$GTK_LIBS -lGtk"
+               ])
+       fi
+
+       if test x$have_ige_mac == x
+       then
+               #
+               # Not found - check for the old integration functions in
+               # a -ligemacintegration library.
+               #
                AC_CHECK_LIB(igemacintegration, ige_mac_menu_set_menu_bar,
                [
                        AC_DEFINE(HAVE_IGE_MAC_INTEGRATION, 1,
-                               [Define to 1 if the the Gtk+ framework or a separate library inclues the Imendio IGE Mac OS X Integration functions.])
+                               [Define to 1 if the the Gtk+ framework or a separate library includes the Imendio IGE Mac OS X Integration functions.])
+                       have_ige_mac=yes
                        # We don't want gtk stuff in LIBS (which is reset below) so
                        # manually set GTK_LIBS (which is more appropriate)
                        GTK_LIBS="$GTK_LIBS -ligemacintegration"