tests: expose automake bug#14560
[platform/upstream/automake.git] / maint.mk
1 # Maintainer makefile rules for Automake.
2 #
3 # Copyright (C) 1995-2013 Free Software Foundation, Inc.
4 #
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2, or (at your option)
8 # any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
18 # Avoid CDPATH issues.
19 unexport CDPATH
20
21 # Program to use to fetch files from the Net.
22 WGET = wget
23
24 # --------------------------------------------------------- #
25 #  Automatic generation of the ChangeLog from git history.  #
26 # --------------------------------------------------------- #
27
28 gitlog_to_changelog_command = $(PERL) $(srcdir)/lib/gitlog-to-changelog
29 gitlog_to_changelog_fixes = $(srcdir)/.git-log-fix
30 gitlog_to_changelog_options = --amend=$(gitlog_to_changelog_fixes) \
31                               --since='2011-12-28 00:00:00' \
32                               --no-cluster --format '%s%n%n%b'
33
34 EXTRA_DIST += lib/gitlog-to-changelog
35 EXTRA_DIST += $(gitlog_to_changelog_fixes)
36
37 # When executed from a git checkout, generate the ChangeLog from the git
38 # history.  When executed from an extracted distribution tarball, just
39 # copy the distributed ChangeLog in the build directory (and if this
40 # fails, or if no distributed ChangeLog file is present, complain and
41 # give an error).
42 #
43 # The ChangeLog should be regenerated unconditionally when working from
44 # checked-out sources; otherwise, if we're working from a distribution
45 # tarball, we expect the ChangeLog to be distributed, so check that it
46 # is indeed present in the source directory.
47 ChangeLog:
48         $(AM_V_GEN)set -e; set -u; \
49         if test -d $(srcdir)/.git; then \
50           rm -f $@-t \
51             && $(gitlog_to_changelog_command) \
52                $(gitlog_to_changelog_options) >$@-t \
53             && chmod a-w $@-t \
54             && mv -f $@-t $@ \
55             || exit 1; \
56         elif test ! -f $(srcdir)/$@; then \
57           echo "Source tree is not a git checkout, and no pre-existent" \
58                "$@ file has been found there" >&2; \
59           exit 1; \
60         fi
61 .PHONY: ChangeLog
62
63
64 # --------------------------- #
65 #  Perl coverage statistics.  #
66 # --------------------------- #
67
68 PERL_COVERAGE_DB = $(abs_top_builddir)/cover_db
69 PERL_COVERAGE_FLAGS = -MDevel::Cover=-db,$(PERL_COVERAGE_DB),-silent,on,-summary,off
70 PERL_COVER = cover
71
72 check-coverage-run recheck-coverage-run: %-coverage-run: all
73         $(MKDIR_P) $(PERL_COVERAGE_DB)
74         PERL5OPT="$$PERL5OPT $(PERL_COVERAGE_FLAGS)"; export PERL5OPT; \
75         WANT_NO_THREADS=yes; export WANT_NO_THREADS; unset AUTOMAKE_JOBS; \
76         $(MAKE) $*
77
78 check-coverage-report:
79         @if test ! -d "$(PERL_COVERAGE_DB)"; then \
80           echo "No coverage database found in '$(PERL_COVERAGE_DB)'." >&2; \
81           echo "Please run \"make check-coverage\" first" >&2; \
82           exit 1; \
83         fi
84         $(PERL_COVER) $(PERL_COVER_FLAGS) "$(PERL_COVERAGE_DB)"
85
86 # We don't use direct dependencies here because we'd like to be able
87 # to invoke the report even after interrupted check-coverage.
88 check-coverage: check-coverage-run
89         $(MAKE) check-coverage-report
90
91 recheck-coverage: recheck-coverage-run
92         $(MAKE) check-coverage-report
93
94 clean-coverage:
95         rm -rf "$(PERL_COVERAGE_DB)"
96 clean-local: clean-coverage
97
98 .PHONY: check-coverage recheck-coverage check-coverage-run \
99         recheck-coverage-run check-coverage-report clean-coverage
100
101
102 # ---------------------------------------------------- #
103 #  Tagging and/or uploading stable and beta releases.  #
104 # ---------------------------------------------------- #
105
106 GIT = git
107
108 EXTRA_DIST += lib/gnupload
109
110 # First component of a version number (mandatory).
111 rx-0 = ^[1-9][0-9]*
112 # Later components of a version number (optional).
113 rx-1 = \.[0-9][0-9]*
114 # Used in recipes to decide which kind of release we are.
115 stable_major_version_rx = $(rx-0)\.0$$
116 stable_minor_version_rx = $(rx-0)$(rx-1)$$
117 stable_micro_version_rx = $(rx-0)$(rx-1)$(rx-1)$$
118 beta_version_rx = $(rx-0)($(rx-1)){1,2}[bdfhjlnprtvxz]$$
119 alpha_version_rx  = $(rx-0)($(rx-1)){1,2}[acegikmoqsuwy]$$
120 match_version = echo "$(VERSION)" | $(EGREP) >/dev/null
121
122 # Check that we don't have uncommitted or unstaged changes.
123 # TODO: Maybe the git suite already offers a shortcut to verify if the
124 # TODO: working directory is "clean" or not?  If yes, use that instead
125 # TODO: of duplicating the logic here.
126 git_must_have_clean_workdir = \
127   $(GIT) rev-parse --verify HEAD >/dev/null \
128     && $(GIT) update-index -q --refresh \
129     && $(GIT) diff-files --quiet \
130     && $(GIT) diff-index --quiet --cached HEAD \
131     || { echo "$@: you have uncommitted or unstaged changes" >&2; exit 1; }
132
133 determine_release_type = \
134   if $(match_version) '$(stable_major_version_rx)'; then \
135     release_type='Major release'; \
136     announcement_type='major release'; \
137     dest=ftp; \
138   elif $(match_version) '$(stable_minor_version_rx)'; then \
139     release_type='Minor release'; \
140     announcement_type='minor release'; \
141     dest=ftp; \
142   elif $(match_version) '$(stable_micro_version_rx)'; then \
143     release_type='Micro release'; \
144     announcement_type='maintenance release'; \
145     dest=ftp; \
146   elif $(match_version) '$(beta_version_rx)'; then \
147     release_type='Beta release'; \
148     announcement_type='test release'; \
149     dest=alpha; \
150   elif $(match_version) '$(alpha_version_rx)'; then \
151     echo "$@: improper version '$(VERSION)' for a release" >&2; \
152     if test -n '$(strip $(DEVEL_SNAPSHOT))'; then \
153       echo "$@: continuing anyway since DEVEL_SNAPSHOT is set" >&2; \
154       release_type='Development snapshot'; \
155       announcement_type='development snapshot'; \
156       dest=alpha; \
157     else \
158       exit 1; \
159     fi; \
160   else \
161     echo "$@: invalid version number '$(VERSION)'" >&2; \
162     exit 1; \
163   fi
164
165 # Help the debugging of $(determine_release_type) and related code.
166 print-release-type:
167         @$(determine_release_type); \
168          echo "$$release_type $(VERSION);" \
169               "it will be announced as a \"$$announcement_type\""
170
171 git-tag-release: maintainer-check
172         @set -e -u; \
173         case '$(AM_TAG_DRYRUN)' in \
174           ""|[nN]|[nN]o|NO) run="";; \
175           *) run="echo Running:";; \
176         esac; \
177         $(determine_release_type); \
178         $(git_must_have_clean_workdir); \
179         $$run $(GIT) tag -s "v$(VERSION)" -m "$$release_type $(VERSION)"
180
181 git-upload-release:
182         @# Check this is a version we can cut a release (either test
183         @# or stable) from.
184         @$(determine_release_type)
185         @# The repository must be clean.
186         @$(git_must_have_clean_workdir)
187         @# Check that we are releasing from a valid tag.
188         @tag=`$(GIT) describe` \
189           && case $$tag in "v$(VERSION)") true;; *) false;; esac \
190           || { echo "$@: you can only create a release from a tagged" \
191                     "version" >&2; \
192                exit 1; }
193         @# Build the distribution tarball(s).
194         $(MAKE) dist
195         @# Upload it to the correct FTP repository.
196         @$(determine_release_type) \
197           && dest=$$dest.gnu.org:automake \
198           && echo "Will upload to $$dest: $(DIST_ARCHIVES)" \
199           && $(srcdir)/lib/gnupload $(GNUPLOADFLAGS) --to $$dest \
200                                     $(DIST_ARCHIVES)
201
202 .PHONY: print-release-type git-upload-release git-tag-release
203
204
205 # ------------------------------------------------------------------ #
206 #  Explore differences of autogenerated files in different commits.  #
207 # ------------------------------------------------------------------ #
208
209 # Visually comparing differences between the Makefile.in files in
210 # automake's own build system as generated in two different branches
211 # might help to catch bugs and blunders.  This has already happened a
212 # few times in the past, when we used to version-control Makefile.in.
213 autodiffs:
214         @set -u; \
215          NEW_COMMIT=$${NEW_COMMIT-"HEAD"}; \
216          OLD_COMMIT=$${OLD_COMMIT-"HEAD~1"}; \
217          am_gitdir='$(abs_top_srcdir)/.git'; \
218          get_autofiles_from_rev () \
219          { \
220              rev=$$1 dir=$$2 \
221                && echo "$@: will get files from revision $$rev" \
222                && $(GIT) clone -q --depth 1 "$$am_gitdir" tmp \
223                && cd tmp \
224                && $(GIT) checkout -q "$$rev" \
225                && echo "$@: bootstrapping $$rev" \
226                && $(SHELL) ./bootstrap.sh \
227                && echo "$@: copying files from $$rev" \
228                && makefile_ins=`find . -name Makefile.in` \
229                && (tar cf - configure aclocal.m4 $$makefile_ins) | \
230                   (cd .. && cd "$$dir" && tar xf -) \
231                && cd .. \
232                && rm -rf tmp; \
233          }; \
234          outdir=$@.dir \
235            && : Before proceeding, ensure the specified revisions truly exist. \
236            && $(GIT) --git-dir="$$am_gitdir" describe $$OLD_COMMIT >/dev/null \
237            && $(GIT) --git-dir="$$am_gitdir" describe $$NEW_COMMIT >/dev/null \
238            && rm -rf $$outdir \
239            && mkdir $$outdir \
240            && cd $$outdir \
241            && mkdir new old \
242            && get_autofiles_from_rev $$OLD_COMMIT old \
243            && get_autofiles_from_rev $$NEW_COMMIT new \
244            && exit 0
245
246 # With lots of eye candy; we like our developers pampered and spoiled :-)
247 compare-autodiffs: autodiffs
248         @set -u; \
249         : $${COLORDIFF=colordiff} $${DIFF=diff}; \
250         dir=autodiffs.dir; \
251         if test ! -d "$$dir"; then \
252           echo "$@: $$dir: Not a directory" >&2; \
253           exit 1; \
254         fi; \
255         mydiff=false mypager=false; \
256         if test -t 1; then \
257           if ($$COLORDIFF -r . .) </dev/null >/dev/null 2>&1; then \
258             mydiff=$$COLORDIFF; \
259             mypager="less -R"; \
260           else \
261             mypager=less; \
262           fi; \
263         else \
264           mypager=cat; \
265         fi; \
266         if test "$$mydiff" = false; then \
267           if ($$DIFF -r -u . .); then \
268             mydiff=$$DIFF; \
269           else \
270             echo "$@: no good-enough diff program specified" >&2; \
271             exit 1; \
272           fi; \
273         fi; \
274         st=0; $$mydiff -r -u $$dir/old $$dir/new | $$mypager || st=$$?; \
275         rm -rf $$dir; \
276         exit $$st
277 .PHONY: autodiffs compare-autodiffs
278
279 # ---------------------------------------------- #
280 #  Help writing the announcement for a release.  #
281 # ---------------------------------------------- #
282
283 PACKAGE_MAILINGLIST = automake@gnu.org
284
285 announcement: DEVEL_SNAPSHOT = yes
286 announcement: NEWS
287         $(AM_V_GEN): \
288           && rm -f $@ $@-t \
289           && $(determine_release_type) \
290           && ftp_base="ftp://$$dest.gnu.org/gnu/$(PACKAGE)" \
291           && X () { printf '%s\n' "$$*" >> $@-t; } \
292           && X "We are pleased to announce the $(PACKAGE_NAME) $(VERSION)" \
293                "$$announcement_type." \
294           && X \
295           && X "**TODO** Brief description of the release here." \
296           && X \
297           && X "**TODO** This description can span multiple paragraphs." \
298           && X \
299           && X "See below for the detailed list of changes since the" \
300           && X "previous version, as summarized by the NEWS file." \
301           && X \
302           && X "Download here:" \
303           && X \
304           && X "  $$ftp_base/$(PACKAGE)-$(VERSION).tar.gz" \
305           && X "  $$ftp_base/$(PACKAGE)-$(VERSION).tar.xz" \
306           && X \
307           && X "Please report bugs and problems to" \
308                "<$(PACKAGE_BUGREPORT)>," \
309           && X "and send general comments and feedback to" \
310                "<$(PACKAGE_MAILINGLIST)>." \
311           && X \
312           && X "Thanks to everyone who has reported problems, contributed" \
313           && X "patches, and helped testing Automake!" \
314           && X \
315           && X "-*-*-*-" \
316           && X \
317           && $(AWK) '\
318                 ($$0 ~ /^New in .*:/) { wait_for_end=1; } \
319                 (/^~~~/ && wait_for_end) { print; exit(0) } \
320                 { print } \
321              ' <$(srcdir)/NEWS >> $@-t \
322           && mv -f $@-t $@
323 .PHONY: announcement
324 CLEANFILES += announcement
325
326 # --------------------------------------------------------------------- #
327 #  Synchronize third-party files that are committed in our repository.  #
328 # --------------------------------------------------------------------- #
329
330 # Git repositories on Savannah.
331 git-sv-host = git.savannah.gnu.org
332
333 # Some repositories we sync files from.
334 SV_CVS    = 'http://savannah.gnu.org/cgi-bin/viewcvs/~checkout~/'
335 SV_GIT_CF = 'http://$(git-sv-host)/gitweb/?p=config.git;a=blob_plain;hb=HEAD;f='
336 SV_GIT_AC = 'http://$(git-sv-host)/gitweb/?p=autoconf.git;a=blob_plain;hb=HEAD;f='
337 SV_GIT_GL = 'http://$(git-sv-host)/gitweb/?p=gnulib.git;a=blob_plain;hb=HEAD;f='
338
339 # Files that we fetch and which we compare against.
340 # Note that the 'lib/COPYING' file must still be synced by hand.
341 FETCHFILES = \
342   $(SV_GIT_CF)config.guess \
343   $(SV_GIT_CF)config.sub \
344   $(SV_CVS)texinfo/texinfo/doc/texinfo.tex \
345   $(SV_CVS)texinfo/texinfo/util/gendocs.sh \
346   $(SV_CVS)texinfo/texinfo/util/gendocs_template \
347   $(SV_GIT_GL)build-aux/gitlog-to-changelog \
348   $(SV_GIT_GL)build-aux/gnupload \
349   $(SV_GIT_GL)build-aux/update-copyright \
350   $(SV_GIT_GL)doc/INSTALL
351
352 # Fetch the latest versions of few scripts and files we care about.
353 # A retrieval failure or a copying failure usually mean serious problems,
354 # so we'll just bail out if 'wget' or 'cp' fail.
355 fetch:
356         $(AM_V_at)rm -rf Fetchdir
357         $(AM_V_at)mkdir Fetchdir
358         $(AM_V_GEN)set -e; \
359         if $(AM_V_P); then wget_opts=; else wget_opts=-nv; fi; \
360         for url in $(FETCHFILES); do \
361            file=`printf '%s\n' "$$url" | sed 's|^.*/||; s|^.*=||'`; \
362            $(WGET) $$wget_opts "$$url" -O Fetchdir/$$file || exit 1; \
363            if cmp Fetchdir/$$file $(srcdir)/lib/$$file >/dev/null; then \
364              : Nothing to do; \
365            else \
366              echo "$@: updating file $$file"; \
367              cp Fetchdir/$$file $(srcdir)/lib/$$file || exit 1; \
368            fi; \
369         done
370         $(AM_V_at)rm -rf Fetchdir
371 .PHONY: fetch
372
373 # ---------------------------------------------------------------------- #
374 #  Generate and upload manuals in several formats, for the GNU website.  #
375 # ---------------------------------------------------------------------- #
376
377 web_manual_dir = doc/web-manual
378
379 RSYNC = rsync
380 CVS = cvs
381 CVSU = cvsu
382 CVS_USER = $${USER}
383 WEBCVS_ROOT = cvs.savannah.gnu.org:/web
384 CVS_RSH = ssh
385 export CVS_RSH
386
387 .PHONY: web-manual web-manual-update
388 web-manual web-manual-update: t = $@.dir
389
390 # Build manual in several formats.  Note to the recipe:
391 # 1. The symlinking of automake.texi into the temporary directory is
392 #    required to pacify extra checks from gendocs.sh.
393 # 2. The redirection to /dev/null before the invocation of gendocs.sh
394 #    is done to better respect silent rules.
395 web-manual:
396         $(AM_V_at)rm -rf $(web_manual_dir) $t
397         $(AM_V_at)mkdir $t
398         $(AM_V_at)$(LN_S) '$(abs_srcdir)/doc/$(PACKAGE).texi' '$t/'
399         $(AM_V_GEN)cd $t \
400           && GENDOCS_TEMPLATE_DIR='$(abs_srcdir)/lib' \
401           && export GENDOCS_TEMPLATE_DIR \
402           && if $(AM_V_P); then :; else exec >/dev/null 2>&1; fi \
403           && $(SHELL) '$(abs_srcdir)/lib/gendocs.sh' \
404              -I '$(abs_srcdir)/doc' --email $(PACKAGE_BUGREPORT) \
405              $(PACKAGE) '$(PACKAGE_NAME)'
406         $(AM_V_at)mkdir $(web_manual_dir)
407         $(AM_V_at)mv -f $t/manual/* $(web_manual_dir)
408         $(AM_V_at)rm -rf $t
409         @! $(AM_V_P) || ls -l $(web_manual_dir)
410
411 # Upload manual to www.gnu.org, using CVS (sigh!)
412 web-manual-update:
413         $(AM_V_at)$(determine_release_type); \
414         case $$release_type in \
415           [Mm]ajor\ release|[Mm]inor\ release|[Mm]icro\ release);; \
416           *) echo "Cannot upload manuals from a \"$$release_type\"" >&2; \
417              exit 1;; \
418         esac
419         $(AM_V_at)test -f $(web_manual_dir)/$(PACKAGE).html || { \
420           echo 'You have to run "$(MAKE) web-manuals" before' \
421                'invoking "$(MAKE) $@"' >&2; \
422           exit 1; \
423         }
424         $(AM_V_at)rm -rf $t
425         $(AM_V_at)mkdir $t
426         $(AM_V_at)cd $t \
427           && $(CVS) -z3 -d :ext:$(CVS_USER)@$(WEBCVS_ROOT)/$(PACKAGE) \
428                     co $(PACKAGE)
429         @# According to the rsync manpage, "a trailing slash on the
430         @# source [...] avoids creating an additional directory
431         @# level at the destination".  So the trailing '/' after
432         @# '$(web_manual_dir)' below is intended.
433         $(AM_V_at)$(RSYNC) -avP $(web_manual_dir)/ $t/$(PACKAGE)/manual
434         $(AM_V_GEN): \
435           && cd $t/$(PACKAGE)/manual \
436           && new_files=`$(CVSU) --types='?'` \
437           && new_files=`echo "$$new_files" | sed s/^..//` \
438           && { test -z "$$new_files" || $(CVS) add -ko $$new_files; } \
439           && $(CVS) ci -m $(VERSION)
440         $(AM_V_at)rm -rf $t
441 .PHONY: web-manual-update
442
443 clean-web-manual:
444         $(AM_V_at)rm -rf $(web_manual_dir)
445 .PHONY: clean-web-manual
446 clean-local: clean-web-manual
447
448 EXTRA_DIST += lib/gendocs.sh lib/gendocs_template
449
450 # ------------------------------------------------ #
451 #  Update copyright years of all committed files.  #
452 # ------------------------------------------------ #
453
454 EXTRA_DIST += lib/update-copyright
455
456 update_copyright_env = \
457   UPDATE_COPYRIGHT_FORCE=1 \
458   UPDATE_COPYRIGHT_USE_INTERVALS=2
459
460 # In addition to the several README files, these as well are
461 # not expected to have a copyright notice.
462 files_without_copyright = \
463   .autom4te.cfg \
464   .git-log-fix \
465   .gitattributes \
466   .gitignore \
467   INSTALL \
468   COPYING \
469   AUTHORS \
470   THANKS \
471   lib/INSTALL \
472   lib/COPYING
473
474 # This script is in the public domain.
475 files_without_copyright += lib/mkinstalldirs
476
477 # This script has an MIT-style license
478 files_without_copyright += lib/install-sh
479
480 .PHONY: update-copyright
481 update-copyright:
482         $(AM_V_GEN)set -e; \
483         current_year=`date +%Y` && test -n "$$current_year" \
484           || { echo "$@: cannot get current year" >&2; exit 1; }; \
485         sed -i "/^RELEASE_YEAR=/s/=.*$$/=$$current_year/" \
486           bootstrap.sh configure.ac; \
487         excluded_re=`( \
488           for url in $(FETCHFILES); do echo "$$url"; done \
489             | sed -e 's!^.*/!!' -e 's!^.*=!!' -e 's!^!lib/!' \
490           && for f in $(files_without_copyright); do echo $$f; done \
491         ) | sed -e '$$!s,$$,|,' | tr -d '\012\015'`; \
492         $(GIT) ls-files \
493           | grep -Ev '(^|/)README$$' \
494           | grep -Ev "^($$excluded_re)$$" \
495           | $(update_copyright_env) xargs $(srcdir)/lib/$@
496
497 # -------------------------------------------------------------- #
498 #  Run the testsuite with the least supported autoconf version.  #
499 # -------------------------------------------------------------- #
500
501 gnu-ftp = http://ftp.gnu.org/gnu
502
503 # Various shorthands: version, name, package name, tarball name,
504 # tarball location, installation directory.
505 ac-v = $(required_autoconf_version)
506 ac-n = autoconf
507 ac-p = $(ac-n)-$(ac-v)
508 ac-t = $(ac-p).tar.gz
509 ac-l = maintainer/$(ac-t)
510 ac-d = maintainer/$(ac-p)
511
512 fetch-minimal-autoconf: o = $(ac-l)
513 fetch-minimal-autoconf:
514         $(AM_V_at)$(MKDIR_P) $(dir $o)
515         $(AM_V_at)rm -f $o $o-t
516         $(AM_V_GEN)$(WGET) -O $o-t $(gnu-ftp)/$(ac-n)/$(ac-t)
517         $(AM_V_at)chmod a-w $o-t && mv -f $o-t $o && ls -l $o
518 .PHONY: fetch-minimal-autoconf
519
520 build-minimal-autoconf:
521         $(AM_V_GEN):; \
522         test -f $(ac-l) || { \
523           echo "$@: tarball $(ac-l) seems missing." >&2; \
524           echo "$@: have you run '$(MAKE) fetch-minimal-autoconf'?" >&2; \
525           exit 1; \
526         }; \
527           set -x \
528           && $(PERL) $(srcdir)/t/ax/deltree.pl $(ac-d) \
529           && $(MKDIR_P) $(ac-d) \
530           && cd $(ac-d) \
531           && tar xzf '$(CURDIR)/$(ac-l)' \
532           && mv $(ac-p) src \
533           && mkdir build \
534           && cd build \
535           && env CONFIG_SHELL='$(SHELL)' $(SHELL) ../src/configure \
536                --prefix='$(CURDIR)/$(ac-d)' CONFIG_SHELL='$(SHELL)' \
537           && $(MAKE) install
538         $(AM_V_at)echo ' ======' && $(ac-d)/bin/autoconf --version
539 .PHONY: build-minimal-autoconf
540
541 check-minimal-autoconf:
542         $(AM_V_at)p='$(ac-d)/bin/autoconf'; \
543           if test ! -f "$$p" || test ! -x "$$p"; then \
544             echo "$@: program '$$p' seems missing." >&2; \
545             echo "$@: have you run '$(MAKE) build-minimal-autoconf'?" >&2; \
546             exit 1; \
547           fi
548         $(AM_V_GEN): \
549           && PATH='$(CURDIR)/$(ac-d)/bin$(PATH_SEPARATOR)'$$PATH \
550           && export PATH \
551           && AUTOCONF=autoconf \
552           && AUTOHEADER=autoheader \
553           && AUTORECONF=autoreconf \
554           && AUTOM4TE=autom4te \
555           && AUTOUPDATE=autoupdate \
556           && export AUTOCONF AUTOHEADER AUTORECONF AUTOM4TE AUTOUPDATE \
557           && echo === check autoconf version '(must be = $(ac-v))' \
558           && autoconf --version \
559           && autoconf --version | sed -e 's/^/ /; s/$$/ /' -e 1q \
560                | $(FGREP) '$(ac-v)' >/dev/null \
561           && echo === configure \
562           && ./configure $(shell ./config.status --config) \
563           && echo === build and test \
564           && $(MAKE) check
565 .PHONY: check-minimal-autoconf
566
567
568 # --------------------------------------------------------------- #
569 #  Testing on real-world packages can help us avoid regressions.  #
570 # --------------------------------------------------------------- #
571
572 #
573 # NOTE (from Stefano Lattarini):
574 #
575 # This section is mostly hacky and ad-hoc, but works for me and
576 # on my system.  And while far from clean, it should help catching
577 # real regressions on real world packages, which is important.
578 # Ideas about how to improve this and make it more generic, portable,
579 # clean, etc., are welcome.
580 #
581
582 # Tiny sample package.
583 FEW_PACKAGES += hello
584 # Smallish package using recursive make setup.
585 FEW_PACKAGES += make
586 # Medium-size package using non-recursive make setup.
587 FEW_PACKAGES += coreutils
588
589 ALL_PACKAGES = \
590   $(FEW_PACKAGES) \
591   autoconf \
592   bison \
593   grep \
594   tar \
595   diffutils \
596   smalltalk
597
598 pkg-targets = check dist
599
600 # Note: "ttp" stays for "Third Party Package".
601
602 ttp-check ttp-check-all: do-clone = $(GIT) clone --verbose
603 ttp-check: ttp-packages = $(FEW_PACKAGES)
604 ttp-check-all: ttp-packages = $(ALL_PACKAGES)
605
606 # Note: some packages depend on pkg-config, and its provided macros.
607 ttp-check ttp-check-all: t/pkg-config-macros.log
608         @set -e; \
609         $(setup_autotools_paths); \
610         skip_all_ () \
611         { \
612           echo "***" >&2; \
613           echo "*** $@: WARNING: $$@" >&2; \
614           echo "*** $@: WARNING: some packages might fail to bootstrap" >&2; \
615           echo "***" >&2;  \
616         }; \
617         . t/pkg-config-macros.dir/get.sh || exit 1; \
618         mkdir $@.d && cd $@.d || exit 1; \
619         for p in $(ttp-packages); do \
620             echo; \
621             echo ========  BEGIN TTP $$p  =========; \
622             echo; \
623             set -x; \
624             $(do-clone) git://$(git-sv-host)/$$p.git || exit 1; \
625             ( \
626               cd $$p \
627                 && ls -l \
628                 && if test -f bootstrap; then \
629                      ./bootstrap --no-git; \
630                    else \
631                      $$AUTORECONF -fvi; \
632                    fi \
633                 && ./configure \
634                 && if test $$p = make; then \
635                      $(MAKE) update; \
636                    else :; fi \
637                 && for t in $(pkg-targets); do \
638                      $(MAKE) $$t WERROR_CFLAGS= || exit 1; \
639                    done \
640             ) || exit 1; \
641             set +x; \
642             echo; \
643             echo ========  END TTP $$p  =========; \
644             echo; \
645          done
646 ifndef keep-ttp-dir
647         rm -rf $@.d
648 endif
649
650 # Alias for lazy typists.
651 ttp: ttp-check
652 ttp-all: ttp-check-all
653
654 .PHONY: ttp ttp-check ttp-all ttp-check-all