Move the code to get version information for libraries used by
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Thu, 15 Jul 2010 02:07:16 +0000 (02:07 +0000)
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Thu, 15 Jul 2010 02:07:16 +0000 (02:07 +0000)
libwireshark into libwireshark, and call it only in programs linked with
libwireshark.  That way, programs that don't link with libwireshark
don't have to link with libgcrypt or libgnutls solely so that they can
say that they're linked with a particular version of libgcrypt or
libgnutls.

Don't link dumpcap with libgcrypt or libgnutls any more.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@33531 f5534014-38df-0310-8fa8-9805f1628bb7

Makefile.am
epan/epan.c
epan/epan.h
epan/libwireshark.def
gtk/main.c
rawshark.c
tshark.c
version_info.c
version_info.h

index 1fde48c1c4042630e4ac466ce1e3bfc844e01fc5..da95c6d72d8034d386e2cececb47fd831938eb39 100644 (file)
@@ -457,8 +457,6 @@ dumpcap_LDADD = \
        @SOCKET_LIBS@                   \
        @NSL_LIBS@                      \
        @FRAMEWORKS@                    \
-       @LIBGCRYPT_LIBS@                \
-       @LIBGNUTLS_LIBS@                \
        @LIBCAP_LIBS@
 dumpcap_CFLAGS = $(AM_CLEAN_CFLAGS) $(py_dissectors_dir)
 
index 10ba4a3db894e1a2f55614e5255c03c27799794b..7937a5759636fea7699f3967f91603b6138357da 100644 (file)
 #include "expert.h"
 
 #ifdef HAVE_LUA_5_1
-       int wslua_init(void*);
+#include <lua.h>
+#include <wslua/wslua.h>
+#endif
+
+#ifdef HAVE_LIBSMI
+#include <smi.h>
+#endif
+
+#ifdef HAVE_C_ARES
+#include <ares_version.h>
 #endif
 
 #ifdef HAVE_GEOIP
@@ -239,3 +248,125 @@ epan_dissect_fill_in_columns(epan_dissect_t *edt, const gboolean fill_col_exprs,
     col_fill_in(&edt->pi, fill_col_exprs, fill_fd_colums);
 }
 
+/*
+ * Get compile-time information for libraries used by libwireshark.
+ */
+void
+epan_get_compiled_version_info(GString *str)
+{
+        /* PCRE */
+       g_string_append(str, ", ");
+#ifdef HAVE_LIBPCRE
+       g_string_append(str, "with libpcre ");
+#ifdef PCRE_MAJOR
+#ifdef PCRE_MINOR
+       g_string_append_printf(str, "%u.%u", PCRE_MAJOR, PCRE_MINOR);
+#else                  /* PCRE_MINOR */
+       g_string_append_printf(str, "%u", PCRE_MAJOR);
+#endif                 /* PCRE_MINOR */
+#else          /* PCRE_MAJOR */
+       g_string_append(str, "(version unknown)");
+#endif         /* PCRE_MAJOR */
+#else  /* HAVE_LIBPCRE */
+       g_string_append(str, "without libpcre");
+#endif /* HAVE_LIBPCRE */
+
+        /* SNMP */
+       g_string_append(str, ", ");
+#ifdef HAVE_LIBSMI
+       g_string_append(str, "with SMI " SMI_VERSION_STRING);
+#else /* no SNMP library */
+       g_string_append(str, "without SMI");
+#endif /* _SMI_H */
+
+       /* c-ares */
+       g_string_append(str, ", ");
+#ifdef HAVE_C_ARES
+       g_string_append(str, "with c-ares " ARES_VERSION_STR);
+#else
+       g_string_append(str, "without c-ares");
+
+       /* ADNS - only add if no c-ares */
+       g_string_append(str, ", ");
+#ifdef HAVE_GNU_ADNS
+       g_string_append(str, "with ADNS");
+#else
+       g_string_append(str, "without ADNS");
+#endif /* HAVE_GNU_ADNS */
+#endif /* HAVE_C_ARES */
+
+        /* LUA */
+       g_string_append(str, ", ");
+#ifdef HAVE_LUA_5_1
+       g_string_append(str, "with ");
+       g_string_append(str, LUA_VERSION);
+#else
+       g_string_append(str, "without Lua");
+#endif /* HAVE_LUA_5_1 */
+
+       g_string_append(str, ", ");
+#ifdef HAVE_PYTHON
+       g_string_append(str, "with Python");
+#ifdef PY_VERSION
+       g_string_append(str, " " PY_VERSION);
+#endif /* PY_VERSION */
+#else
+       g_string_append(str, "without Python");
+#endif /* HAVE_PYTHON */
+
+        /* GnuTLS */
+       g_string_append(str, ", ");
+#ifdef HAVE_LIBGNUTLS
+       g_string_append(str, "with GnuTLS " LIBGNUTLS_VERSION);
+#else
+       g_string_append(str, "without GnuTLS");
+#endif /* HAVE_LIBGNUTLS */
+
+        /* Gcrypt */
+       g_string_append(str, ", ");
+#ifdef HAVE_LIBGCRYPT
+       g_string_append(str, "with Gcrypt " GCRYPT_VERSION);
+#else
+       g_string_append(str, "without Gcrypt");
+#endif /* HAVE_LIBGCRYPT */
+
+        /* Kerberos */
+        /* XXX - I don't see how to get the version number, at least for KfW */
+       g_string_append(str, ", ");
+#ifdef HAVE_KERBEROS
+#ifdef HAVE_MIT_KERBEROS
+       g_string_append(str, "with MIT Kerberos");
+#else
+        /* HAVE_HEIMDAL_KERBEROS */
+       g_string_append(str, "with Heimdal Kerberos");
+#endif
+#else
+       g_string_append(str, "without Kerberos");
+#endif /* HAVE_KERBEROS */
+
+       /* GeoIP */
+       g_string_append(str, ", ");
+#ifdef HAVE_GEOIP
+       g_string_append(str, "with GeoIP");
+#else
+       g_string_append(str, "without GeoIP");
+#endif /* HAVE_GEOIP */
+
+}
+
+/*
+ * Get runtime information for libraries used by libwireshark.
+ */
+void
+epan_get_runtime_version_info(GString *str)
+{
+        /* GnuTLS */
+#ifdef HAVE_LIBGNUTLS
+       g_string_append_printf(str, ", GnuTLS %s", gnutls_check_version(NULL));
+#endif /* HAVE_LIBGNUTLS */
+
+        /* Gcrypt */
+#ifdef HAVE_LIBGCRYPT
+       g_string_append_printf(str, ", Gcrypt %s", gcry_check_version(NULL));
+#endif /* HAVE_LIBGCRYPT */
+}
index bfad1c8d5caf2ce1496a53e2a096d8fa971cbe75..ab0c51ae7dc8cf142bb1aa9d873027c370a987f0 100644 (file)
@@ -124,6 +124,18 @@ epan_dissect_free(epan_dissect_t* edt);
 /* Sets custom column */
 const gchar *
 epan_custom_set(epan_dissect_t *edt, int id,
-                               gchar *result, gchar *expr, const int size );
+                               gchar *result, gchar *expr, const int size);
+
+/*
+ * Get compile-time information for libraries used by libwireshark.
+ */
+void
+epan_get_compiled_version_info(GString *str);
+
+/*
+ * Get runtime information for libraries used by libwireshark.
+ */
+void
+epan_get_runtime_version_info(GString *str);
 
 #endif /* EPAN_H */
index 490e4b3fb084b7906e2035866dd778ba0580be4b..8e7397b6b22bfb17ec41e273ece7429a68bedabf 100644 (file)
@@ -380,6 +380,8 @@ epan_dissect_init
 epan_dissect_new
 epan_dissect_prime_dfilter
 epan_dissect_run
+epan_get_compiled_version_info
+epan_get_runtime_version_info
 epan_get_version
 epan_init
 epan_strcasestr
index f4ad9d09593a44aa9db9d8b32c3d1293b3cde0f6..74a0d7bb199569dd582bb4f5ac1e4542eed163ed 100644 (file)
@@ -1839,7 +1839,7 @@ main_capture_callback(gint event, capture_options *capture_opts, gpointer user_d
 static void
 get_gui_compiled_info(GString *str)
 {
-  get_epan_compiled_version_info(str);
+  epan_get_compiled_version_info(str);
 
   g_string_append(str, ", ");
 #ifdef HAVE_LIBPORTAUDIO
@@ -1867,6 +1867,8 @@ get_gui_compiled_info(GString *str)
 static void
 get_gui_runtime_info(GString *str)
 {
+  epan_get_runtime_version_info(str);
+
 #ifdef HAVE_AIRPCAP
   g_string_append(str, ", ");
   get_runtime_airpcap_version(str);
@@ -1876,7 +1878,6 @@ get_gui_runtime_info(GString *str)
     g_string_append(str, ", ");
     u3_runtime_info(str);
   }
-
 }
 
 static e_prefs *
index e729c2b473456334d9d149579e8077c8a8ff7f4c..05eba3c3ea00836d2ebba08f0048cef3cbfa8cca 100644 (file)
@@ -695,7 +695,7 @@ main(int argc, char *argv[])
                 GString             *runtime_info_str;
                 /* Assemble the compile-time version information string */
                 comp_info_str = g_string_new("Compiled ");
-                get_compiled_version_info(comp_info_str, get_epan_compiled_version_info);
+                get_compiled_version_info(comp_info_str, epan_get_compiled_version_info);
 
                 /* Assemble the run-time version information string */
                 runtime_info_str = g_string_new("Running ");
index 68a4b3f13547faebf08f32e9dd27bbd3e7b493b2..a4d0ad1ef1fbe253756962a57f6b23e22b62610a 100644 (file)
--- a/tshark.c
+++ b/tshark.c
@@ -1257,7 +1257,7 @@ main(int argc, char *argv[])
         GString             *runtime_info_str;
         /* Assemble the compile-time version information string */
         comp_info_str = g_string_new("Compiled ");
-        get_compiled_version_info(comp_info_str, get_epan_compiled_version_info);
+        get_compiled_version_info(comp_info_str, epan_get_compiled_version_info);
 
         /* Assemble the run-time version information string */
         runtime_info_str = g_string_new("Running ");
index 2fb40d0ac04b8d7cfb41245ee996cd97217db18a..ce5ce3fda3beaadeda7fcc4b2e7ec0cb7a2db112 100644 (file)
 #include <windows.h>
 #endif
 
-#ifdef HAVE_C_ARES
-#include <ares_version.h>
-#endif
-
-#ifdef HAVE_LUA_5_1
-#include <lua.h>
-#endif
-
-#ifdef HAVE_LIBSMI
-#include <smi.h>
-#endif
-
 #ifdef HAVE_OS_X_FRAMEWORKS
 #include <CoreServices/CoreServices.h>
 #endif
@@ -196,113 +184,6 @@ get_compiled_version_info(GString *str, void (*additional_info)(GString *))
        end_string(str);
 }
 
-/*
- * Get compile-time information used only by applications that use
- * libwireshark.
- */
-void
-get_epan_compiled_version_info(GString *str)
-{
-        /* PCRE */
-       g_string_append(str, ", ");
-#ifdef HAVE_LIBPCRE
-       g_string_append(str, "with libpcre ");
-#ifdef PCRE_MAJOR
-#ifdef PCRE_MINOR
-       g_string_append_printf(str, "%u.%u", PCRE_MAJOR, PCRE_MINOR);
-#else                  /* PCRE_MINOR */
-       g_string_append_printf(str, "%u", PCRE_MAJOR);
-#endif                 /* PCRE_MINOR */
-#else          /* PCRE_MAJOR */
-       g_string_append(str, "(version unknown)");
-#endif         /* PCRE_MAJOR */
-#else  /* HAVE_LIBPCRE */
-       g_string_append(str, "without libpcre");
-#endif /* HAVE_LIBPCRE */
-
-        /* SNMP */
-       g_string_append(str, ", ");
-#ifdef HAVE_LIBSMI
-       g_string_append(str, "with SMI " SMI_VERSION_STRING);
-#else /* no SNMP library */
-       g_string_append(str, "without SMI");
-#endif /* _SMI_H */
-
-       /* c-ares */
-       g_string_append(str, ", ");
-#ifdef HAVE_C_ARES
-       g_string_append(str, "with c-ares " ARES_VERSION_STR);
-#else
-       g_string_append(str, "without c-ares");
-
-       /* ADNS - only add if no c-ares */
-       g_string_append(str, ", ");
-#ifdef HAVE_GNU_ADNS
-       g_string_append(str, "with ADNS");
-#else
-       g_string_append(str, "without ADNS");
-#endif /* HAVE_GNU_ADNS */
-#endif /* HAVE_C_ARES */
-
-        /* LUA */
-       g_string_append(str, ", ");
-#ifdef HAVE_LUA_5_1
-       g_string_append(str, "with ");
-       g_string_append(str, LUA_VERSION);
-#else
-       g_string_append(str, "without Lua");
-#endif /* HAVE_LUA_5_1 */
-
-       g_string_append(str, ", ");
-#ifdef HAVE_PYTHON
-       g_string_append(str, "with Python");
-#ifdef PY_VERSION
-       g_string_append(str, " " PY_VERSION);
-#endif /* PY_VERSION */
-#else
-       g_string_append(str, "without Python");
-#endif /* HAVE_PYTHON */
-
-        /* GnuTLS */
-       g_string_append(str, ", ");
-#ifdef HAVE_LIBGNUTLS
-       g_string_append(str, "with GnuTLS " LIBGNUTLS_VERSION);
-#else
-       g_string_append(str, "without GnuTLS");
-#endif /* HAVE_LIBGNUTLS */
-
-        /* Gcrypt */
-       g_string_append(str, ", ");
-#ifdef HAVE_LIBGCRYPT
-       g_string_append(str, "with Gcrypt " GCRYPT_VERSION);
-#else
-       g_string_append(str, "without Gcrypt");
-#endif /* HAVE_LIBGCRYPT */
-
-        /* Kerberos */
-        /* XXX - I don't see how to get the version number, at least for KfW */
-       g_string_append(str, ", ");
-#ifdef HAVE_KERBEROS
-#ifdef HAVE_MIT_KERBEROS
-       g_string_append(str, "with MIT Kerberos");
-#else
-        /* HAVE_HEIMDAL_KERBEROS */
-       g_string_append(str, "with Heimdal Kerberos");
-#endif
-#else
-       g_string_append(str, "without Kerberos");
-#endif /* HAVE_KERBEROS */
-
-       /* GeoIP */
-       g_string_append(str, ", ");
-#ifdef HAVE_GEOIP
-       g_string_append(str, "with GeoIP");
-#else
-       g_string_append(str, "without GeoIP");
-#endif /* HAVE_GEOIP */
-
-}
-
 /*
  * Get various library run-time versions, and the OS version, and append
  * them to the specified GString.
@@ -541,16 +422,6 @@ get_runtime_version_info(GString *str, void (*additional_info)(GString *))
         g_string_append_printf(str, ", with libz %s", zlibVersion());
 #endif
 
-    /* GnuTLS */
-#ifdef HAVE_LIBGNUTLS
-       g_string_append_printf(str, ", GnuTLS %s", gnutls_check_version(NULL));
-#endif /* HAVE_LIBGNUTLS */
-
-        /* Gcrypt */
-#ifdef HAVE_LIBGCRYPT
-       g_string_append_printf(str, ", Gcrypt %s", gcry_check_version(NULL));
-#endif /* HAVE_LIBGCRYPT */
-
        /* Additional application-dependent information */
        if (additional_info)
                (*additional_info)(str);
index d002b7805dc75447355ea1ddb03eca9f7dd30dd8..71638f98d17e09b282c457ea2b4c105f29d108ae 100644 (file)
@@ -47,12 +47,6 @@ extern const gchar *wireshark_svnversion;
 void get_compiled_version_info(GString *str,
     void (*additional_info)(GString *));
 
-/*
- * Get compile-time information used only by applications that use
- * libwireshark.
- */
-void get_epan_compiled_version_info(GString *str);
-
 /*
  * Get various library run-time versions, and the OS version, and append
  * them to the specified GString.