From 4f49025cf0989f6c4a06be0b24aeec1d4625d10f Mon Sep 17 00:00:00 2001 From: Pekka Riikonen Date: Sun, 24 Jun 2007 14:17:05 +0000 Subject: [PATCH] Added SILC_VERSION macro. --- configure.ad | 22 ++++++++++++++++++++-- includes/silc.h.in | 1 - includes/silcversion.h.in | 5 +++++ 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/configure.ad b/configure.ad index de959e79..f719d7a3 100644 --- a/configure.ad +++ b/configure.ad @@ -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 diff --git a/includes/silc.h.in b/includes/silc.h.in index 0353baac..accf5225 100644 --- a/includes/silc.h.in +++ b/includes/silc.h.in @@ -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 */ diff --git a/includes/silcversion.h.in b/includes/silcversion.h.in index ebe86f79..45a65c9f 100644 --- a/includes/silcversion.h.in +++ b/includes/silcversion.h.in @@ -24,6 +24,11 @@ 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@" -- 2.24.0