]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
maint: check if git works before relying on it
authorPeter Rosin <peda@lysator.liu.se>
Tue, 1 Jan 2013 18:40:57 +0000 (19:40 +0100)
committerPeter Rosin <peda@lysator.liu.se>
Tue, 1 Jan 2013 18:40:57 +0000 (19:40 +0100)
Makefile.am (m4/ltversion.m4): Take the opportunity to regenerate
$(srcdir)/.serial whenever git is actually working.
(git_version_gen): Provide a fallback version for the git-version-gen
script to use when .tarball-version does not exist and git is not
working.

Signed-off-by: Peter Rosin <peda@lysator.liu.se>
Makefile.am

index 87ed3d99ae617bf249e2c49f87942ce19bef26d5..5f54346582ec8fe334a4272fe762702edd20872e 100644 (file)
@@ -46,7 +46,7 @@ EXTRA_LTLIBRARIES     =
 # Using 'cd' in backquotes may print the directory name, use this instead:
 lt__cd         = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
 
-git_version_gen = '$(SHELL)' '$(aux_dir)/git-version-gen' '.tarball-version'
+git_version_gen = '$(SHELL)' '$(aux_dir)/git-version-gen' '--fallback' '$(VERSION)' '.tarball-version'
 rebuild = rebuild=:; revision=`$(lt__cd) $(srcdir) && $(git_version_gen) | sed 's|-.*$$||g'`
 
 
@@ -126,11 +126,10 @@ $(ltversion_m4): $(ltversion_in) $(dotversion)
        done; \
        if $$rebuild; then \
          rm -f '$@'; \
-         if test -f '$(srcdir)/.serial'; then \
-           serial=`cat '$(srcdir)/.serial'`; \
-         else \
-           serial=`$(git_commit_count)`; \
+         if test -d '$(srcdir)/.git' && git --version >/dev/null 2>&1; then \
+           $(git_commit_count) > '$(srcdir)/.serial'; \
          fi; \
+         serial=`cat '$(srcdir)/.serial'`; \
          if test 0 = '$(AM_DEFAULT_VERBOSITY)' && test 1 != '$(V)'; \
            then echo "  GEN     " $@; \
          else echo $(bootstrap_edit) "'$(ltversion_in)' > '$@'"; fi; \