+2005-10-12  Simon Josefsson  <jas@extundo.com>
+
+       * modules/gc-md5, modules/gc-hmac-md5: New files.
+
+       * modules/gc (Files): Remove md5, memxor and hmac files.
+
 2005-10-11  Bruno Haible  <bruno@clisp.org>
 
        * modules/c-strcasestr: New file.
 
 2005-10-12  Simon Josefsson  <jas@extundo.com>
 
+       * gc-gnulib.c: Condition MD5 and HMAC-MD5 use on GC_USE_MD5 and
+       GC_USE_HMAC_MD5, respectively.
+
        * gc-libgcrypt.c (gc_md5): Fix assert call.
        (gc_md5): Fix typo.
 
 
 #include <fcntl.h>
 #include <errno.h>
 
-#include "md5.h"
-#include "hmac.h"
+#ifdef GC_USE_MD5
+# include "md5.h"
+#endif
+#ifdef GC_USE_HMAC_MD5
+# include "hmac.h"
+#endif
 
 int
 gc_init (void)
 {
   switch (hash)
     {
+#ifdef GC_USE_MD5
     case GC_MD5:
       md5_buffer (in, inlen, resbuf);
       break;
+#endif
 
     default:
       return GC_INVALID_HASH;
   return GC_OK;
 }
 
+#ifdef GC_USE_MD5
 int
 gc_md5 (const void *in, size_t inlen, void *resbuf)
 {
   md5_buffer (in, inlen, resbuf);
   return 0;
 }
+#endif
 
+#ifdef GC_USE_HMAC_MD5
 int
 gc_hmac_md5 (const void *key, size_t keylen,
             const void *in, size_t inlen, char *resbuf)
   hmac_md5 (key, keylen, in, inlen, resbuf);
   return 0;
 }
+#endif
 
 
   switch (hash)
     {
+#ifdef GC_USE_MD5
     case GC_MD5:
       gcryalg = GCRY_MD_MD5;
       break;
+#endif
 
     default:
       return GC_INVALID_HASH;
 
 /* One-call interface. */
 
+#ifdef GC_USE_MD5
 int
 gc_md5 (const void *in, size_t inlen, void *resbuf)
 {
 
   return GC_OK;
 }
+#endif
 
+#ifdef GC_USE_HMAC_MD5
 int
 gc_hmac_md5 (const void *key, size_t keylen,
             const void *in, size_t inlen, char *resbuf)
 
   return GC_OK;
 }
+#endif
 
+2005-10-12  Simon Josefsson  <jas@extundo.com>
+
+       * gc-md5.m4, gc-hmac-md5: New files.
+
+       * gc.m4: Don't call gl_MD5, gl_MEMXOR or gl_HMAC_MD5.
+
 2005-10-11  Simon Josefsson  <jas@extundo.com>
 
        * crc.m4: New file.
 
--- /dev/null
+# gc-hmac-md5.m4 serial 1
+dnl Copyright (C) 2005 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_GC_HMAC_MD5],
+[
+  AC_REQUIRE([gl_GC])
+  AC_DEFINE(GC_USE_HMAC_MD5, 1,
+    [Define to if you want to support HMAC-MD5 through GC.])
+  if test "$ac_cv_libgcrypt" != yes; then
+    gl_MD5
+    gl_HMAC_MD5
+    gl_MEMXOR
+  fi
+])
 
--- /dev/null
+# gc-md5.m4 serial 1
+dnl Copyright (C) 2005 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_GC_MD5],
+[
+  AC_REQUIRE([gl_GC])
+  AC_DEFINE(GC_USE_MD5, 1, [Define to if you want to support MD5 through GC.])
+  if test "$ac_cv_libgcrypt" != yes; then
+    gl_MD5
+  fi
+])
 
     AC_LIBOBJ([gc-libgcrypt])
   else
     AC_LIBOBJ([gc-gnulib])
-    gl_MD5
-    gl_MEMXOR
-    gl_HMAC_MD5
 
     # Devices with randomness.
     # FIXME: Are these the best defaults?
 
 lib/gc-libgcrypt.c
 lib/gc-gnulib.c
 m4/gc.m4
-lib/md5.h
-lib/md5.c
-m4/md5.m4
-m4/uint32_t.m4
-lib/hmac.h
-lib/hmac-md5.c
-m4/hmac-md5.m4
-lib/memxor.h
-lib/memxor.c
-m4/memxor.m4
 
 Depends-on:
 havelib
 
--- /dev/null
+Description:
+Generic crypto wrappers for HMAC-MD5 functions.
+
+Files:
+m4/gc-hmac-md5.m4
+lib/md5.h
+lib/md5.c
+m4/md5.m4
+lib/hmac.h
+lib/hmac-md5.c
+m4/hmac-md5.m4
+lib/memxor.h
+lib/memxor.c
+m4/memxor.m4
+
+Depends-on:
+stdint
+gc
+
+configure.ac:
+gl_GC_HMAC_MD5
+
+Makefile.am:
+
+Include:
+"gc.h"
+
+License:
+LGPL
+
+Maintainer:
+Simon Josefsson
 
--- /dev/null
+Description:
+Generic crypto wrappers for MD5 functions.
+
+Files:
+m4/gc-md5.m4
+lib/md5.h
+lib/md5.c
+m4/md5.m4
+
+Depends-on:
+stdint
+gc
+
+configure.ac:
+gl_GC_MD5
+
+Makefile.am:
+
+Include:
+"gc.h"
+
+License:
+LGPL
+
+Maintainer:
+Simon Josefsson