include $(top_srcdir)/flymake.am
AUTOMAKE_OPTIONS = 1.6 foreign
-EXTRA_PROGRAMS = mutt_md5
EXTRA_DIST = bdb.c gdbm.c hcache.c kc.c lmdb.c qdbm.c tc.c hcachever.sh
noinst_LIBRARIES = libhcache.a
noinst_HEADERS = backend.h hcache.h
-noinst_PROGRAMS = $(MUTT_MD5)
libhcache_a_SOURCES =
LIBMUTT = -L../lib -lmutt
LIBMUTTDEPS = $(top_srcdir)/lib/lib.h ../lib/libmutt.a
-mutt_md5_SOURCES = mutt_md5.c
-mutt_md5_LDADD = $(LIBMUTT)
-mutt_md5_DEPENDENCIES = $(LIBMUTTDEPS)
-
BUILT_SOURCES = $(HCVERSION)
$(top_srcdir)/keymap_defs.h:
hcversion.h: $(top_srcdir)/mutt.h $(top_srcdir)/address.h $(top_srcdir)/list.h \
$(top_srcdir)/lib/buffer.h $(top_srcdir)/parameter.h \
$(top_srcdir)/body.h $(top_srcdir)/envelope.h \
- $(top_srcdir)/header.h $(srcdir)/hcachever.sh $(MUTT_MD5)
+ $(top_srcdir)/header.h $(srcdir)/hcachever.sh
( echo '#include "config.h"'; echo '#include "mutt.h"'; \
echo '#include "address.h"'; echo '#include "list.h"'; \
echo '#include "lib/buffer.h"'; echo '#include "parameter.h"'; \
return
}
+md5prog () {
+ prog=""
+
+ # Use OpenSSL if it's installed
+ openssl=`which openssl`
+ if [ $? = 0 ];then
+ echo "$openssl md5 -r"
+ return
+ fi
+
+ # Fallback to looking for a system-specific utility
+ case "`uname`" in
+ SunOS)
+ # This matches most of the Solaris family
+ prog="digest -a md5"
+ ;;
+ *BSD)
+ # FreeBSD, NetBSD, and OpenBSD all have md5
+ prog="md5"
+ ;;
+ *)
+ # Assume anything else has binutils' md5sum
+ prog="md5sum"
+ ;;
+ esac
+
+ echo $prog
+}
+
DEST="$1"
TMPD="$DEST.tmp"
done
echo " */" >> $TMPD
-MD5TEXT=`echo "$TEXT" | ./mutt_md5`
-echo "#define HCACHEVER 0x"`echo $MD5TEXT | cut -c-8` >> $TMPD
+MD5PROG=$(md5prog)
+MD5TEXT=`echo "$TEXT" | $MD5PROG | cut -c-8`
+echo "#define HCACHEVER 0x$MD5TEXT" >> $TMPD
# TODO: validate we have all structs
+++ /dev/null
-/**
- * @file
- * Calculate the MD5 checksum of a buffer
- *
- * @authors
- * Copyright (C) 1995,1996,1997,1999,2000,2001,2005,2006,2008 Free Software Foundation, Inc.
- *
- * @copyright
- * This program is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free Software
- * Foundation, either version 2 of the License, or (at your option) any later
- * version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see <http://www.gnu.org/licenses/>.
- *
- * md5.c - Functions to compute MD5 message digest of files or memory blocks
- * according to the definition of MD5 in RFC1321 from April 1992.
- *
- * NOTE: The canonical source of this file is maintained with the GNU C
- * Library. Bugs can be reported to bug-glibc@prep.ai.mit.edu.
- */
-
-/* Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995. */
-
-#include "config.h"
-#include <stddef.h>
-#include <stdbool.h>
-#include <string.h>
-#include "lib/md5.h"
-
-/* local md5 equivalent for header cache versioning */
-int main(void)
-{
- unsigned char r[16];
- int rc;
-
- if ((rc = md5_stream(stdin, r)))
- return rc;
-
- printf("%02x%02x%02x%02x%02x%02x%02x%02x"
- "%02x%02x%02x%02x%02x%02x%02x%02x\n",
- r[0], r[1], r[2], r[3], r[4], r[5], r[6], r[7], r[8], r[9], r[10],
- r[11], r[12], r[13], r[14], r[15]);
-
- return 0;
-}
-