bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Conditional inclusion


From: Simon Josefsson
Subject: Re: Conditional inclusion
Date: Mon, 15 Oct 2007 11:03:57 +0200
User-agent: Gnus/5.110007 (No Gnus v0.7) Emacs/22.1 (gnu/linux)

Micah Cowan <address@hidden> writes:

> If I've --import'ed md5, is there a means for me to specify in
> configure.ac that it should not be included in certain circumstances?
>
> I'm in the process of converting portions of Wget to gnulib. We had
> GNU's MD5 code in there, but only used it when we couldn't get
> equivalent code from elsewhere; for example, we also use OpenSSL, which
> includes an MD5 generator. So in situations where we link with OpenSSL,
> we would build without the included MD5, to save size on the binary.
>
> Is this still doable? It looks to me that gl_INIT will unconditionally
> invoke gl_MD5, which will unconditionally set up compilation of md5.c.

Maybe you want the gc-md5 module?  It will enable gnulib's md5 module if
it is needed, or if it finds libgcrypt, it will use md5 from libgcrypt.
If you want to support OpenSSL too, you should be able to write a
gc-openssl.c (see gc-gnulib.c and gc-libgcrypt.c).

The advantage with the gc-md5 module is that you'll get a consistent md5
API regardless of wheter gnulib, libgcrypt or (possibly) openssl is
used:

#include <gc.h>
...
Gc_rc ret;
ret = gc_md5 (in, inlen, resbuf);

See gc.h, non-single-pass invocations are also possible.

/Simon




reply via email to

[Prev in Thread] Current Thread [Next in Thread]