From: Aaron Schrab <aa...@schrab.com>

Switch to generating the version string during make process rather than
at configure time.  This makes it easier to keep the detailed version
string accurate when doing development which doesn't require that the
configure script be rerun.
---
 .hgignore    |    1 +
 Makefile.am  |    7 ++++++-
 commands.c   |    1 +
 compose.c    |    1 +
 configure.ac |    3 ---
 dotlock.c    |    1 +
 init.c       |    1 +
 muttlib.c    |    1 +
 sendlib.c    |    1 +
 status.c     |    1 +
 10 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/.hgignore b/.hgignore
index 8995db4..6887cc4 100644
--- a/.hgignore
+++ b/.hgignore
@@ -33,6 +33,7 @@
 ^smime_keys$
 ^txt2c$
 ^stamp-doc-rc$
+^version\.h$
 ^doc/instdoc$
 ^doc/manual\.(txt|xml|aux|log|out|tex|pdf)$
 ^doc/mutt\.1$
diff --git a/Makefile.am b/Makefile.am
index 24daaab..284b274 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -17,7 +17,7 @@ if BUILD_HCACHE
 HCVERSION = hcversion.h
 endif
 
-BUILT_SOURCES = keymap_defs.h patchlist.c reldate.h conststrings.c $(HCVERSION)
+BUILT_SOURCES = keymap_defs.h patchlist.c reldate.h conststrings.c version.h 
$(HCVERSION)
 
 bin_PROGRAMS = mutt @DOTLOCK_TARGET@ @PGPAUX_TARGET@
 mutt_SOURCES = \
@@ -136,6 +136,11 @@ keymap_alldefs.h: $(srcdir)/OPS $(srcdir)/OPS.PGP 
$(srcdir)/OPS.MIX $(srcdir)/OP
                $(srcdir)/OPS.MIX $(srcdir)/OPS.CRYPT $(srcdir)/OPS.SMIME \
                        > keymap_alldefs.h
 
+version.h: FORCE
+       echo '#define MUTT_VERSION "'`sh "$(srcdir)/version.sh"`'"' > $@.tmp
+       (cmp -s $@ $@.tmp) && rm -f $@.tmp || mv $@.tmp $@
+FORCE:
+
 reldate.h: $(srcdir)/ChangeLog
        echo 'const char *ReleaseDate = "'`head -n 1 $(srcdir)/ChangeLog | 
LC_ALL=C cut -d ' ' -f 1`'";' > reldate.h.tmp; \
        cmp -s reldate.h.tmp reldate.h || cp reldate.h.tmp reldate.h; \
diff --git a/commands.c b/commands.c
index bc1036b..13b12dd 100644
--- a/commands.c
+++ b/commands.c
@@ -21,6 +21,7 @@
 # include "config.h"
 #endif
 
+#include "version.h"
 #include "mutt.h"
 #include "mutt_curses.h"
 #include "mutt_menu.h"
diff --git a/compose.c b/compose.c
index edda021..b641d16 100644
--- a/compose.c
+++ b/compose.c
@@ -21,6 +21,7 @@
 # include "config.h"
 #endif
 
+#include "version.h"
 #include "mutt.h"
 #include "mutt_curses.h"
 #include "mutt_idna.h"
diff --git a/configure.ac b/configure.ac
index 71a6452..ed0bd3d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -11,9 +11,6 @@ mutt_cv_version=`cat "$srcdir/VERSION"`
 AM_INIT_AUTOMAKE(mutt, $mutt_cv_version)
 AC_SUBST([CONFIG_STATUS_DEPENDENCIES], ['$(top_srcdir)/VERSION'])
 
-MUTT_VERSION=`env sh "$srcdir/version.sh"`
-AC_DEFINE_UNQUOTED(MUTT_VERSION,"$MUTT_VERSION", [Full textual version 
string.])
-
 AC_GNU_SOURCE
 
 ALL_LINGUAS="de eu ru it es uk fr pl nl cs id sk ko el zh_TW zh_CN pt_BR eo gl 
sv da lt tr ja hu et ca bg ga"
diff --git a/dotlock.c b/dotlock.c
index 5bf0348..9dd958a 100644
--- a/dotlock.c
+++ b/dotlock.c
@@ -46,6 +46,7 @@
 #include <limits.h>
 #endif
 
+#include "version.h"
 #include "dotlock.h"
 
 #ifdef HAVE_GETOPT_H
diff --git a/init.c b/init.c
index a3ec232..d69fff2 100644
--- a/init.c
+++ b/init.c
@@ -20,6 +20,7 @@
 # include "config.h"
 #endif
 
+#include "version.h"
 #include "mutt.h"
 #include "mapping.h"
 #include "mutt_curses.h"
diff --git a/muttlib.c b/muttlib.c
index 7e93a3a..1f4982b 100644
--- a/muttlib.c
+++ b/muttlib.c
@@ -21,6 +21,7 @@
 # include "config.h"
 #endif
 
+#include "version.h"
 #include "mutt.h"
 #include "mutt_curses.h"
 #include "mime.h"
diff --git a/sendlib.c b/sendlib.c
index 249d6a1..f8d41e1 100644
--- a/sendlib.c
+++ b/sendlib.c
@@ -22,6 +22,7 @@
 # include "config.h"
 #endif
 
+#include "version.h"
 #include "mutt.h"
 #include "mutt_curses.h"
 #include "rfc2047.h"
diff --git a/status.c b/status.c
index 1bb9a5a..acf788e 100644
--- a/status.c
+++ b/status.c
@@ -20,6 +20,7 @@
 # include "config.h"
 #endif
 
+#include "version.h"
 #include "mutt.h"
 #include "mutt_menu.h"
 #include "mutt_curses.h"
-- 
1.7.10.4

Reply via email to