From dcb174a351c63441f39669145f2032fec51b7b27 Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Wed, 14 Nov 2007 19:13:46 +0100 Subject: Still messing with dist tarball detection --- Makefile.am | 2 ++ configure.ac | 2 +- git-buildmsg/Makefile-files | 9 ++++----- git-buildmsg/git-buildmsg.in | 12 ++++++++++-- git-buildmsg/print-buildmsg.c | 3 ++- 5 files changed, 19 insertions(+), 9 deletions(-) diff --git a/Makefile.am b/Makefile.am index e77ad76..7487af9 100644 --- a/Makefile.am +++ b/Makefile.am @@ -12,6 +12,8 @@ check_SCRIPTS = TESTS = AM_INSTALLCHECK_STD_OPTIONS_EXEMPT = +AM_CPPFLAGS = -I${top_builddir}/include + ACLOCAL_AMFLAGS = -I m4 --install include Makefile-files diff --git a/configure.ac b/configure.ac index e6a82e7..cfabc06 100644 --- a/configure.ac +++ b/configure.ac @@ -6,7 +6,7 @@ AC_INIT([ndims git utilities], [hun@n-dimensional.de], [ndim-git-utils]) AC_CONFIG_AUX_DIR([auto-aux]) -dnl AC_CONFIG_HEADER([include/config.h]) +AC_CONFIG_HEADER([include/config.h]) AC_CONFIG_SRCDIR([git-amb/git-amb.in]) AC_CONFIG_MACRO_DIR([m4]) AM_INIT_AUTOMAKE([-Wall -Werror foreign 1.10 dist-bzip2 diff --git a/git-buildmsg/Makefile-files b/git-buildmsg/Makefile-files index e639d56..de5a1be 100644 --- a/git-buildmsg/Makefile-files +++ b/git-buildmsg/Makefile-files @@ -21,7 +21,7 @@ GIT_BUILDMSG_CMD = $(SHELL) "git-buildmsg/git-buildmsg" --error-if-no-git GIT_BUILDMSG_H = git-buildmsg.h CLEANFILES += $(GIT_BUILDMSG_H) git-buildmsg.stamp: git-buildmsg/git-buildmsg - if env GIT_DIR="$(top_srcdir)/.git" $(GIT_BUILDMSG_CMD) -s "$(top_srcdir)" -o "$(GIT_BUILDMSG_H)"; then \ + @if env GIT_DIR="$(top_srcdir)/.git" $(GIT_BUILDMSG_CMD) -s "$(top_srcdir)" -o "$(GIT_BUILDMSG_H)"; then \ if test -s "$(srcdir)/$(GIT_BUILDMSG_H)"; then \ if diff "$(srcdir)/$(GIT_BUILDMSG_H)" "$(GIT_BUILDMSG_H)"; then \ echo "New $(GIT_BUILDMSG_H) does not differ from $(srcdir)/$(GIT_BUILDMSG_H)"; \ @@ -48,11 +48,10 @@ TESTS += print-buildmsg bin_PROGRAMS += print-buildmsg check_PROGRAMS += print-buildmsg print_buildmsg_SOURCES = git-buildmsg/print-buildmsg.c -print_buildmsg_SOURCES += $(GIT_BUILDMSG_H) +nodist_print_buildmsg_SOURCES = $(GIT_BUILDMSG_H) -dist-hook: +dist-hook: git-buildmsg.stamp if test -e "$(GIT_BUILDMSG_H)"; then \ $(SED) -e 's|^#undef GIT_IS_DIST.*|#define GIT_IS_DIST 1|' \ - "$(GIT_BUILDMSG_H)" > "$(GIT_BUILDMSG_H).new"; \ - mv -f "$(GIT_BUILDMSG_H).new" "$(GIT_BUILDMSG_H)"; \ + "$(GIT_BUILDMSG_H)" > "$(distdir)/$(GIT_BUILDMSG_H)"; \ fi diff --git a/git-buildmsg/git-buildmsg.in b/git-buildmsg/git-buildmsg.in index 1f7d5ea..4ba0b70 100644 --- a/git-buildmsg/git-buildmsg.in +++ b/git-buildmsg/git-buildmsg.in @@ -37,6 +37,8 @@ # # Ideas: # * Output for languages other than C (Erlang, Python, Perl, sh, ...) +# * Recognize difference between being built from "non-git" sources and +# a dist tarball generated from git rev XYZ. # The caller may have found these programs for us SED="${SED-sed}" @@ -223,8 +225,10 @@ cat< #include +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + int main(int argc, char *argv[]) { const char *const idx = strrchr(argv[0], '/'); diff --git a/git-buildmsg/print-buildmsg.c b/git-buildmsg/print-buildmsg.c index c5f4e84..9291b3d 100644 --- a/git-buildmsg/print-buildmsg.c +++ b/git-buildmsg/print-buildmsg.c @@ -1,11 +1,12 @@ #include #include +#include "config.h" #include "git-buildmsg.h" int main(int argc, char *argv[]) { const char *const lastslash = strrchr(argv[0], '/'); const char *const self = (lastslash)?(lastslash+1):(argv[0]); - printf("%s: %s\n", self, GIT_MESSAGE); + printf("%s: v%s, %s\n", self, PACKAGE_VERSION, GIT_MESSAGE); return 0; } -- cgit