]> sourceware.org Git - automake.git/commitdiff
* automake.in (process_option_list): Recognize std-options.
authorAlexandre Duret-Lutz <adl@gnu.org>
Mon, 17 Jun 2002 12:20:13 +0000 (12:20 +0000)
committerAlexandre Duret-Lutz <adl@gnu.org>
Mon, 17 Jun 2002 12:20:13 +0000 (12:20 +0000)
(handle_options): Enable std-options in gnits strictness.
(am_install_var): If std-options, enable CK-OPTS section.
* lib/am/scripts.am (installcheck-am): New target.
* lib/am/progs.am (installcheck-am): New target.
* tests/gnits2.test: New file.
* tests/Makefile.am (TESTS): Add gnits2.test.
* automake.texi (Gnits, Options): Document std-options.

12 files changed:
ChangeLog
NEWS
TODO
automake.in
automake.texi
lib/am/progs.am
lib/am/scripts.am
stamp-vti
tests/Makefile.am
tests/Makefile.in
tests/gnits2.test [new file with mode: 0755]
version.texi

index 2166c6f2dc3a52c52f7d26cd15157667474e8141..9eb350659607db5c556790c55d14d1d6cb7922e3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2002-06-17  Paolo Bonzini  <bonzini@gnu.org>
+
+       * automake.in (process_option_list): Recognize std-options.
+       (handle_options): Enable std-options in gnits strictness.
+       (am_install_var): If std-options, enable CK-OPTS section.
+       * lib/am/scripts.am (installcheck-am): New target.
+       * lib/am/progs.am (installcheck-am): New target.
+       * tests/gnits2.test: New file.
+       * tests/Makefile.am (TESTS): Add gnits2.test.
+       * automake.texi (Gnits, Options): Document std-options.
+
 2002-06-17  Kevin Ryde  <user42@zip.com.au>
 
        * automake.in (scan_texinfo_file): Add tmp to @clean_suffixes,
diff --git a/NEWS b/NEWS
index 83d47ffbdf8a1ac6e7bbf142534e95ead53ba9c1..fcb3286f28185c0cc3722e041e84270422a57448 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,6 @@
 New in 1.6a:
+* A new option, std-options, tests that programs support --help and --version
+  when `make installcheck' is run.  This is enabled by --gnits.
 * PDF files are generated by Automake
 * `make distcheck' will enforce DESTDIR support by attempting
   a DESTDIR install.
diff --git a/TODO b/TODO
index 4215b42f80543a30320b24b9e61f4e54a9cfbdc2..56a75efa74782969476de4f5f24804cc7626ab79 100644 (file)
--- a/TODO
+++ b/TODO
@@ -205,8 +205,6 @@ Alex Hornby
 * should not put texiname_TEXINFOS into distribution
   should rename this macro anyway, to foo_texi_DEPENDENCIES
 
-* *all* installed scripts should support --version, --help
-
 * For now I guess I'll just have automake give an error if it encounters
 non-C source in a libtool library specification.
 
@@ -269,7 +267,6 @@ Some long-term projects:
   fragments to be merged.  e.g., `install-local'.
 
 consider putting all check-* targets onto @check?
-To support --help/--version checking?
 
 take diff-n-query code from libit
 
@@ -320,7 +317,6 @@ characters long.
 *    Don't include any symbolic links in the distribution itself.
      (ditto hard links)
 *    Make sure that all the files in the distribution are world-readable.
-** also, check --help output and --version output.  Idea from François
 * standards no longer prohibit ANSI C.  What does this imply
   for the de-ansi-fication feature? [ must keep it -- some users rely on it ]
 
index beba6a0663aa1474a926221ab4b08ef307811b4e..3ed14df10e9b2f46604d05a46d9d2a46fbb8a518 100755 (executable)
@@ -1462,7 +1462,8 @@ sub process_option_list
               || $_ eq 'dejagnu' || $_ eq 'no-texinfo.tex'
               || $_ eq 'readme-alpha' || $_ eq 'check-news'
               || $_ eq 'subdir-objects' || $_ eq 'nostdinc'
-              || $_ eq 'no-exeext' || $_ eq 'no-define')
+              || $_ eq 'no-exeext' || $_ eq 'no-define'
+              || $_ eq 'std-options')
        {
            # Explicitly recognize these.
        }
@@ -1529,6 +1530,7 @@ sub handle_options
     if ($strictness == GNITS)
     {
        $options{'readme-alpha'} = 1;
+       $options{'std-options'} = 1;
        $options{'check-news'} = 1;
     }
 
@@ -7782,6 +7784,9 @@ sub am_install_var
        # If so, with install-exec? (or install-data?).
        my $exec_p = ($nodir_name =~ /$EXEC_DIR_PATTERN/o);
 
+       my $check_options_p = $install_p
+                             && defined $options{'std-options'};
+
        # Singular form of $PRIMARY.
        (my $one_primary = $primary) =~ s/S$//;
        $output_rules .= &file_contents ($file,
@@ -7795,7 +7800,8 @@ sub am_install_var
 
                                          'EXEC'    => $exec_p,
                                          'INSTALL' => $install_p,
-                                         'DIST'    => $dist_p));
+                                         'DIST'    => $dist_p,
+                                         'CK-OPTS' => $check_options_p));
 
        $first = 0;
     }
index 887bdd4ba93f13206b25e359e6cb229403a8fa21..3104a8be0a6dd352454ba25ed163833ca76b3e0f 100644 (file)
@@ -4204,6 +4204,11 @@ non-alpha releases.  The second form is
 @samp{@var{MAJOR}.@var{MINOR}@var{ALPHA}}, where @var{ALPHA} is a
 letter; it should be omitted for non-alpha releases.
 
+@item @code{std-options}
+@cindex Options, std-options
+Make the @code{installcheck} target check that installed scripts and
+programs support the @code{--help} and @code{--version} options.
+
 @item @code{subdir-objects}
 If this option is specified, then objects are placed into the
 subdirectory of the build directory corresponding to the subdirectory of
@@ -4509,6 +4514,12 @@ The @samp{--gnits} option does everything that @samp{--gnu} does, and
 checks the following as well:
 
 @itemize @bullet
+@item
+@samp{make installcheck} will check to make sure that the @code{--help}
+and @code{--version} really print a usage message and a version string,
+respectively.  This also provides a basic check that the program's
+run-time dependencies are satisfied after installation.
+
 @item
 @samp{make dist} will check to make sure the @file{NEWS} file has been
 updated to the current version.
index c1ccfbba6b2bd9414eb805b5ba6a8f1ae0d2d129..7b0b323af30b0e174b556977b3eda84d41d3b67f 100644 (file)
@@ -94,3 +94,21 @@ clean-%DIR%PROGRAMS:
 ?LIBTOOL?        echo " rm -f $$p $$f"; \
 ?LIBTOOL?        rm -f $$p $$f ; \
 ?LIBTOOL?      done
+
+
+## ---------- ##
+## Checking.  ##
+## ---------- ##
+
+if %?CK-OPTS%
+.PHONY installcheck-am: installcheck-%DIR%PROGRAMS
+installcheck-%DIR%PROGRAMS: $(%DIR%_PROGRAMS)
+       bad=0; pid=$$$$; list="$(%DIR%_PROGRAMS)"; for p in $$list; do \
+         for opt in --help --version; do \
+           if $(DESTDIR)$(%NDIR%dir)/$$p $$opt > c$${pid}_.out 2> c$${pid}_.err \
+                && test -n "`cat c$${pid}_.out`" \
+                && test -z "`cat c$${pid}_.err`"; then :; \
+           else echo "$$p does not support $$opt" 1>&2; bad=1; fi; \
+         done; \
+       done; rm -f c$${pid}_.???; exit $$bad
+endif %?CK-OPTS%
index b50e19d954b9bb7615a0f53784ee74d6f2a43f85..0f5cd5d24ae7c00af3bc5fb971c9be7944572092 100644 (file)
@@ -81,17 +81,16 @@ endif %?DIST%
 ## Checking.  ##
 ## ---------- ##
 
-## Uncomment line in handle_scripts when this is uncommented.
-## check-%DIR%SCRIPTS:
-##     pid=$$$$; list="$(%DIR%_SCRIPTS)"; for p in $$list; do \
-##       for opt in --help --version; do \
-##         if test -f $$p; then :; \
-##         elif test -f $(srcdir)/$$p; then \
-##           p=$(srcdir)/$$p; \
-##         else exit 1; fi; \
-##         if $$p $$opt > .chkout$$pid 2> .chkerr$$pid \
-##              && test -n "`cat .chkout$$pid`" \
-##              && test -z "`cat .chkerr$$pid`"; then :; \
-##         else echo "$$p failed $$opt test" 1>&2; exit 1; fi; \
-##       done; \
-##     done; rm -f .chk???$$pid
+if %?CK-OPTS%
+.PHONY installcheck-am: installcheck-%DIR%SCRIPTS
+installcheck-%DIR%SCRIPTS: $(%DIR%_SCRIPTS)
+       bad=0; pid=$$$$; list="$(%DIR%_SCRIPTS)"; for p in $$list; do \
+         for opt in --help --version; do \
+           if $(DESTDIR)$(%NDIR%dir)/$$p $$opt > c$${pid}_.out 2> c$${pid}_.err \
+                && test -n "`cat c$${pid}_.out`" \
+                && test -z "`cat c$${pid}_.err`"; then :; \
+           else echo "$$p does not support $$opt" 1>&2; bad=1; fi; \
+         done; \
+       done; rm -f c$${pid}_.???; exit $$bad
+endif %?CK-OPTS%
+
index 9815744bca42150190addb8427ed64d928709c5b..f608a27d60f3e93c00d3967ed041848bf96caae9 100644 (file)
--- a/stamp-vti
+++ b/stamp-vti
@@ -1,4 +1,4 @@
-@set UPDATED 13 June 2002
+@set UPDATED 17 June 2002
 @set UPDATED-MONTH June 2002
 @set EDITION 1.6a
 @set VERSION 1.6a
index aa8fa3e65a46d67c1d48c27e4cd0e7944e9c4091..c86a42382d6d6b75a97a087102a84024dbd71973 100644 (file)
@@ -170,6 +170,7 @@ gcj2.test \
 gcj3.test \
 gcj4.test \
 gnits.test \
+gnits2.test \
 header.test \
 implicit.test \
 include.test \
index ed733d0523fa265caa5df3427b437b96324c418a..13332ba5c814d7efad91f293f758ab3b45b831f5 100644 (file)
@@ -256,6 +256,7 @@ gcj2.test \
 gcj3.test \
 gcj4.test \
 gnits.test \
+gnits2.test \
 header.test \
 implicit.test \
 include.test \
diff --git a/tests/gnits2.test b/tests/gnits2.test
new file mode 100755 (executable)
index 0000000..524f974
--- /dev/null
@@ -0,0 +1,78 @@
+#! /bin/sh
+
+# Test to ensure std-options checking is correct.
+
+required=gcc
+. $srcdir/defs || exit 1
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+AUTOMAKE_OPTIONS = gnits
+noinst_PROGRAMS = fubar2
+bin_PROGRAMS = fubar fine
+fubar_SOURCES = fubar.c
+fubar2_SOURCES = fubar2.c
+fine_SOURCES = fine.c
+END
+
+echo 'main(int argc, char **argv) { exit(0); }' > fubar.c
+echo 'main(int argc, char **argv) { exit(0); }' > fubar2.c
+
+cat > fine.c << 'END'
+#include <stdio.h>
+main(int argc, char **argv) {
+  puts ("Which version? Which usage?");
+  exit(0);
+}
+END
+
+cat > check.sed << 'END'
+/fubar does not/ {
+  s/.*/0/
+  H
+}
+/fubar2 does not/ {
+  s/.*/1/
+  H
+}
+/fine does not/ {
+  s/.*/1/
+  H
+}
+$!d
+
+g
+/^\n0\n0$/! {
+  s/.*/1/
+  q
+}
+s/.*/0/
+END
+
+# Files required by Gnits.
+: > INSTALL
+: > NEWS
+: > README
+: > COPYING
+: > AUTHORS
+: > ChangeLog
+: > THANKS
+
+set -e
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+mkdir sub
+cd sub
+
+../configure --prefix=`pwd`/../inst-dir
+$MAKE all
+$MAKE install
+exit `$MAKE installcheck 2>&1 | sed -f ../check.sed`
+
index 9815744bca42150190addb8427ed64d928709c5b..f608a27d60f3e93c00d3967ed041848bf96caae9 100644 (file)
@@ -1,4 +1,4 @@
-@set UPDATED 13 June 2002
+@set UPDATED 17 June 2002
 @set UPDATED-MONTH June 2002
 @set EDITION 1.6a
 @set VERSION 1.6a
This page took 0.053193 seconds and 5 git commands to generate.