[libvirt] [PATCH] Fix compilation with gcrypt < 1.4.2

Commit 33a198c1f6a4a1bc7f34d50a31032e03bec10fee increased the gcrypt version requirement to 1.4.2 because the GCRY_THREAD_OPTION_VERSION define was added in this version. The configure script doesn't check for the gcrypt version. To support gcrypt versions < 1.4.2 change the virTLSThreadImpl initialization to use GCRY_THREAD_OPTION_VERSION only if it's defined. --- src/libvirt.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/src/libvirt.c b/src/libvirt.c index cad33c2..937cdb4 100644 --- a/src/libvirt.c +++ b/src/libvirt.c @@ -291,7 +291,12 @@ static int virTLSMutexUnlock(void **priv) } static struct gcry_thread_cbs virTLSThreadImpl = { + /* GCRY_THREAD_OPTION_VERSION was added in gcrypt 1.4.2 */ +#ifdef GCRY_THREAD_OPTION_VERSION (GCRY_THREAD_OPTION_PTHREAD | (GCRY_THREAD_OPTION_VERSION << 8)), +#else + GCRY_THREAD_OPTION_PTHREAD, +#endif NULL, virTLSMutexInit, virTLSMutexDestroy, -- 1.6.0.4

On Fri, Dec 18, 2009 at 12:10:08PM +0100, Matthias Bolte wrote:
Commit 33a198c1f6a4a1bc7f34d50a31032e03bec10fee increased the gcrypt version requirement to 1.4.2 because the GCRY_THREAD_OPTION_VERSION define was added in this version.
The configure script doesn't check for the gcrypt version. To support gcrypt versions < 1.4.2 change the virTLSThreadImpl initialization to use GCRY_THREAD_OPTION_VERSION only if it's defined. --- src/libvirt.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/src/libvirt.c b/src/libvirt.c index cad33c2..937cdb4 100644 --- a/src/libvirt.c +++ b/src/libvirt.c @@ -291,7 +291,12 @@ static int virTLSMutexUnlock(void **priv) }
static struct gcry_thread_cbs virTLSThreadImpl = { + /* GCRY_THREAD_OPTION_VERSION was added in gcrypt 1.4.2 */ +#ifdef GCRY_THREAD_OPTION_VERSION (GCRY_THREAD_OPTION_PTHREAD | (GCRY_THREAD_OPTION_VERSION << 8)), +#else + GCRY_THREAD_OPTION_PTHREAD, +#endif NULL, virTLSMutexInit, virTLSMutexDestroy,
I think that's the simplest. gcrypt 1.4.2 is rather old, but still it might be preferable to not break build and keep without the fix if on the old one. ACK, Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/

2009/12/18 Daniel Veillard <veillard@redhat.com>:
On Fri, Dec 18, 2009 at 12:10:08PM +0100, Matthias Bolte wrote:
Commit 33a198c1f6a4a1bc7f34d50a31032e03bec10fee increased the gcrypt version requirement to 1.4.2 because the GCRY_THREAD_OPTION_VERSION define was added in this version.
The configure script doesn't check for the gcrypt version. To support gcrypt versions < 1.4.2 change the virTLSThreadImpl initialization to use GCRY_THREAD_OPTION_VERSION only if it's defined. --- src/libvirt.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/src/libvirt.c b/src/libvirt.c index cad33c2..937cdb4 100644 --- a/src/libvirt.c +++ b/src/libvirt.c @@ -291,7 +291,12 @@ static int virTLSMutexUnlock(void **priv) }
static struct gcry_thread_cbs virTLSThreadImpl = { + /* GCRY_THREAD_OPTION_VERSION was added in gcrypt 1.4.2 */ +#ifdef GCRY_THREAD_OPTION_VERSION (GCRY_THREAD_OPTION_PTHREAD | (GCRY_THREAD_OPTION_VERSION << 8)), +#else + GCRY_THREAD_OPTION_PTHREAD, +#endif NULL, virTLSMutexInit, virTLSMutexDestroy,
I think that's the simplest. gcrypt 1.4.2 is rather old, but still it might be preferable to not break build and keep without the fix if on the old one.
ACK,
Daniel
Okay, pushed. Matthias
participants (2)
-
Daniel Veillard
-
Matthias Bolte