eet now has an eet_version you can runtime check:
authorraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Fri, 21 May 2010 14:07:25 +0000 (14:07 +0000)
committerraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Fri, 21 May 2010 14:07:25 +0000 (14:07 +0000)
eet_version->major
eet_version->minor
eet_version->micro
eet_version->revision

also an ifdef.

nb - revision is 0 if its a rrelease, > 0 if built from svn.

git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/eet@49098 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

configure.ac
eet.pc.in
src/lib/Eet.h
src/lib/eet_lib.c

index 68aca69..624062e 100644 (file)
@@ -22,9 +22,24 @@ VMAJ=`echo $PACKAGE_VERSION | awk -F. '{printf("%s", $1);}'`
 VMIN=`echo $PACKAGE_VERSION | awk -F. '{printf("%s", $2);}'`
 VMIC=`echo $PACKAGE_VERSION | awk -F. '{printf("%s", $3);}'`
 SNAP=`echo $PACKAGE_VERSION | awk -F. '{printf("%s", $4);}'`
+
+VREV="0"
+SVNVERSION=`which svnversion`
+if test -n "$SVNVERSION"; then
+  VREV=`$SVNVERSION . | awk -F : '{printf("%s\n", $1);}' | tr 'A-z' ' '`
+fi
+# When released uncomment the following
+##VREV="0"
+
+AC_SUBST(VREV)
+
+AC_DEFINE_UNQUOTED(VMAJ, $VMAJ, [Major version])
+AC_DEFINE_UNQUOTED(VMIN, $VMIN, [Minor version])
+AC_DEFINE_UNQUOTED(VMIC, $VMIC, [Micro version])
+AC_DEFINE_UNQUOTED(VREV, $VREV, [Revison])
 version_info=`expr $VMAJ + $VMIN`":$VMIC:$VMIN"
-#release="ver-pre-svn-00"
-#release_info="-release $release"
+##release="ver-pre-svn-00"
+##release_info="-release $release"
 release_info=""
 AC_SUBST(version_info)
 AC_SUBST(release_info)
index df841e2..f1b47ce 100644 (file)
--- a/eet.pc.in
+++ b/eet.pc.in
@@ -2,6 +2,7 @@ prefix=@prefix@
 exec_prefix=@exec_prefix@
 libdir=@libdir@
 includedir=@includedir@
+revision=@VREV@
 
 Name: eet
 Description: Library for speedy data storage, retrieval, and compression
index 6ad9c09..7a65e7e 100644 (file)
@@ -34,7 +34,7 @@
 #ifdef __cplusplus
 extern "C" {
 #endif
-
+   
   /**
    * @file Eet.h
    * @brief The file that provides the eet functions.
@@ -43,6 +43,41 @@ extern "C" {
    *
    */
 
+#define EET_VERSION_MAJOR 1
+#define EET_VERSION_MINOR 2
+  /**
+   * @typedef Eet_Version
+   * 
+   * This is the Eet version information structure that can be used at
+   * runtiime to detect which version of eet is being used and adapt
+   * appropriately as follows for example:
+   * 
+   * @code
+   * #if define(EET_VERSION_MAJOR) && (EET_VERSION_MAJOR >= 1) && defined(EET_VERSION_MINOR) && (EET_VERSION_MINOR > 2)
+   * printf("Eet version: %i.%i.%i\n", 
+   *        eet_version->major, 
+   *        eet_version->minor, 
+   *        eet_version->micro);
+   * if (eet_version->revision > 0)
+   *   {
+   *     printf("  Built from SVN revision # %i\n", eet_version->revision);
+   *   }
+   * #endif
+   * @endcode
+   * 
+   * Note the #if check can be dropped if your program refuses to compile or
+   * work with an Eet version less than 1.3.0. 
+   */
+   typedef struct _Eet_Version
+     { 
+        int major; /** < major (binary or source incompatible changes) */
+        int minor; /** < minor (new features, bugfixes, major improvements version) */
+        int micro; /** < micro (bugfix, internal improvements, no new features version) */
+        int revision; /** < svn revision (0 if a proper rlease or the svn revsion number Eet is built from) */
+     } Eet_Version;
+   
+   EAPI extern Eet_Version *eet_version;
+   
   /**
    * @defgroup Eet_Group Top level functions
    * Functions that affect Eet as a whole.
index 82e8b21..b8b91bf 100644 (file)
@@ -69,6 +69,9 @@ void *alloca (size_t);
 #include "Eet.h"
 #include "Eet_private.h"
 
+static Eet_Version _version = { VMAJ, VMIN, VMIC, VREV };
+EAPI Eet_Version *eet_version = &_version;;
+
 #ifdef HAVE_REALPATH
 # undef HAVE_REALPATH
 #endif