]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
examples: Add a script for checking against mistakes.
authorBruno Haible <bruno@clisp.org>
Thu, 18 Oct 2018 01:31:50 +0000 (03:31 +0200)
committerBruno Haible <bruno@clisp.org>
Fri, 19 Oct 2018 00:37:28 +0000 (02:37 +0200)
* gettext-tools/examples/check-examples: New file.
* gettext-tools/examples/HACKING: New file.
* gettext-tools/examples/Makefile.am (EXTRA_DIST): Add them.
* Admin/release-steps: Mention check-examples.

Admin/release-steps
gettext-tools/examples/HACKING [new file with mode: 0644]
gettext-tools/examples/Makefile.am
gettext-tools/examples/check-examples [new file with mode: 0755]

index 0999eb25ec47574a3299c4a5043d9fa552f048a3..c82a2d218471c99c2a7a051971249fae5d549089 100644 (file)
@@ -107,6 +107,21 @@ We assume that the following environment variables are set:
 
     Update po-mode-version-string, if there is any change.
 
+  - gettext-tools/examples/hello-c/m4/Makefile.am
+    gettext-tools/examples/hello-c-gnome/m4/Makefile.am
+    gettext-tools/examples/hello-c-gnome3/m4/Makefile.am
+    gettext-tools/examples/hello-c++/m4/Makefile.am
+    gettext-tools/examples/hello-c++-kde/m4/Makefile.am
+    gettext-tools/examples/hello-c++-gnome/m4/Makefile.am
+    gettext-tools/examples/hello-objc/m4/Makefile.am
+    gettext-tools/examples/hello-objc-gnome/m4/Makefile.am
+
+    Update list of .m4 files (brought in by autopoint).
+
+    Then check the build infrastructure of the examples by running
+      $ cd gettext-tools/examples
+      $ ,/check-examples
+
   - NEWS
   - gettext-runtime/libasprintf/NEWS
   - gettext-runtime/NEWS
diff --git a/gettext-tools/examples/HACKING b/gettext-tools/examples/HACKING
new file mode 100644 (file)
index 0000000..20b8f37
--- /dev/null
@@ -0,0 +1,5 @@
+After doing modifications to the samples, check that they still satisfy
+the standard expectations about Makefile targets:
+
+  ./check-examples
+
index 365b621622a10546c40689acb338d14fd15fc82c..2183e5ae28994bcfb901ecb84bb24a97437e2c72 100644 (file)
@@ -19,7 +19,9 @@
 AUTOMAKE_OPTIONS = 1.2 foreign
 ACLOCAL_AMFLAGS = -I ../../gettext-runtime/m4 -I ../../m4
 SUBDIRS = po
-EXTRA_DIST =
+EXTRA_DIST = \
+  HACKING \
+  check-examples
 
 examplesdir = $(docdir)/examples
 
diff --git a/gettext-tools/examples/check-examples b/gettext-tools/examples/check-examples
new file mode 100755 (executable)
index 0000000..87852f2
--- /dev/null
@@ -0,0 +1,813 @@
+#!/bin/bash
+# Script that checks against build infrastructure mistakes in the examples.
+
+
+# func_init sample
+# sets environment variables for building and running the given sample.
+func_init ()
+{
+  case "$1" in
+    hello-objc-gnustep) . /usr/share/GNUstep/Makefiles/GNUstep.sh ;;
+  esac
+}
+
+
+# func_autogen sample
+# adds generated build infrastructure files to the given sample.
+func_autogen ()
+{
+  case "$1" in
+    hello-objc-gnustep)
+      (func_init "$1"; cd "$1" && ./autogen.sh)
+      ;;
+    *)
+      (cd "$1" && ./autogen.sh)
+      ;;
+  esac
+}
+
+# func_autoclean sample
+# removes generated build infrastructure files from the given sample.
+func_autoclean ()
+{
+  case "$1" in
+    hello-objc-gnustep)
+      (func_init "$1"; cd "$1" && ./autoclean.sh)
+      ;;
+    *)
+      (cd "$1" && ./autoclean.sh)
+      ;;
+  esac
+}
+
+# func_configure sample [builddir]
+# runs configure for the given sample, optionally in a VPATH build.
+func_configure ()
+{
+  case "$1" in
+    hello-objc-gnustep) ;;
+    *)
+      if test -n "$2"; then
+        (cd "$1"
+         mkdir "$2"
+         (cd "$2" && ../configure)
+        )
+      else
+        (cd "$1" && ./configure)
+      fi
+      ;;
+  esac
+}
+
+# func_distclean sample [builddir]
+# undoes the effects of func_configure sample [builddir].
+func_distclean ()
+{
+  case "$1" in
+    hello-objc-gnustep) ;;
+    *)
+      if test -n "$2"; then
+        (cd "$1/$2" && make distclean)
+      else
+        (cd "$1" && make distclean)
+      fi
+      ;;
+  esac
+}
+
+# func_maintainerclean sample [builddir]
+# also removes files that are expensive to rebuild.
+func_maintainerclean ()
+{
+  case "$1" in
+    hello-objc-gnustep)
+      (func_init "$1"; cd "$1" && make distclean)
+      ;;
+    *)
+      if test -n "$2"; then
+        (cd "$1/$2" && make maintainer-clean)
+      else
+        (cd "$1" && make maintainer-clean)
+      fi
+      ;;
+  esac
+}
+
+
+# func_check_autoclean sample
+# checks whether the autoclean.sh script is complete.
+func_check_autoclean ()
+{
+  sample="$1"
+  rm -rf "$sample.bak"
+  cp -a "$sample" "$sample.bak"
+  func_autogen "$sample"
+  func_autoclean "$sample"
+  LC_ALL=C diff -r -q "$sample.bak" "$sample" | sed -n -e 's/^Only in //p' | sed -e 's|: |/|' > "$sample.out"
+  if ! test -s "$sample.out"; then
+    rm -f "$sample.out"
+  fi
+  rm -rf "$sample.bak"
+}
+
+func_check_autoclean_all ()
+{
+  rm -f hello-*.out
+  func_check_autoclean hello-c
+  func_check_autoclean hello-c-gnome
+  func_check_autoclean hello-c-gnome3
+  func_check_autoclean hello-c++
+  func_check_autoclean hello-c++-qt
+  func_check_autoclean hello-c++-kde
+  func_check_autoclean hello-c++-gnome
+  func_check_autoclean hello-c++-wxwidgets
+  func_check_autoclean hello-objc
+  func_check_autoclean hello-objc-gnustep
+  func_check_autoclean hello-objc-gnome
+  func_check_autoclean hello-sh
+  func_check_autoclean hello-python
+  func_check_autoclean hello-clisp
+  func_check_autoclean hello-librep
+  func_check_autoclean hello-guile
+  func_check_autoclean hello-smalltalk
+  func_check_autoclean hello-java
+  func_check_autoclean hello-java-awt
+  func_check_autoclean hello-java-swing
+  func_check_autoclean hello-java-qtjambi
+  func_check_autoclean hello-csharp
+  func_check_autoclean hello-csharp-forms
+  func_check_autoclean hello-gawk
+  func_check_autoclean hello-pascal
+  func_check_autoclean hello-ycp
+  func_check_autoclean hello-tcl
+  func_check_autoclean hello-tcl-tk
+  func_check_autoclean hello-perl
+  func_check_autoclean hello-php
+  if (shopt -s failglob; echo hello-*.out) >/dev/null 2>/dev/null; then
+    echo "*** func_check_autoclean error: Leftover files:"
+    cat hello-*.out
+    rm -f hello-*.out
+    exit 1
+  fi
+}
+
+
+# Known configure failures:
+# hello-c-gnome: error: Could not find the gnomeConf.sh file that is generated by gnome-libs install
+# hello-c-gnome3: error: can't find gtk+-3.0 >= 3.10
+# hello-c++-qt: error: cannot find correct Qt headers!
+# hello-c++-kde: configure: error: Qt (>= Qt 3.1.0) (headers and libraries) not found. Please check your installation!
+# hello-c++-gnome: error: Could not find the gnomeConf.sh file that is generated by gnome-libs install
+# hello-objc-gnome: error: Could not find the gnomeConf.sh file that is generated by gnome-libs install
+# hello-ycp: *** Essential program y2base not found
+
+# func_check_distclean sample
+# checks 'make distclean' directly after 'configure'.
+func_check_distclean ()
+{
+  sample="$1"
+  rm -rf "$sample.bak"
+  func_autogen "$sample"
+  cp -a "$sample" "$sample.bak"
+  if func_configure "$sample" > "$sample.log" 2>&1; then
+    rm -f "$sample.log"
+    func_distclean "$sample"
+    LC_ALL=C diff -r -q "$sample.bak" "$sample" | sed -n -e 's/^Only in //p' | sed -e 's|: |/|' > "$sample.out"
+  fi
+  func_autoclean "$sample"
+  if ! test -s "$sample.out"; then
+    rm -f "$sample.out"
+  fi
+  rm -rf "$sample.bak"
+}
+
+func_check_distclean_all ()
+{
+  rm -f hello-*.log hello-*.out
+  func_check_distclean hello-c
+ #func_check_distclean hello-c-gnome
+ #func_check_distclean hello-c-gnome3
+  func_check_distclean hello-c++
+ #func_check_distclean hello-c++-qt
+ #func_check_distclean hello-c++-kde
+ #func_check_distclean hello-c++-gnome
+  func_check_distclean hello-c++-wxwidgets
+  func_check_distclean hello-objc
+  func_check_distclean hello-objc-gnustep
+ #func_check_distclean hello-objc-gnome
+  func_check_distclean hello-sh
+  func_check_distclean hello-python
+  func_check_distclean hello-clisp
+  func_check_distclean hello-librep
+  func_check_distclean hello-guile
+  func_check_distclean hello-smalltalk
+  func_check_distclean hello-java
+  func_check_distclean hello-java-awt
+  func_check_distclean hello-java-swing
+  func_check_distclean hello-java-qtjambi
+  func_check_distclean hello-csharp
+  func_check_distclean hello-csharp-forms
+  func_check_distclean hello-gawk
+  func_check_distclean hello-pascal
+ #func_check_distclean hello-ycp
+  func_check_distclean hello-tcl
+  func_check_distclean hello-tcl-tk
+  func_check_distclean hello-perl
+  func_check_distclean hello-php
+  if (shopt -s failglob; echo hello-*.log) >/dev/null 2>/dev/null; then
+    echo "*** func_check_distclean error: 'configure' failures"
+    echo hello-*.log
+    exit 1
+  fi
+  if (shopt -s failglob; echo hello-*.out) >/dev/null 2>/dev/null; then
+    echo "*** func_check_distclean error: incomplete 'make distclean'"
+    echo hello-*.out
+    exit 1
+  fi
+}
+
+
+# Known make failures:
+# hello-java-qtjambi: error: package com.trolltech.qt.core does not exist
+
+# func_check_maintainerclean sample
+# checks 'make distclean' after 'configure; make'.
+func_check_maintainerclean ()
+{
+  sample="$1"
+  rm -rf "$sample.bak"
+  func_autogen "$sample"
+  cp -a "$sample" "$sample.bak"
+  if func_configure "$sample"; then
+    if (func_init "$sample"; cd "$sample" && make) > "$sample.log" 2>&1; then
+      rm -f "$sample.log"
+    fi
+  fi
+  func_maintainerclean "$sample"
+  # TODO: Remove .pot files workaround.
+  LC_ALL=C diff -r -q "$sample.bak" "$sample" | sed -n -e 's/^Only in //p' | sed -e 's|: |/|' | grep "^${sample}/" | grep -v '\.pot$' > "$sample.out"
+  func_autoclean "$sample"
+  if ! test -s "$sample.out"; then
+    rm -f "$sample.out"
+  fi
+  rm -rf "$sample.bak"
+}
+
+func_check_maintainerclean_all ()
+{
+  rm -f hello-*.log hello-*.out
+  func_check_maintainerclean hello-c
+ #func_check_maintainerclean hello-c-gnome
+ #func_check_maintainerclean hello-c-gnome3
+  func_check_maintainerclean hello-c++
+ #func_check_maintainerclean hello-c++-qt
+ #func_check_maintainerclean hello-c++-kde
+ #func_check_maintainerclean hello-c++-gnome
+  func_check_maintainerclean hello-c++-wxwidgets
+  func_check_maintainerclean hello-objc
+  func_check_maintainerclean hello-objc-gnustep
+ #func_check_maintainerclean hello-objc-gnome
+  func_check_maintainerclean hello-sh
+  func_check_maintainerclean hello-python
+  func_check_maintainerclean hello-clisp
+  func_check_maintainerclean hello-librep
+  func_check_maintainerclean hello-guile
+  func_check_maintainerclean hello-smalltalk
+  func_check_maintainerclean hello-java
+  func_check_maintainerclean hello-java-awt
+  func_check_maintainerclean hello-java-swing
+ #func_check_maintainerclean hello-java-qtjambi
+  func_check_maintainerclean hello-csharp
+  func_check_maintainerclean hello-csharp-forms
+  func_check_maintainerclean hello-gawk
+  func_check_maintainerclean hello-pascal
+ #func_check_maintainerclean hello-ycp
+  func_check_maintainerclean hello-tcl
+  func_check_maintainerclean hello-tcl-tk
+  func_check_maintainerclean hello-perl
+  func_check_maintainerclean hello-php
+  if (shopt -s failglob; echo hello-*log) >/dev/null 2>/dev/null; then
+    echo "*** func_check_maintainerclean error: 'make' failures"
+    echo hello-*.log
+    exit 1
+  fi
+  if (shopt -s failglob; echo hello-*.out) >/dev/null 2>/dev/null; then
+    echo "*** func_check_maintainerclean error: incomplete 'make maintainer-clean'"
+    echo hello-*.out
+    exit 1
+  fi
+}
+
+
+# func_check_maintainerclean_vpath sample
+# checks 'make distclean' after 'configure; make' with a VPATH build.
+func_check_maintainerclean_vpath ()
+{
+  sample="$1"
+  case "$sample" in
+    hello-objc-gnustep) ;;
+    *)
+      rm -rf "$sample.bak"
+      func_autogen "$sample"
+      cp -a "$sample" "$sample.bak"
+      if func_configure "$sample" build; then
+        if (func_init "$sample"; cd "$sample"/build && make) > "$sample.log" 2>&1; then
+          rm -f "$sample.log"
+        fi
+      fi
+      func_maintainerclean "$sample" build
+      # TODO: Remove .pot files workaround.
+      find "$sample"/build -type f | LC_ALL=C sort | grep -v '\.pot$' > "$sample.out"
+      rm -rf "$sample"/build
+      func_autoclean "$sample"
+      if ! test -s "$sample.out"; then
+        rm -f "$sample.out"
+      fi
+      rm -rf "$sample.bak"
+      ;;
+  esac
+}
+
+func_check_maintainerclean_vpath_all ()
+{
+  rm -f hello-*.log hello-*.out
+  func_check_maintainerclean_vpath hello-c
+ #func_check_maintainerclean_vpath hello-c-gnome
+ #func_check_maintainerclean_vpath hello-c-gnome3
+  func_check_maintainerclean_vpath hello-c++
+ #func_check_maintainerclean_vpath hello-c++-qt
+ #func_check_maintainerclean_vpath hello-c++-kde
+ #func_check_maintainerclean_vpath hello-c++-gnome
+  func_check_maintainerclean_vpath hello-c++-wxwidgets
+  func_check_maintainerclean_vpath hello-objc
+  func_check_maintainerclean_vpath hello-objc-gnustep
+ #func_check_maintainerclean_vpath hello-objc-gnome
+  func_check_maintainerclean_vpath hello-sh
+  func_check_maintainerclean_vpath hello-python
+  func_check_maintainerclean_vpath hello-clisp
+  func_check_maintainerclean_vpath hello-librep
+  func_check_maintainerclean_vpath hello-guile
+  func_check_maintainerclean_vpath hello-smalltalk
+  func_check_maintainerclean_vpath hello-java
+  func_check_maintainerclean_vpath hello-java-awt
+  func_check_maintainerclean_vpath hello-java-swing
+ #func_check_maintainerclean_vpath hello-java-qtjambi
+  func_check_maintainerclean_vpath hello-csharp
+  func_check_maintainerclean_vpath hello-csharp-forms
+  func_check_maintainerclean_vpath hello-gawk
+  func_check_maintainerclean_vpath hello-pascal
+ #func_check_maintainerclean_vpath hello-ycp
+  func_check_maintainerclean_vpath hello-tcl
+  func_check_maintainerclean_vpath hello-tcl-tk
+  func_check_maintainerclean_vpath hello-perl
+  func_check_maintainerclean_vpath hello-php
+  if (shopt -s failglob; echo hello-*log) >/dev/null 2>/dev/null; then
+    echo "*** func_check_maintainerclean_vpath error: 'make' failures"
+    echo hello-*.log
+    exit 1
+  fi
+  if (shopt -s failglob; echo hello-*.out) >/dev/null 2>/dev/null; then
+    echo "*** func_check_maintainerclean_vpath error: incomplete 'make maintainer-clean'"
+    echo hello-*.out
+    exit 1
+  fi
+}
+
+
+# func_check_dist sample
+# checks 'make dist' after 'configure; make'.
+func_check_dist ()
+{
+  sample="$1"
+  case "$sample" in
+    hello-objc-gnustep) ;;
+    *)
+      func_autogen "$sample"
+      if func_configure "$sample"; then
+        if (func_init "$sample"; cd "$sample" && make); then
+          if (func_init "$sample"; cd "$sample" && make dist) > "$sample.log" 2>&1; then
+            rm -f "$sample.log"
+            (func_init "$sample"; cd "$sample" && make distclean)
+            rm -f `find "$sample" -name '*~'` `find "$sample" -name '*.orig'`
+            rm -rf "$sample/autom4te.cache"
+            if test -f "$sample/$sample-0.tar.gz"; then
+              (cd "$sample" && tar xfz "$sample-0.tar.gz")
+              LC_ALL=C diff -r -q "$sample" "$sample/$sample-0" | grep -v "^Only in $sample: $sample-0$" | grep -v "^Only in $sample: $sample-0.tar.gz$" | grep -v "^Only in $sample: BUGS$" > "$sample.out"
+            else
+              echo "$sample-0.tar.gz was not created" > "$sample.out"
+            fi
+          fi
+          rm -rf "$sample/$sample-0"
+          rm -f "$sample/$sample-0.tar.gz"
+        fi
+      fi
+      func_configure "$sample"
+      func_maintainerclean "$sample"
+      func_autoclean "$sample"
+      if ! test -s "$sample.out"; then
+        rm -f "$sample.out"
+      fi
+      ;;
+  esac
+}
+
+func_check_dist_all ()
+{
+  rm -f hello-*.log hello-*.out
+  func_check_dist hello-c
+ #func_check_dist hello-c-gnome
+ #func_check_dist hello-c-gnome3
+  func_check_dist hello-c++
+ #func_check_dist hello-c++-qt
+ #func_check_dist hello-c++-kde
+ #func_check_dist hello-c++-gnome
+  func_check_dist hello-c++-wxwidgets
+  func_check_dist hello-objc
+  func_check_dist hello-objc-gnustep
+ #func_check_dist hello-objc-gnome
+  func_check_dist hello-sh
+  func_check_dist hello-python
+  func_check_dist hello-clisp
+  func_check_dist hello-librep
+  func_check_dist hello-guile
+  func_check_dist hello-smalltalk
+  func_check_dist hello-java
+  func_check_dist hello-java-awt
+  func_check_dist hello-java-swing
+ #func_check_dist hello-java-qtjambi
+  func_check_dist hello-csharp
+  func_check_dist hello-csharp-forms
+  func_check_dist hello-gawk
+  func_check_dist hello-pascal
+ #func_check_dist hello-ycp
+  func_check_dist hello-tcl
+  func_check_dist hello-tcl-tk
+  func_check_dist hello-perl
+  func_check_dist hello-php
+  if (shopt -s failglob; echo hello-*log) >/dev/null 2>/dev/null; then
+    echo "*** func_check_dist error: 'make dist' failures"
+    echo hello-*.log
+    exit 1
+  fi
+  if (shopt -s failglob; echo hello-*.out) >/dev/null 2>/dev/null; then
+    echo "*** func_check_dist error: tarball created by 'make dist' does not contain the expected files"
+    echo hello-*.out
+    exit 1
+  fi
+}
+
+
+# func_check_dist_vpath sample
+# checks 'make dist' after 'configure; make' with a VPATH build
+func_check_dist_vpath ()
+{
+  sample="$1"
+  case "$sample" in
+    hello-objc-gnustep) ;;
+    *)
+      func_autogen "$sample"
+      if func_configure "$sample" build; then
+        if (func_init "$sample"; cd "$sample"/build && make); then
+          if (func_init "$sample"; cd "$sample"/build && make dist) > "$sample.log" 2>&1; then
+            rm -f "$sample.log"
+            (func_init "$sample"; cd "$sample"/build && make distclean)
+            rm -f `find "$sample" -name '*~'` `find "$sample" -name '*.orig'`
+            rm -rf "$sample/autom4te.cache"
+            if test -f "$sample/build/$sample-0.tar.gz"; then
+              (cd "$sample"/build && tar xfz "$sample-0.tar.gz")
+              # TODO: Remove stamp-po workaround.
+              LC_ALL=C diff -r -q "$sample" "$sample/build/$sample-0" | grep -v "^Only in $sample: build$" | grep -v "^Only in $sample: BUGS$" | grep -v "^Only in $sample/build/$sample-0/po: stamp-po$" > "$sample.out"
+            else
+              echo "$sample-0.tar.gz was not created" > "$sample.out"
+            fi
+          fi
+          rm -rf "$sample/build/$sample-0"
+          rm -f "$sample/build/$sample-0.tar.gz"
+        fi
+      fi
+      rm -rf "$sample"/build
+      func_autoclean "$sample"
+      if ! test -s "$sample.out"; then
+        rm -f "$sample.out"
+      fi
+      ;;
+  esac
+}
+
+func_check_dist_vpath_all ()
+{
+  rm -f hello-*.log hello-*.out
+  func_check_dist_vpath hello-c
+ #func_check_dist_vpath hello-c-gnome
+ #func_check_dist_vpath hello-c-gnome3
+  func_check_dist_vpath hello-c++
+ #func_check_dist_vpath hello-c++-qt
+ #func_check_dist_vpath hello-c++-kde
+ #func_check_dist_vpath hello-c++-gnome
+  func_check_dist_vpath hello-c++-wxwidgets
+  func_check_dist_vpath hello-objc
+  func_check_dist_vpath hello-objc-gnustep
+ #func_check_dist_vpath hello-objc-gnome
+  func_check_dist_vpath hello-sh
+  func_check_dist_vpath hello-python
+  func_check_dist_vpath hello-clisp
+  func_check_dist_vpath hello-librep
+  func_check_dist_vpath hello-guile
+  func_check_dist_vpath hello-smalltalk
+  func_check_dist_vpath hello-java
+  func_check_dist_vpath hello-java-awt
+  func_check_dist_vpath hello-java-swing
+ #func_check_dist_vpath hello-java-qtjambi
+  func_check_dist_vpath hello-csharp
+  func_check_dist_vpath hello-csharp-forms
+  func_check_dist_vpath hello-gawk
+  func_check_dist_vpath hello-pascal
+ #func_check_dist_vpath hello-ycp
+  func_check_dist_vpath hello-tcl
+  func_check_dist_vpath hello-tcl-tk
+  func_check_dist_vpath hello-perl
+  func_check_dist_vpath hello-php
+  if (shopt -s failglob; echo hello-*log) >/dev/null 2>/dev/null; then
+    echo "*** func_check_dist_vpath error: 'make dist' failures"
+    echo hello-*.log
+    exit 1
+  fi
+  if (shopt -s failglob; echo hello-*.out) >/dev/null 2>/dev/null; then
+    echo "*** func_check_dist_vpath error: tarball created by 'make dist' does not contain the expected files"
+    echo hello-*.out
+    exit 1
+  fi
+}
+
+
+# Base installation directory for all samples.
+instdir=/tmp/gtexinst
+
+# func_check_install sample
+# checks 'make install' after 'configure; make'.
+# You need to check afterwards whether the installed binaries work.
+func_check_install ()
+{
+  sample="$1"
+  case "$sample" in
+    hello-objc-gnustep)
+      # In this sample, you have to check the uninstalled binaries (see the INSTALL file).
+      ;;
+    *)
+      func_autogen "$sample"
+      if (cd "$sample" && ./configure --prefix="$instdir/$sample"); then
+        if (func_init "$sample"; cd "$sample" && make); then
+          if (func_init "$sample"; cd "$sample" && make install) > "$sample.log" 2>&1; then
+            rm -f "$sample.log"
+          fi
+        fi
+      fi
+      func_maintainerclean "$sample"
+      func_autoclean "$sample"
+      ;;
+  esac
+}
+
+func_check_install_all ()
+{
+  rm -f hello-*.log
+  rm -rf "$instdir/hello-*"
+  func_check_install hello-c
+ #func_check_install hello-c-gnome
+ #func_check_install hello-c-gnome3
+  func_check_install hello-c++
+ #func_check_install hello-c++-qt
+ #func_check_install hello-c++-kde
+ #func_check_install hello-c++-gnome
+  func_check_install hello-c++-wxwidgets
+  func_check_install hello-objc
+  func_check_install hello-objc-gnustep
+ #func_check_install hello-objc-gnome
+  func_check_install hello-sh
+  func_check_install hello-python
+  func_check_install hello-clisp
+  func_check_install hello-librep
+  func_check_install hello-guile
+  func_check_install hello-smalltalk
+  func_check_install hello-java
+  func_check_install hello-java-awt
+  func_check_install hello-java-swing
+ #func_check_install hello-java-qtjambi
+  func_check_install hello-csharp
+  func_check_install hello-csharp-forms
+  func_check_install hello-gawk
+  func_check_install hello-pascal
+ #func_check_install hello-ycp
+  func_check_install hello-tcl
+  func_check_install hello-tcl-tk
+  func_check_install hello-perl
+  func_check_install hello-php
+  if (shopt -s failglob; echo hello-*log) >/dev/null 2>/dev/null; then
+    echo "*** func_check_install error: 'make install' failures"
+    echo hello-*.log
+    exit 1
+  fi
+}
+
+
+# func_check_uninstall sample
+# checks 'make uninstall' after 'configure; make; make install'.
+func_check_uninstall ()
+{
+  sample="$1"
+  case "$sample" in
+    hello-objc-gnustep)
+      # In this sample, you have to check the uninstalled binaries (see the INSTALL file).
+      ;;
+    *)
+      func_autogen "$sample"
+      if (cd "$sample" && ./configure --prefix="$instdir/$sample"); then
+        if (func_init "$sample"; cd "$sample" && make); then
+          if (func_init "$sample"; cd "$sample" && make install); then
+            if (func_init "$sample"; cd "$sample" && make uninstall) > "$sample.log" 2>&1; then
+              rm -f "$sample.log"
+              (cd "$instdir" && find "$sample" -type f | LC_ALL=C sort) > "$sample.out"
+            fi
+          fi
+        fi
+      fi
+      func_maintainerclean "$sample"
+      func_autoclean "$sample"
+      if ! test -s "$sample.out"; then
+        rm -f "$sample.out"
+      fi
+      ;;
+  esac
+}
+
+func_check_uninstall_all ()
+{
+  rm -f hello-*.log hello-*.out
+  rm -rf "$instdir/hello-*"
+  func_check_uninstall hello-c
+ #func_check_uninstall hello-c-gnome
+ #func_check_uninstall hello-c-gnome3
+  func_check_uninstall hello-c++
+ #func_check_uninstall hello-c++-qt
+ #func_check_uninstall hello-c++-kde
+ #func_check_uninstall hello-c++-gnome
+  func_check_uninstall hello-c++-wxwidgets
+  func_check_uninstall hello-objc
+  func_check_uninstall hello-objc-gnustep
+ #func_check_uninstall hello-objc-gnome
+  func_check_uninstall hello-sh
+  func_check_uninstall hello-python
+  func_check_uninstall hello-clisp
+  func_check_uninstall hello-librep
+  func_check_uninstall hello-guile
+  func_check_uninstall hello-smalltalk
+  func_check_uninstall hello-java
+  func_check_uninstall hello-java-awt
+  func_check_uninstall hello-java-swing
+ #func_check_uninstall hello-java-qtjambi
+  func_check_uninstall hello-csharp
+  func_check_uninstall hello-csharp-forms
+  func_check_uninstall hello-gawk
+  func_check_uninstall hello-pascal
+ #func_check_uninstall hello-ycp
+  func_check_uninstall hello-tcl
+  func_check_uninstall hello-tcl-tk
+  func_check_uninstall hello-perl
+  func_check_uninstall hello-php
+  if (shopt -s failglob; echo hello-*log) >/dev/null 2>/dev/null; then
+    echo "*** func_check_uninstall error: 'make uninstall' failures"
+    echo hello-*.log
+    exit 1
+  fi
+  if (shopt -s failglob; echo hello-*.out) >/dev/null 2>/dev/null; then
+    echo "*** func_check_uninstall error: left-over files"
+    echo hello-*.out
+    exit 1
+  fi
+}
+
+
+# func_check_distcheck sample
+# checks 'make distcheck' after 'configure; make'.
+func_check_distcheck ()
+{
+  sample="$1"
+  case "$sample" in
+    hello-objc-gnustep) ;;
+    *)
+      func_autogen "$sample"
+      if func_configure "$sample"; then
+        if (func_init "$sample"; cd "$sample" && make); then
+          if (func_init "$sample"; cd "$sample" && make distcheck) > "$sample.log" 2>&1; then
+            rm -f "$sample.log"
+          fi
+          if test -d "$sample/$sample-0"; then chmod -R u+w "$sample/$sample-0"; fi
+          rm -rf "$sample/$sample-0"
+          rm -f "$sample/$sample-0.tar.gz"
+        fi
+      fi
+      func_maintainerclean "$sample"
+      func_autoclean "$sample"
+      if ! test -s "$sample.out"; then
+        rm -f "$sample.out"
+      fi
+      ;;
+  esac
+}
+
+func_check_distcheck_all ()
+{
+  rm -f hello-*.log
+  func_check_distcheck hello-c
+ #func_check_distcheck hello-c-gnome
+ #func_check_distcheck hello-c-gnome3
+  func_check_distcheck hello-c++
+ #func_check_distcheck hello-c++-qt
+ #func_check_distcheck hello-c++-kde
+ #func_check_distcheck hello-c++-gnome
+  func_check_distcheck hello-c++-wxwidgets
+  func_check_distcheck hello-objc
+  func_check_distcheck hello-objc-gnustep
+ #func_check_distcheck hello-objc-gnome
+  func_check_distcheck hello-sh
+  func_check_distcheck hello-python
+  func_check_distcheck hello-clisp
+  func_check_distcheck hello-librep
+  func_check_distcheck hello-guile
+  func_check_distcheck hello-smalltalk
+  func_check_distcheck hello-java
+  func_check_distcheck hello-java-awt
+  func_check_distcheck hello-java-swing
+ #func_check_distcheck hello-java-qtjambi
+  func_check_distcheck hello-csharp
+  func_check_distcheck hello-csharp-forms
+  func_check_distcheck hello-gawk
+  func_check_distcheck hello-pascal
+ #func_check_distcheck hello-ycp
+  func_check_distcheck hello-tcl
+  func_check_distcheck hello-tcl-tk
+  func_check_distcheck hello-perl
+  func_check_distcheck hello-php
+  if (shopt -s failglob; echo hello-*log) >/dev/null 2>/dev/null; then
+    echo "*** func_check_distcheck error: 'make distcheck' failures"
+    echo hello-*.log
+    exit 1
+  fi
+}
+
+
+# If you want to extend this script:
+
+# A dummy check function.
+func_check ()
+{
+  :
+}
+
+# Complete list of samples.
+func_check_all ()
+{
+  func_check hello-c
+  func_check hello-c-gnome
+  func_check hello-c-gnome3
+  func_check hello-c++
+  func_check hello-c++-qt
+  func_check hello-c++-kde
+  func_check hello-c++-gnome
+  func_check hello-c++-wxwidgets
+  func_check hello-objc
+  func_check hello-objc-gnustep
+  func_check hello-objc-gnome
+  func_check hello-sh
+  func_check hello-python
+  func_check hello-clisp
+  func_check hello-librep
+  func_check hello-guile
+  func_check hello-smalltalk
+  func_check hello-java
+  func_check hello-java-awt
+  func_check hello-java-swing
+  func_check hello-java-qtjambi
+  func_check hello-csharp
+  func_check hello-csharp-forms
+  func_check hello-gawk
+  func_check hello-pascal
+  func_check hello-ycp
+  func_check hello-tcl
+  func_check hello-tcl-tk
+  func_check hello-perl
+  func_check hello-php
+}
+
+
+# Top-level code.
+
+func_check_autoclean_all
+func_check_distclean_all
+func_check_maintainerclean_all
+func_check_maintainerclean_vpath_all
+func_check_dist_all
+func_check_dist_vpath_all
+func_check_install_all
+func_check_uninstall_all
+func_check_distcheck_all