eet now has an eet_version you can runtime check:

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.



SVN revision: 49098
This commit is contained in:
Carsten Haitzler 2010-05-21 14:07:25 +00:00
parent 2677b8d493
commit 56265a930f
4 changed files with 57 additions and 3 deletions

View 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)

View File

@ -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

View 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.

View 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