<<< Date Index >>>     <<< Thread Index >>>

Re: [PATCH] when using `which` send errors to /dev/null



On Wednesday, 23 May 2007 at 18:48, Luciano Rocha wrote:
> # HG changeset patch
> # User luciano@xxxxxxxxxxxxxxxxxxxxxx
> # Date 1179846675 -3600
> # Node ID 357b7651d6095f5b2e9c5dab1e4cb5c7fb6bc379
> # Parent  516f41633e202184e897bef24a6d9f17bba7c0ba
> when using `which` send errors to /dev/null

It seemed much easier to let autoconf handle this...
# HG changeset patch
# User Brendan Cully <brendan@xxxxxxxxxx>
# Date 1180395860 25200
# Branch HEAD
# Node ID 794b039bacaa0b228ac3bb538c1c8ae38dddfad0
# Parent  516f41633e202184e897bef24a6d9f17bba7c0ba
Use autoconf instead of "which" to discover MD5 tool

diff --git a/ChangeLog b/ChangeLog
--- a/ChangeLog
+++ b/ChangeLog
@@ -306,7 +306,7 @@ 2007-04-05 19:22 -0700  Brendan Cully  <
 
 2007-04-05 13:06 -0700  Jukka Salmi  <j+mutt@xxxxxxxxxxxxx>  (3638701db407)
 
-       * ChangeLog, configure.ac: Check for BDB4 libs in $lib as well as
+       * configure.ac: Check for BDB4 libs in $lib as well as
        $lib/$ver (fixes pkgsrc BDB4 detection)
 
 2007-04-05 12:55 -0700  Brendan Cully  <brendan@xxxxxxxxxx>  (4f435337507e)
diff --git a/Makefile.am b/Makefile.am
--- a/Makefile.am
+++ b/Makefile.am
@@ -78,7 +78,7 @@ EXTRA_DIST = COPYRIGHT GPL OPS OPS.PGP O
        makedoc.c makedoc-defs.h stamp-doc-rc README.SSL smime.h \
        muttbug pgppacket.h depcomp ascii.h BEWARE PATCHES patchlist.sh \
        ChangeLog ChangeLog.old mkchangelog.sh cvslog2changelog.pl mutt_idna.h \
-       snprintf.c regex.c crypt-gpgme.h hcachever.sh
+       snprintf.c regex.c crypt-gpgme.h hcachever.sh.in
 
 EXTRA_SCRIPTS = smime_keys
 
@@ -128,7 +128,7 @@ reldate.h: $(srcdir)/ChangeLog
 
 hcversion.h: $(srcdir)/mutt.h $(srcdir)/rfc822.h
        ( echo '#include "config.h"'; echo '#include "mutt.h"'; ) \
-       | $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) 
$(CPPFLAGS) - | $(srcdir)/hcachever.sh hcversion.h
+       | $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) 
$(CPPFLAGS) - | sh ./hcachever.sh hcversion.h
 
 patchlist.c: $(srcdir)/PATCHES $(srcdir)/patchlist.sh
        $(srcdir)/patchlist.sh < $(srcdir)/PATCHES > patchlist.c
diff --git a/configure.ac b/configure.ac
--- a/configure.ac
+++ b/configure.ac
@@ -812,6 +812,9 @@ AC_ARG_ENABLE(hcache, AC_HELP_STRING([--
     OLDLIBS="$LIBS"
 
     need_md5="yes"
+
+    dnl hcachever.sh tool for calculating struct digest
+    AC_CHECK_PROGS([MD5], [md5 md5sum openssl], [none])
 
     use_qdbm=no
     AC_ARG_WITH(qdbm, AC_HELP_STRING([--without-qdbm], [Don't use qdbm even if 
it is available]))
@@ -1186,8 +1189,6 @@ fi
 fi
 AC_SUBST(DSLROOT)
 
-AC_OUTPUT(Makefile intl/Makefile m4/Makefile
-        po/Makefile.in doc/Makefile contrib/Makefile
-        muttbug.sh
-        imap/Makefile
-        doc/instdoc.sh)
+AC_OUTPUT(Makefile contrib/Makefile doc/Makefile imap/Makefile
+        intl/Makefile m4/Makefile po/Makefile.in
+        hcachever.sh muttbug.sh doc/instdoc.sh)
diff --git a/hcachever.sh b/hcachever.sh.in
rename from hcachever.sh
rename to hcachever.sh.in
--- a/hcachever.sh.in
+++ b/hcachever.sh.in
@@ -2,16 +2,12 @@
 
 BASEVERSION=1
 
-if test -x "`which md5`"
-then
-  MD5=md5
-elif test -x "`which md5sum`"
-then
-  MD5=md5sum
-elif test -x "`which openssl`"
+MD5=@MD5@
+if test "$MD5" = "openssl"
 then
   MD5="openssl md5 -hex"
-else
+elif test "$MD5" = "none"
+then
   echo "ERROR: no MD5 tool found"
   exit 1
 fi

Attachment: pgp3l6wt2JrzX.pgp
Description: PGP signature