Added SILC_VERSION macro.
authorPekka Riikonen <priikone@silcnet.org>
Sun, 24 Jun 2007 14:17:05 +0000 (14:17 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Sun, 24 Jun 2007 14:17:05 +0000 (14:17 +0000)
configure.ad
includes/silc.h.in
includes/silcversion.h.in

index de959e791d3fc542e2b537025f855ca099175ecb..f719d7a3aeb9dfd5fa5745a59592f7496ccf00a3 100644 (file)
@@ -95,8 +95,26 @@ __SILC_HAVE_SIM=""
 __SILC_ENABLE_DEBUG=""
 
 #ifdef SILC_DIST_TOOLKIT
-toolkitver=`echo $VERSION | sed 's/\./_/g'`
-__SILC_PACKAGE_VERSION="#define __SILC_TOOLKIT_$toolkitver 1"
+toolkitver=`echo $VERSION | sed 's/\./ /g'`
+maj=0
+min=0
+bld=0
+for v in $toolkitver
+do
+  if test $maj -eq 0; then
+    maj=$v
+    continue
+  fi
+  if test $min -eq 0; then
+    min=$v
+    continue
+  fi
+  if test $bld -eq 0; then
+    bld=$v
+    continue
+  fi
+done
+__SILC_PACKAGE_VERSION="#define __SILC_TOOLKIT_VERSION SILC_VERSION($maj,$min,$bld)"
 #endif SILC_DIST_TOOLKIT
 
 AC_PROG_RANLIB
index 0353baac7675c6427ca687b8918c26da5361c9b6..accf52253b65e52d30cbe70023af67db24c19949 100644 (file)
@@ -65,7 +65,6 @@ extern "C" {
 @__SILC_HAVE_PTHREAD@
 @__SILC_HAVE_SIM@
 @__SILC_ENABLE_DEBUG@
-@__SILC_PACKAGE_VERSION@
 
 #if defined(HAVE_SILCDEFS_H)
 /* Automatically generated configuration header */
index ebe86f793a7c1ea50d7b25d810111a5f93107664..45a65c9fe6e8cf757d9b72350e12364ec35cb511 100644 (file)
 extern "C" {
 #endif
 
+/* Version check macro.  Use this to check that package is of specific
+   version compile time.  Use the __SILC_XXX_VERSION below in comparison. */
+#define SILC_VERSION(a, b, c) (((a) << 24) + ((b) << 16) + ((c) << 8)
+@__SILC_PACKAGE_VERSION@
+
 #define SILC_VERSION_STRING "@VERSION@"
 #define SILC_DIST_VERSION_STRING "@VERSION@"
 #define SILC_PROTOCOL_VERSION_STRING "SILC-1.2-@VERSION@ @PACKAGE@"