* dist.am: Remove, merge into...
authorAkim Demaille <akim@epita.fr>
Wed, 21 Feb 2001 08:26:34 +0000 (08:26 +0000)
committerAkim Demaille <akim@epita.fr>
Wed, 21 Feb 2001 08:26:34 +0000 (08:26 +0000)
* distdir.am: here.  Use the neat sed snippet for banners.
BTW, distcheck is phony.
* automake.in (&handle_dist_worker): Remove, merge into...
(&handle_dist): this.
(&file_contents): Strip leading new lines.
Be sure to end comments with new lines.

ChangeLog
Makefile.am
Makefile.in
automake.in
dist.am
distdir.am
lib/am/Makefile.am
lib/am/distdir.am

index 5e47fd4..87373cd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2001-02-21  Akim Demaille  <akim@epita.fr>
 
+       * dist.am: Remove, merge into...
+       * distdir.am: here.  Use the neat sed snippet for banners.
+       BTW, distcheck is phony.
+       * automake.in (&handle_dist_worker): Remove, merge into...
+       (&handle_dist): this.
+       (&file_contents): Strip leading new lines.
+       Be sure to end comments with new lines.
+
+2001-02-21  Akim Demaille  <akim@epita.fr>
+
        * distdir.am (GZIP_ENV): Define.
        * automake.in (&handle_dist): Don't.
        (&uniq): New.
index 520331a..669f7b3 100644 (file)
@@ -12,7 +12,7 @@ info_TEXINFOS = automake.texi
 
 amfiles = check.am clean-hdr.am clean-kr.am clean.am comp-vars.am \
 compile.am data-clean.am data.am dejagnu.am depend.am depend2.am \
-dist.am distdir.am dist-vars.am footer.am header-vars.am header.am \
+distdir.am dist-vars.am footer.am header-vars.am header.am \
 java-clean.am java.am kr-extra.am library.am libs-clean.am libs.am \
 libtool.am lisp-clean.am lisp.am ltlib-clean.am ltlib.am ltlibrary.am \
 mans-vars.am mans.am multilib.am program.am progs-clean.am progs.am \
index 9177a54..ab09d4a 100644 (file)
@@ -86,7 +86,7 @@ info_TEXINFOS = automake.texi
 
 amfiles = check.am clean-hdr.am clean-kr.am clean.am comp-vars.am \
 compile.am data-clean.am data.am dejagnu.am depend.am depend2.am \
-dist.am distdir.am dist-vars.am footer.am header-vars.am header.am \
+distdir.am dist-vars.am footer.am header-vars.am header.am \
 java-clean.am java.am kr-extra.am library.am libs-clean.am libs.am \
 libtool.am lisp-clean.am lisp.am ltlib-clean.am ltlib.am ltlibrary.am \
 mans-vars.am mans.am multilib.am program.am progs-clean.am progs.am \
@@ -455,37 +455,6 @@ distdir = $(PACKAGE)-$(VERSION)
 top_distdir = $(distdir)
 
 
-# This target untars the dist file and tries a VPATH configuration.  Then
-# it guarantees that the distribution is self-contained by making another
-# tarfile.
-distcheck: dist
-       -chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir)
-       GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf -
-       chmod -R a-w $(distdir); chmod a+w $(distdir)
-       mkdir $(distdir)/=build
-       mkdir $(distdir)/=inst
-       chmod a-w $(distdir)
-       dc_install_base=`CDPATH=: && cd $(distdir)/=inst && pwd` \
-         && cd $(distdir)/=build \
-         && ../configure --srcdir=.. --prefix=$$dc_install_base \
-         && $(MAKE) $(AM_MAKEFLAGS) \
-         && $(MAKE) $(AM_MAKEFLAGS) dvi \
-         && $(MAKE) $(AM_MAKEFLAGS) check \
-         && $(MAKE) $(AM_MAKEFLAGS) install \
-         && $(MAKE) $(AM_MAKEFLAGS) installcheck \
-         && $(MAKE) $(AM_MAKEFLAGS) uninstall \
-         && test `find $$dc_install_base -type f -print | wc -l` -le 1 \
-         && $(MAKE) $(AM_MAKEFLAGS) dist \
-         && $(MAKE) $(AM_MAKEFLAGS) distclean \
-         && rm -f $(distdir).tar.gz \
-         && test `find . -type f -print | wc -l` -eq 0
-       -chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir)
-       @banner="$(distdir).tar.gz is ready for distribution"; \
-       dashes=`echo "$$banner" | sed s/./=/g`; \
-       echo "$$dashes"; \
-       echo "$$banner"; \
-       echo "$$dashes"
-
 GZIP_ENV = --best
 
 distdir: $(DISTFILES)
@@ -528,6 +497,33 @@ distdir: $(DISTFILES)
 dist: distdir
        $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
        -chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir)
+# This target untars the dist file and tries a VPATH configuration.  Then
+# it guarantees that the distribution is self-contained by making another
+# tarfile.
+distcheck: dist
+       -chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir)
+       GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf -
+       chmod -R a-w $(distdir); chmod a+w $(distdir)
+       mkdir $(distdir)/=build
+       mkdir $(distdir)/=inst
+       chmod a-w $(distdir)
+       dc_install_base=`CDPATH=: && cd $(distdir)/=inst && pwd` \
+         && cd $(distdir)/=build \
+         && ../configure --srcdir=.. --prefix=$$dc_install_base \
+         && $(MAKE) $(AM_MAKEFLAGS) \
+         && $(MAKE) $(AM_MAKEFLAGS) dvi \
+         && $(MAKE) $(AM_MAKEFLAGS) check \
+         && $(MAKE) $(AM_MAKEFLAGS) install \
+         && $(MAKE) $(AM_MAKEFLAGS) installcheck \
+         && $(MAKE) $(AM_MAKEFLAGS) uninstall \
+         && test `find $$dc_install_base -type f -print | wc -l` -le 1 \
+         && $(MAKE) $(AM_MAKEFLAGS) dist \
+         && $(MAKE) $(AM_MAKEFLAGS) distclean \
+         && rm -f $(distdir).tar.gz \
+         && test `find . -type f -print | wc -l` -eq 0
+       -chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir)
+       @echo "$(distdir).tar.gz is ready for distribution" | \
+         sed 'h;s/./=/g;p;x;p;x'
 info-am: $(INFO_DEPS)
 info: info-recursive
 dvi-am: $(DVIS)
@@ -595,7 +591,7 @@ mostlyclean: mostlyclean-recursive
 mostlyclean-am: mostlyclean-aminfo mostlyclean-generic mostlyclean-vti
 
 .PHONY: all all-am all-recursive check check-am check-recursive clean \
-       clean-generic clean-recursive dist dist-all distclean \
+       clean-generic clean-recursive dist dist-all distcheck distclean \
        distclean-generic distclean-recursive distclean-tags distdir \
        dvi dvi-am dvi-recursive info info-am info-recursive install \
        install-am install-binSCRIPTS install-data install-data-am \
index 5d4320e..a17b4c0 100755 (executable)
@@ -2589,97 +2589,6 @@ sub handle_dist_worker
 {
     my ($makefile) = @_;
 
-    # Initialization; only at top level.
-    my $xform = &transform_cond ('TOPDIR'  => ($relative_dir eq '.'));
-
-    # Scan EXTRA_DIST to see if we need to distribute anything from a
-    # subdir.  If so, add it to the list.  I didn't want to do this
-    # originally, but there were so many requests that I finally
-    # relented.
-    if (&variable_defined ('EXTRA_DIST'))
-    {
-       # FIXME: This should be fixed to work with conditionals.  That
-       # will require only making the entries in @dist_dirs under the
-       # appropriate condition.  This is meaningful if the nature of
-       # the distribution should depend upon the configure options
-       # used.
-       foreach (&variable_value_as_list ('EXTRA_DIST', ''))
-       {
-           next if /^\@.*\@$/;
-           next unless s,/+[^/]+$,,;
-           $dist_dirs{$_} = 1
-               unless $_ eq '.';
-       }
-    }
-
-    # We have to check DIST_COMMON for extra directories in case the
-    # user put a source used in AC_OUTPUT into a subdir.
-    foreach (&variable_value_as_list ('DIST_COMMON', 'all'))
-    {
-       next if /^\@.*\@$/;
-       next unless s,/+[^/]+$,,;
-       $dist_dirs{$_} = 1
-           unless $_ eq '.';
-    }
-
-    if (scalar keys %dist_dirs)
-    {
-       # Prepend $(distdir) to each directory given.  Doing it via a
-       # hash lets us ensure that each directory is used only once.
-       grep ($dist_dirs{'$(distdir)/' . $_} = 1, keys %dist_dirs);
-       $xform .= &transform ('DISTDIRS', join (' ', sort keys %dist_dirs));
-    }
-    else
-    {
-        $xform .= 's/.*\@DISTDIRS\@.*//g;';
-    }
-
-    # If we have SUBDIRS, create all dist subdirectories and do
-    # recursive build.
-    if (&variable_defined ('SUBDIRS'))
-    {
-       # If SUBDIRS is conditionally defined, then set DIST_SUBDIRS
-       # to all possible directories, and use it.  If DIST_SUBDIRS is
-       # defined, just use it.
-       local ($dist_subdir_name);
-       if (&variable_conditions ('SUBDIRS')
-           || &variable_defined ('DIST_SUBDIRS'))
-       {
-           $dist_subdir_name = 'DIST_SUBDIRS';
-           if (! &variable_defined ('DIST_SUBDIRS'))
-           {
-               &define_pretty_variable
-                 ('DIST_SUBDIRS', '',
-                  uniq (&variable_value_as_list ('SUBDIRS', 'all')));
-           }
-       }
-       else
-       {
-           $dist_subdir_name = 'SUBDIRS';
-           # We always define this because that is what `distclean'
-           # wants.
-           &define_pretty_variable ('DIST_SUBDIRS', '', '$(SUBDIRS)');
-       }
-
-       my $top_distdir = ($relative_dir eq '.') ? 'distdir' : 'top_distdir';
-       $xform .= &transform ('DIST_SUBDIR_NAME' => $dist_subdir_name,
-                             'TOP_DISTDIR'      => $top_distdir);
-    }
-
-    # If the target `dist-hook' exists, make sure it is run.  This
-    # allows users to do random weird things to the distribution
-    # before it is packaged up.
-    push (@dist_targets, 'dist-hook')
-      if &target_defined ('dist-hook');
-
-    $output_rules .=
-      &file_contents ('distdir',
-                     $xform
-                     . &transform ('DIST-TARGETS' => join " ", @dist_targets)
-                     . &transform_cond ('DIST-TARGETS' =>
-                                           scalar @dist_targets,
-                                        'SUBDIRS'  =>
-                                           &variable_defined ('SUBDIRS')));
 }
 
 # Handle 'dist' target.
@@ -2786,20 +2695,100 @@ sub handle_dist
     }
     $output_rules .= "\n";
 
-    # Generate 'dist' target, and maybe other dist targets.
-    if ($relative_dir eq '.')
+    # Scan EXTRA_DIST to see if we need to distribute anything from a
+    # subdir.  If so, add it to the list.  I didn't want to do this
+    # originally, but there were so many requests that I finally
+    # relented.
+    if (&variable_defined ('EXTRA_DIST'))
     {
-       # Rule to check whether a distribution is viable.
-       my ($xform) =
-         &transform_cond ('DISTHOOK' => &target_defined ('distcheck-hook'),
-                          'GETTEXT'  => $seen_gettext);
+       # FIXME: This should be fixed to work with conditionals.  That
+       # will require only making the entries in @dist_dirs under the
+       # appropriate condition.  This is meaningful if the nature of
+       # the distribution should depend upon the configure options
+       # used.
+       foreach (&variable_value_as_list ('EXTRA_DIST', ''))
+       {
+           next if /^\@.*\@$/;
+           next unless s,/+[^/]+$,,;
+           $dist_dirs{$_} = 1
+               unless $_ eq '.';
+       }
+    }
 
-       # Arg, this file should have been named `distcheck'.
-       $output_rules .= &file_contents ('dist', $xform);
+    # We have to check DIST_COMMON for extra directories in case the
+    # user put a source used in AC_OUTPUT into a subdir.
+    foreach (&variable_value_as_list ('DIST_COMMON', 'all'))
+    {
+       next if /^\@.*\@$/;
+       next unless s,/+[^/]+$,,;
+       $dist_dirs{$_} = 1
+           unless $_ eq '.';
+    }
+
+    # Rule to check whether a distribution is viable.
+    my $xform =
+      &transform_cond ('TOPDIR'         => ($relative_dir eq '.'),
+                      'DISTCHECK-HOOK' => &target_defined ('distcheck-hook'),
+                      'GETTEXT'        => $seen_gettext);
+
+    if (scalar keys %dist_dirs)
+    {
+       # Prepend $(distdir) to each directory given.  Doing it via a
+       # hash lets us ensure that each directory is used only once.
+       grep ($dist_dirs{'$(distdir)/' . $_} = 1, keys %dist_dirs);
+       $xform .= &transform ('DISTDIRS', join (' ', sort keys %dist_dirs));
+    }
+    else
+    {
+        $xform .= 's/.*\@DISTDIRS\@.*//g;';
     }
 
-    # Generate distdir target.
-    &handle_dist_worker ($makefile);
+    # If we have SUBDIRS, create all dist subdirectories and do
+    # recursive build.
+    if (&variable_defined ('SUBDIRS'))
+    {
+       # If SUBDIRS is conditionally defined, then set DIST_SUBDIRS
+       # to all possible directories, and use it.  If DIST_SUBDIRS is
+       # defined, just use it.
+       local ($dist_subdir_name);
+       if (&variable_conditions ('SUBDIRS')
+           || &variable_defined ('DIST_SUBDIRS'))
+       {
+           $dist_subdir_name = 'DIST_SUBDIRS';
+           if (! &variable_defined ('DIST_SUBDIRS'))
+           {
+               &define_pretty_variable
+                 ('DIST_SUBDIRS', '',
+                  uniq (&variable_value_as_list ('SUBDIRS', 'all')));
+           }
+       }
+       else
+       {
+           $dist_subdir_name = 'SUBDIRS';
+           # We always define this because that is what `distclean'
+           # wants.
+           &define_pretty_variable ('DIST_SUBDIRS', '', '$(SUBDIRS)');
+       }
+
+       my $top_distdir = ($relative_dir eq '.') ? 'distdir' : 'top_distdir';
+       $xform .= &transform ('DIST_SUBDIR_NAME' => $dist_subdir_name,
+                             'TOP_DISTDIR'      => $top_distdir);
+    }
+
+    # If the target `dist-hook' exists, make sure it is run.  This
+    # allows users to do random weird things to the distribution
+    # before it is packaged up.
+    push (@dist_targets, 'dist-hook')
+      if &target_defined ('dist-hook');
+
+    $output_rules .=
+      &file_contents ('distdir',
+                     $xform
+                     . &transform ('DIST-TARGETS' => join " ", @dist_targets)
+                     . &transform_cond ('DIST-TARGETS' =>
+                                           scalar @dist_targets,
+                                        'SUBDIRS'  =>
+                                           &variable_defined ('SUBDIRS')));
 }
 
 
@@ -6902,11 +6891,17 @@ sub file_contents
     # perl goes loopy if you try to
     #
     #  $result_rules =~ /^($TARGET_PATTERN *)+: ($TARGET_PATTERN *)+\n\n/sm
-    local ($result_vars) = '';
-    local ($result_rules) = '';
-    local ($comment) = '';
+    my $result_vars = '';
+    my $result_rules = '';
+    my $comment = '';
     foreach (split (/(?<!\\)\n(?![\t#])/, $contents))
     {
+        # Strip leading new lines.  This can happen for comments:
+        # the pattern above allows `\n\n# comment' to yield
+        # `\n# comment'.
+        s/^\n+//;
+
+        # Sanity checks.
        &am_file_error ("$basename.am",
                        "blank line following trailing backslash:\n$_")
          if /\\$/;
@@ -6922,7 +6917,7 @@ sub file_contents
        elsif (/$COMMENT_PATTERN/mso)
        {
            # Stick comments before the incoming macro or rule.
-           $comment = $_;
+           $comment = "$_\n";
        }
        elsif (/$RULE_PATTERN/mso)
        {
@@ -6957,7 +6952,7 @@ sub file_contents
                    {
                      # Some hair to avoid spurious trailing blank
                      # when there are no dependencies.
-                     $result_rules .= "$comment$separator";
+                     $result_rules .= "$separator$comment";
                      $result_rules .= "$targets:";
                      $result_rules .= " $dependencies"
                        if $dependencies;
@@ -6975,7 +6970,7 @@ sub file_contents
        }
        elsif (/$MACRO_PATTERN/mso)
        {
-           $result_vars .= "$comment$separator$_\n"
+           $result_vars .= "$separator$comment$_\n"
              unless defined $contents{$1};
            $comment = $separator = '';
            &prog_error (".am macro \`$1' with trailing backslash at $file:$.")
@@ -6986,7 +6981,7 @@ sub file_contents
        {
            # This isn't an error; it is probably some tokens which
            # configure is supposed to replace, such as `@SET-MAKE@'.
-           $result_rules .= "$comment$separator$_\n";
+           $result_rules .= "$separator$comment$_\n";
            $comment = $separator = '';
        }
     }
diff --git a/dist.am b/dist.am
index 83b14db..e69de29 100644 (file)
--- a/dist.am
+++ b/dist.am
@@ -1,58 +0,0 @@
-## automake - create Makefile.in from Makefile.am
-## Copyright 1994, 1995, 1996, 1999, 2001 Free Software Foundation, Inc.
-
-## This program is free software; you can redistribute it and/or modify
-## it under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 2, or (at your option)
-## any later version.
-
-## This program is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-## GNU General Public License for more details.
-
-## You should have received a copy of the GNU General Public License
-## along with this program; if not, write to the Free Software
-## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-## 02111-1307, USA.
-
-# This target untars the dist file and tries a VPATH configuration.  Then
-# it guarantees that the distribution is self-contained by making another
-# tarfile.
-distcheck: dist
-## Make sure we can remove distdir before trying to remove it.
-       -chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir)
-       GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf -
-## Make the new source tree read-only.  Distributions ought to work in
-## this case.  However, make the top-level directory writable so we
-## can make our new subdirs.
-       chmod -R a-w $(distdir); chmod a+w $(distdir)
-       mkdir $(distdir)/=build
-       mkdir $(distdir)/=inst
-## Undo the write access.
-       chmod a-w $(distdir)
-       dc_install_base=`CDPATH=: && cd $(distdir)/=inst && pwd` \
-?DISTHOOK?       && $(MAKE) $(AM_MAKEFLAGS) distcheck-hook \
-         && cd $(distdir)/=build \
-         && ../configure --srcdir=.. --prefix=$$dc_install_base \
-?GETTEXT?          --with-included-gettext \
-         && $(MAKE) $(AM_MAKEFLAGS) \
-         && $(MAKE) $(AM_MAKEFLAGS) dvi \
-         && $(MAKE) $(AM_MAKEFLAGS) check \
-         && $(MAKE) $(AM_MAKEFLAGS) install \
-         && $(MAKE) $(AM_MAKEFLAGS) installcheck \
-         && $(MAKE) $(AM_MAKEFLAGS) uninstall \
-## We use -le 1 because the `dir' file might still exist after uninstall.
-         && test `find $$dc_install_base -type f -print | wc -l` -le 1 \
-         && $(MAKE) $(AM_MAKEFLAGS) dist \
-         && $(MAKE) $(AM_MAKEFLAGS) distclean \
-## Make sure to remove the dist file we created in the test build
-## directory.
-         && rm -f $(distdir).tar.gz \
-         && test `find . -type f -print | wc -l` -eq 0
-       -chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir)
-       @banner="$(distdir).tar.gz is ready for distribution"; \
-       dashes=`echo "$$banner" | sed s/./=/g`; \
-       echo "$$dashes"; \
-       echo "$$banner"; \
-       echo "$$dashes"
index 5704f87..ef759db 100644 (file)
@@ -154,3 +154,49 @@ distdir: $(DISTFILES)
 ?TOPDIR??ZIP?  -rm -f $(distdir).zip
 ?TOPDIR??ZIP?  zip -rq $(distdir).zip $(distdir)
 ?TOPDIR??ZIP?  -chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir)
+
+
+
+## ------------------------- ##
+## Checking a distribution.  ##
+## ------------------------- ##
+
+
+?TOPDIR?# This target untars the dist file and tries a VPATH configuration.  Then
+?TOPDIR?# it guarantees that the distribution is self-contained by making another
+?TOPDIR?# tarfile.
+?TOPDIR?.PHONY: distcheck
+?TOPDIR?distcheck: dist
+## Make sure we can remove distdir before trying to remove it.
+?TOPDIR?       -chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir)
+?TOPDIR?       GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf -
+## Make the new source tree read-only.  Distributions ought to work in
+## this case.  However, make the top-level directory writable so we
+## can make our new subdirs.
+?TOPDIR?       chmod -R a-w $(distdir); chmod a+w $(distdir)
+?TOPDIR?       mkdir $(distdir)/=build
+?TOPDIR?       mkdir $(distdir)/=inst
+## Undo the write access.
+?TOPDIR?       chmod a-w $(distdir)
+?TOPDIR?       dc_install_base=`CDPATH=: && cd $(distdir)/=inst && pwd` \
+?TOPDIR??DISTCHECK-HOOK?         && $(MAKE) $(AM_MAKEFLAGS) distcheck-hook \
+?TOPDIR?         && cd $(distdir)/=build \
+?TOPDIR?         && ../configure --srcdir=.. --prefix=$$dc_install_base \
+?TOPDIR??GETTEXT?          --with-included-gettext \
+?TOPDIR?         && $(MAKE) $(AM_MAKEFLAGS) \
+?TOPDIR?         && $(MAKE) $(AM_MAKEFLAGS) dvi \
+?TOPDIR?         && $(MAKE) $(AM_MAKEFLAGS) check \
+?TOPDIR?         && $(MAKE) $(AM_MAKEFLAGS) install \
+?TOPDIR?         && $(MAKE) $(AM_MAKEFLAGS) installcheck \
+?TOPDIR?         && $(MAKE) $(AM_MAKEFLAGS) uninstall \
+## We use -le 1 because the `dir' file might still exist after uninstall.
+?TOPDIR?         && test `find $$dc_install_base -type f -print | wc -l` -le 1 \
+?TOPDIR?         && $(MAKE) $(AM_MAKEFLAGS) dist \
+?TOPDIR?         && $(MAKE) $(AM_MAKEFLAGS) distclean \
+## Make sure to remove the dist file we created in the test build
+## directory.
+?TOPDIR?         && rm -f $(distdir).tar.gz \
+?TOPDIR?         && test `find . -type f -print | wc -l` -eq 0
+?TOPDIR?       -chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir)
+?TOPDIR?       @echo "$(distdir).tar.gz is ready for distribution" | \
+?TOPDIR?         sed 'h;s/./=/g;p;x;p;x'
index 520331a..669f7b3 100644 (file)
@@ -12,7 +12,7 @@ info_TEXINFOS = automake.texi
 
 amfiles = check.am clean-hdr.am clean-kr.am clean.am comp-vars.am \
 compile.am data-clean.am data.am dejagnu.am depend.am depend2.am \
-dist.am distdir.am dist-vars.am footer.am header-vars.am header.am \
+distdir.am dist-vars.am footer.am header-vars.am header.am \
 java-clean.am java.am kr-extra.am library.am libs-clean.am libs.am \
 libtool.am lisp-clean.am lisp.am ltlib-clean.am ltlib.am ltlibrary.am \
 mans-vars.am mans.am multilib.am program.am progs-clean.am progs.am \
index 5704f87..ef759db 100644 (file)
@@ -154,3 +154,49 @@ distdir: $(DISTFILES)
 ?TOPDIR??ZIP?  -rm -f $(distdir).zip
 ?TOPDIR??ZIP?  zip -rq $(distdir).zip $(distdir)
 ?TOPDIR??ZIP?  -chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir)
+
+
+
+## ------------------------- ##
+## Checking a distribution.  ##
+## ------------------------- ##
+
+
+?TOPDIR?# This target untars the dist file and tries a VPATH configuration.  Then
+?TOPDIR?# it guarantees that the distribution is self-contained by making another
+?TOPDIR?# tarfile.
+?TOPDIR?.PHONY: distcheck
+?TOPDIR?distcheck: dist
+## Make sure we can remove distdir before trying to remove it.
+?TOPDIR?       -chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir)
+?TOPDIR?       GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf -
+## Make the new source tree read-only.  Distributions ought to work in
+## this case.  However, make the top-level directory writable so we
+## can make our new subdirs.
+?TOPDIR?       chmod -R a-w $(distdir); chmod a+w $(distdir)
+?TOPDIR?       mkdir $(distdir)/=build
+?TOPDIR?       mkdir $(distdir)/=inst
+## Undo the write access.
+?TOPDIR?       chmod a-w $(distdir)
+?TOPDIR?       dc_install_base=`CDPATH=: && cd $(distdir)/=inst && pwd` \
+?TOPDIR??DISTCHECK-HOOK?         && $(MAKE) $(AM_MAKEFLAGS) distcheck-hook \
+?TOPDIR?         && cd $(distdir)/=build \
+?TOPDIR?         && ../configure --srcdir=.. --prefix=$$dc_install_base \
+?TOPDIR??GETTEXT?          --with-included-gettext \
+?TOPDIR?         && $(MAKE) $(AM_MAKEFLAGS) \
+?TOPDIR?         && $(MAKE) $(AM_MAKEFLAGS) dvi \
+?TOPDIR?         && $(MAKE) $(AM_MAKEFLAGS) check \
+?TOPDIR?         && $(MAKE) $(AM_MAKEFLAGS) install \
+?TOPDIR?         && $(MAKE) $(AM_MAKEFLAGS) installcheck \
+?TOPDIR?         && $(MAKE) $(AM_MAKEFLAGS) uninstall \
+## We use -le 1 because the `dir' file might still exist after uninstall.
+?TOPDIR?         && test `find $$dc_install_base -type f -print | wc -l` -le 1 \
+?TOPDIR?         && $(MAKE) $(AM_MAKEFLAGS) dist \
+?TOPDIR?         && $(MAKE) $(AM_MAKEFLAGS) distclean \
+## Make sure to remove the dist file we created in the test build
+## directory.
+?TOPDIR?         && rm -f $(distdir).tar.gz \
+?TOPDIR?         && test `find . -type f -print | wc -l` -eq 0
+?TOPDIR?       -chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir)
+?TOPDIR?       @echo "$(distdir).tar.gz is ready for distribution" | \
+?TOPDIR?         sed 'h;s/./=/g;p;x;p;x'