diff options
author | Werner Koch <wk@gnupg.org> | 2013-03-18 15:31:34 +0100 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2013-03-18 15:31:34 +0100 |
commit | 620fed5e13e5de927e15a770df0c2707fc581610 (patch) | |
tree | a188b75c88444431ce44efdc4feeaba9622a5828 | |
parent | 267c5acf206f0ee295f5cfa6b230a138f580ee47 (diff) | |
download | libgcrypt-620fed5e13e5de927e15a770df0c2707fc581610.tar.gz |
Provide a GCRYPT_VERSION_NUMBER macro.
* src/gcrypt.h.in (GCRYPT_VERSION_NUMBER): New.
* configure.ac (VERSION_NUMBER): New ac_subst.
* compat/compat.c (_gcry_compat_identification): Include revision and
timestamp.
* src/global.c (_gcry_vcontrol): Move call to above function ...
(gcry_check_version): .. here.
-rw-r--r-- | compat/compat.c | 2 | ||||
-rw-r--r-- | configure.ac | 3 | ||||
-rw-r--r-- | src/gcrypt.h.in | 5 | ||||
-rw-r--r-- | src/global.c | 5 |
4 files changed, 13 insertions, 2 deletions
diff --git a/compat/compat.c b/compat/compat.c index e2a03933..3d979f89 100644 --- a/compat/compat.c +++ b/compat/compat.c @@ -30,6 +30,8 @@ _gcry_compat_identification (void) "This is Libgcrypt " PACKAGE_VERSION " - The GNU Crypto Library\n" "Copyright 2000, 2002, 2003, 2004, 2007, 2008, 2009,\n" " 2010, 2011 Free Software Foundation, Inc.\n" + "\n" + "(" BUILD_REVISION " " BUILD_TIMESTAMP ")\n" "\n\n"; return blurb; } diff --git a/configure.ac b/configure.ac index 39eba129..83ba4860 100644 --- a/configure.ac +++ b/configure.ac @@ -127,6 +127,9 @@ AC_SUBST(PACKAGE) AC_SUBST(VERSION) AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this package]) AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version of this package]) +VERSION_NUMBER=m4_esyscmd(printf "0x%02x%02x%02x" mym4_version_major \ + mym4_version_minor mym4_version_micro) +AC_SUBST(VERSION_NUMBER) ###################### diff --git a/src/gcrypt.h.in b/src/gcrypt.h.in index dab7033a..86faa2d7 100644 --- a/src/gcrypt.h.in +++ b/src/gcrypt.h.in @@ -63,6 +63,11 @@ extern "C" { matches the installed library. */ #define GCRYPT_VERSION "@VERSION@" +/* The version number of this header. It may be used to handle minor + API incompatibilities. */ +#define GCRYPT_VERSION_NUMBER @VERSION_NUMBER@ + + /* Internal: We can't use the convenience macros for the multi precision integer functions when building this library. */ #ifdef _GCRYPT_IN_LIBGCRYPT diff --git a/src/global.c b/src/global.c index 24cfca51..9b9d531a 100644 --- a/src/global.c +++ b/src/global.c @@ -236,6 +236,9 @@ gcry_check_version( const char *req_version ) int rq_major, rq_minor, rq_micro; const char *my_plvl; + if (req_version && req_version[0] == 1 && req_version[1] == 1) + return _gcry_compat_identification (); + /* Initialize library. */ global_init (); @@ -607,8 +610,6 @@ _gcry_vcontrol (enum gcry_ctl_cmds cmd, va_list arg_ptr) break; default: - /* A call to make sure that the dummy code is linked in. */ - _gcry_compat_identification (); err = GPG_ERR_INV_OP; } |