OSDN Git Service

Create a preliminary autotest framework.
authorKeith Marshall <keithmarshall@users.sourceforge.net>
Tue, 13 Sep 2016 19:45:57 +0000 (20:45 +0100)
committerKeith Marshall <keithmarshall@users.sourceforge.net>
Tue, 13 Sep 2016 19:45:57 +0000 (20:45 +0100)
mingwrt/ChangeLog
mingwrt/Makefile.in
mingwrt/configure.ac
mingwrt/test_headers.c [deleted file]
mingwrt/tests/Makefile.in [new file with mode: 0644]
mingwrt/tests/atlocal.in [new file with mode: 0644]
mingwrt/tests/headers.at [new file with mode: 0644]
mingwrt/tests/testsuite.at.in [new file with mode: 0644]

index e29044d..132e2f5 100644 (file)
@@ -1,3 +1,23 @@
+2016-09-13  Keith Marshall  <keithmarshall@users.sourceforge.net>
+
+       Create a preliminary autotest framework.
+
+       * configure.ac (AC_TESTDIR): Initialize tests subdirectory.
+       (AC_PROG_CXX): Identify C++ compiler; the testsuite will use it.
+       (AC_CHECK_PROG): Check availability of autom4te; specify fallback.
+       (AC_CONFIG_FILES): Add instantiation requests for tests/atlocal,
+       tests/Makefile, and tests/testsuite.at.tmp
+
+       * tests/testsuite.at.in tests/atlocal.in tests/headers.at
+       * tests/Makefile.in: New files; implement them.
+
+       * Makefile.in (check, check-recursive, tests): Implement new goals.
+       (mingwrt-srcdist-files): Subdivide package files complement into...
+       (mingwrt-srcdist-package-files): ...this original collection, and...
+       (mingwrt-srcdist-testsuite-files): ...this additional set.
+
+       * test_headers.c: Superseded by autotest; delete it.
+
 2016-08-25  Keith Marshall  <keithmarshall@users.sourceforge.net>
 
        Add pthreads-win32 courtesy support hooks.
index bf14d7f..f9cd502 100644 (file)
@@ -870,11 +870,14 @@ mingwrt-srcdist-dir:
        $(RM) -r dist/$(PACKAGE_TARNAME)-$(PACKAGE_VERSION)
        $(call mkinstalldirs,,dist/$(PACKAGE_TARNAME)-$(PACKAGE_VERSION))
 
-mingwrt-srcdist-files:
+mingwrt-srcdist-files: mingwrt-srcdist-package-files
+mingwrt-srcdist-files: mingwrt-srcdist-testsuite-files
+
+mingwrt-srcdist-package-files:
        (cd ${mingwrt_srcdir} && tar chf - --hard-dereference $(notdir $^)) | \
          (cd dist/$(PACKAGE_TARNAME)-$(PACKAGE_VERSION) && tar xf -)
 
-mingwrt-srcdist-files: $(wildcard ${mingwrt_srcdir}/*.[chs]) \
+mingwrt-srcdist-package-files: $(wildcard ${mingwrt_srcdir}/*.[chs]) \
   $(addprefix ${mingwrt_srcdir}/,ChangeLog CONTRIBUTORS DISCLAIMER README) \
   $(wildcard ${mingwrt_srcdir}/*.def.in) $(wildcard ${mingwrt_srcdir}/config*) \
   $(addprefix ${mingwrt_srcdir}/,aclocal.m4 VERSION.m4 install-sh Makefile.in) \
@@ -882,6 +885,11 @@ mingwrt-srcdist-files: $(wildcard ${mingwrt_srcdir}/*.[chs]) \
   $(addprefix ${mingwrt_srcdir}/,msvcrt-xref crtdll.def) \
   $(wildcard ${mingwrt_srcdir}/*.txt)
 
+mingwrt-srcdist-testsuite-files: $(wildcard ${mingwrt_srcdir}/tests/*.at)
+mingwrt-srcdist-testsuite-files: $(wildcard ${mingwrt_srcdir}/tests/*.in)
+       (cd ${mingwrt_srcdir} && tar chf - $(addprefix tests/,$(notdir $^))) | \
+         (cd dist/$(PACKAGE_TARNAME)-$(PACKAGE_VERSION) && tar xf -)
+
 install-html install-pdf: install-%: %dir mingwrt-man$(man3ext)
        $(MAKE) --no-print-directory install-$*-files
 
@@ -927,4 +935,12 @@ maintainer-clean-local: maintainer-clean-warning distclean-local
 
 clean mostlyclean distclean maintainer-clean: %clean: %clean-local
 
+# Testsuite
+# ---------
+#
+.PHONY: check-recursive
+check tests: check-recursive
+check-recursive:
+       $(MAKE) -C tests $@
+
 # $RCSfile$: end of file
index 2f51250..158465d 100644 (file)
 # the rights to use, copy, modify, merge, publish, distribute, sublicense,
 # and/or sell copies of the Software, and to permit persons to whom the
 # Software is furnished to do so, subject to the following conditions:
-# 
+#
 # The above copyright notice and this permission notice (including the next
 # paragraph) shall be included in all copies or substantial portions of the
 # Software.
-# 
+#
 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
   AC_PROG_MKDIR_P
   AC_PROG_LN_S
 
+  AC_CONFIG_TESTDIR([tests])
+  AC_CONFIG_FILES([tests/testsuite.at.tmp:tests/testsuite.at.in])
+  AC_CHECK_PROG([AUTOTEST_COMPILE],[autom4te],[command],[missing])
+  AC_CONFIG_FILES([tests/atlocal tests/Makefile])
+  AC_PROG_CXX
+
   MINGW_AC_MAKE_COMMAND_GOALS
   AC_CONFIG_FILES([Makefile])
   AC_OUTPUT
diff --git a/mingwrt/test_headers.c b/mingwrt/test_headers.c
deleted file mode 100644 (file)
index 62402a6..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-#include <_mingw.h>
-#include <assert.h>
-#include <conio.h>
-#include <ctype.h>
-#include <dir.h>
-#include <direct.h>
-#include <dirent.h>
-#include <dos.h>
-#include <errno.h>
-#include <excpt.h>
-#include <fcntl.h>
-#include <fenv.h>
-#include <float.h>
-#include <inttypes.h>
-#include <io.h>
-#include <limits.h>
-#include <locale.h>
-#include <malloc.h>
-#include <math.h>
-#include <mbctype.h>
-#include <mbstring.h>
-#include <mem.h>
-#include <memory.h>
-#include <process.h>
-#include <search.h>
-#include <setjmp.h>
-#include <share.h>
-#include <signal.h>
-#include <stdarg.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <strings.h>
-#include <tchar.h>
-#include <time.h>
-#include <unistd.h>
-#include <values.h>
-#include <wchar.h>
-#include <wctype.h>
-#include <sys/fcntl.h>
-#include <sys/file.h>
-#include <sys/locking.h>
-#include <sys/param.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <sys/timeb.h>
-#include <sys/types.h>
-#include <sys/unistd.h>
-#include <sys/utime.h>
-
-int main()
-{return 0;}
diff --git a/mingwrt/tests/Makefile.in b/mingwrt/tests/Makefile.in
new file mode 100644 (file)
index 0000000..cbbd237
--- /dev/null
@@ -0,0 +1,142 @@
+# @configure_input@
+#
+# Makefile template for MinGW.org Runtime Library testsuite
+#
+# $Id$
+#
+# Written by Keith Marshall <keithmarshall@users.sourceforge.net>
+# Copyright (C) 2016, MinGW.org Project
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+
+# The default rule is "check"; it is a synonym for the "check-recursive"
+# request, from the parent directory's make process, which initiates the
+# installation of the package components to be tested, then prepares the
+# testsuite itself, compiling it if necessary, and finally, runs it.
+#
+check check-recursive: check-install check-pretest check-local
+
+check-local: testsuite
+       $(SHELL) $^ $(TESTSUITEFLAGS)
+
+check-install: testsuite.install
+check-pretest: testsuite.pretest headers.at.pretest
+
+LN_S = @LN_S@
+
+# Favour any copy of the testsuite which already exists in the build
+# directory, but fall back to any which may have been distributed with
+# the source package.
+#
+testsuite.pretest: %.pretest: %.at.pretest
+       test -r $* || if test -r ${srcdir}/$*; then \
+         $(LN_S) ${srcdir}/$* $*; fi
+
+# The primary testsuite.at source is nominally generated, when the
+# package is configured, but is then distributed within the release
+# tarball; update it as a side effect of running the testsuite, but
+# only if its content differs from any distributed copy, to ensure
+# that users building from a release tarball can do so, without a
+# requirement to install autom4te.
+#
+vpath %.at ${srcdir}
+vpath %.at.in ${srcdir}
+testsuite.at.pretest: %.pretest: %.tmp
+       test -r $* || if test -r ${srcdir}/$*; then \
+         $(LN_S) ${srcdir}/$* $*; else touch $*; fi
+       sed '1s,tests/$<,$*,' $< > $@
+       cmp -s $@ $* || cp -f $@ $*
+       $(RM) $@ $<
+
+testsuite.at.tmp: %.tmp: ../config.status %.in
+       cd ..; ./config.status tests/$@
+
+# The enumerated list of headers, which are to be tested, is also a
+# candidate for dynamic update; in this case, we prefer to update the
+# list in place, within the testsuite source tree.
+#
+headers.at.pretest: MINGWRT_AT_ENUM := MINGWRT_AT_PACKAGE_HEADERS
+headers.at.pretest: %.pretest:
+       sed '/^m4_define(\[$(MINGWRT_AT_ENUM)],/q' ${srcdir}/$* > $@
+       $(call enum_headers,hdr,${top_srcdir}/include, dnl >> $@;)
+       $(call enum_headers,hdr,${top_srcdir}/include/sys, dnl >> $@;,sys)
+       sed -n '/^])# $(MINGWRT_AT_ENUM)/,$$p' ${srcdir}/$* >> $@
+       cmp -s $@ ${srcdir}/$* || cp -f $@ ${srcdir}/$*
+       $(RM) $@
+
+enum_headers = $(foreach $1,$(notdir $(wildcard $2/*.h)),echo $(4:%=%/)$($1)$3)
+
+# Compile the testsuite, from autotest sources.
+#
+AUTOTEST_COMPILE = $(autotest_@AUTOTEST_COMPILE@)
+autotest_command = autom4te --language autotest --include ${srcdir}
+autotest_missing = $(call missing,autom4te,Unable to compile the testsuite)
+
+testsuite: %: %.at headers.at
+       $(AUTOTEST_COMPILE) -o $* $<
+
+# Display a diagnostic message, explaining that any specified program
+# is required, but has not been installed.
+#
+define missing
+$(warning The program '$1' does not appear to be installed.)
+$(call $1_description)$(error $2)
+endef
+
+# Describe the circumstances under which the autom4te program may be
+# required for building the testsuite, as an adjunct to the diagnostic
+# notification that it may need to be installed.
+#
+define autom4te_description
+$(info )
+$(info This program is used to compile the testsuite driver script, from)
+$(info original autotest source files.  You need it when you are building)
+$(info the testsuite from a checked-out clone of the source code repository;)
+$(info otherwise, you should need it only if you have modified any of those)
+$(info testsuite source files, or you have changed the package content in)
+$(info any way which may cause any of these files to be regenerated.)
+$(info )
+$(info If you do need it, you may obtain it by installing GNU autoconf.)
+$(info )
+endef
+
+# Install a local copy of the package components to be tested; we need
+# the full mingwrt package, and also the w32api headers, to ensure that
+# we are testing what we've built, and not those which were installed
+# with whatever compiler we are using for the build.
+#
+testsuite.install: install-mingwrt install-w32api-headers
+
+install-mingwrt:
+       $(MAKE) -C .. --no-print-directory prefix=${CURDIR} $@
+
+chkconfig = ($1/config.status --version | grep $2) 2>&1 > /dev/null
+install-w32api-headers:
+       @for dir in ../../w32api*; do \
+         if $(call chkconfig,$$dir,'MinGW Win32 API'); then \
+            $(MAKE) -C $$dir --no-print-directory prefix=${CURDIR} $@; break; \
+            fi; \
+         done
+
+# $RCSfile$: end of file
diff --git a/mingwrt/tests/atlocal.in b/mingwrt/tests/atlocal.in
new file mode 100644 (file)
index 0000000..7ee21d3
--- /dev/null
@@ -0,0 +1,45 @@
+# @autoconf_input@
+#
+# Autotest configuration template for MinGW.org Runtime Library Package
+#
+# $Id$
+#
+# Written by Keith Marshall <keithmarshall@users.sourceforge.net>
+# Copyright (C) 2016, MinGW.org Project
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+#
+#
+# Options we need to pass to the GCC compilers, to ensure that we will be
+# testing locally installed copies of our system headers and libraries, in
+# the testsuite directory, rather than those associated with the compilers
+# themselves.
+#
+at_compiler_config="-nostdinc -iwithprefixbefore include"
+at_package_includes="-I $at_top_build_prefix/../include"
+
+# Commands to invoke the C and C++ compilers, as identified during package
+# configuration.
+#
+at_compiler_cc="@CC@ $at_compiler_config $at_package_includes"
+at_compiler_cxx="@CXX@ $at_compiler_config $at_package_includes"
+
+# $RCSfile$: vim: set filetype=config: end of file
diff --git a/mingwrt/tests/headers.at b/mingwrt/tests/headers.at
new file mode 100644 (file)
index 0000000..206371f
--- /dev/null
@@ -0,0 +1,154 @@
+# headers.at
+#
+# Autotest module for checking integrity of MinGW runtime headers.
+# Each header is first individually compiled, to ensure that it is
+# both valid and self contained; all are then compiled together, to
+# verify mutual consistency.
+#
+# $Id$
+#
+# Written by Keith Marshall <keithmarshall@users.sourceforge.net>
+# Copyright (C) 2016, MinGW.org Project
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+#
+#
+# MINGWRT_AT_PACKAGE_HEADERS
+# --------------------------
+# Specify the gamut of package headers to be tested.  This list is updated
+# dynamically, when running "make check"; there is no need to edit it.
+#
+m4_define([MINGWRT_AT_PACKAGE_HEADERS],[dnl
+assert.h dnl
+complex.h dnl
+conio.h dnl
+ctype.h dnl
+direct.h dnl
+dirent.h dnl
+dir.h dnl
+dlfcn.h dnl
+dos.h dnl
+errno.h dnl
+excpt.h dnl
+fcntl.h dnl
+fenv.h dnl
+float.h dnl
+getopt.h dnl
+glob.h dnl
+inttypes.h dnl
+io.h dnl
+libgen.h dnl
+limits.h dnl
+locale.h dnl
+malloc.h dnl
+math.h dnl
+mbctype.h dnl
+mbstring.h dnl
+mem.h dnl
+memory.h dnl
+msvcrtver.h dnl
+process.h dnl
+search.h dnl
+setjmp.h dnl
+share.h dnl
+signal.h dnl
+stdint.h dnl
+stdio.h dnl
+stdlib.h dnl
+string.h dnl
+strings.h dnl
+tchar.h dnl
+time.h dnl
+unistd.h dnl
+utime.h dnl
+values.h dnl
+wchar.h dnl
+wctype.h dnl
+sys/fcntl.h dnl
+sys/file.h dnl
+sys/locking.h dnl
+sys/param.h dnl
+sys/stat.h dnl
+sys/timeb.h dnl
+sys/time.h dnl
+sys/types.h dnl
+sys/unistd.h dnl
+sys/utime.h dnl
+])# MINGWRT_AT_PACKAGE_HEADERS
+
+# MINGWRT_AT_HASH_INCLUDE( HEADER )
+# ---------------------------------
+# Emit a single "#include <HEADER>" statement into a generated
+# program language source file.
+#
+m4_define([MINGWRT_AT_HASH_INCLUDE],dnl
+[[#include <$1>
+]])# MINGWRT_AT_HASH_INCLUDE
+
+# MINGWRT_AT_CHECK_HEADERS_STANDALONE( LANG )
+# -------------------------------------------
+# Check compilability and self-containment of all package headers,
+# when each is compiled individually, using the LANG compiler.
+#
+m4_define([MINGWRT_AT_CHECK_HEADERS_STANDALONE],[MINGW_AT_LANG([$1])dnl
+AT_BANNER([Header integrity checks: stand-alone compile; language = $1.])
+m4_foreach_w([HEADER],MINGWRT_AT_PACKAGE_HEADERS,[dnl
+AT_SETUP([#include <]HEADER[>])AT_KEYWORDS([$1 $1-headers])
+AS_VAR_APPEND([CPPFLAGS],[" -Wall -Wextra -Wsystem-headers"])
+m4_if(HEADER,[unistd.h],AS_VAR_APPEND([CPPFLAGS],[" -Wno-deprecated-declarations"]))
+m4_if(HEADER,[sys/stat.h],AS_VAR_APPEND([CPPFLAGS],[" -D_MINGW_S_IFBLK_KLUDGE"]))
+MINGW_AT_CHECK_COMPILE([dnl
+#define __IN_MINGWRT_TESTSUITE__ 1
+m4_if(HEADER,[values.h],MINGWRT_AT_HASH_INCLUDE([_mingw.h]))dnl
+MINGWRT_AT_HASH_INCLUDE(HEADER)dnl
+int main(){ return __MINGW32_MAJOR_VERSION; }])
+AT_CLEANUP
+])])# MINGWRT_AT_CHECK_HEADERS_STANDALONE
+#
+# Run it, for each of LANG = C and LANG = C++
+#
+m4_foreach([LANG],[C,C++],[MINGWRT_AT_CHECK_HEADERS_STANDALONE(LANG)])
+
+# MINGWRT_AT_CHECK_HEADERS_COMBINED( LANG )
+# -----------------------------------------
+# Check compilability of package headers, when all are included within
+# a single translation unit, and compiled using the LANG compiler.
+#
+m4_define([MINGWRT_AT_CHECK_HEADERS_COMBINED],[MINGW_AT_LANG([$1])dnl
+AT_SETUP([#include all; language = $1])AT_KEYWORDS([$1 $1-headers])
+AS_VAR_APPEND([CPPFLAGS],[" -Wall -Wextra -Wsystem-headers"])
+m4_if([$1],[C],AS_VAR_APPEND([CPPFLAGS],[" -Wno-deprecated-declarations"]))
+MINGW_AT_CHECK_COMPILE([dnl
+#define _MINGW_S_IFBLK_KLUDGE 1
+#define __IN_MINGWRT_TESTSUITE__ 1
+m4_foreach_w([HEADER],MINGWRT_AT_PACKAGE_HEADERS,[dnl
+MINGWRT_AT_HASH_INCLUDE(HEADER)])
+int main(){ return __MINGW32_MAJOR_VERSION; }])
+AT_CLEANUP
+])# MINGWRT_AT_CHECK_HEADERS_COMBINED
+#
+# Run it, for each of LANG = C and LANG = C++
+#
+AT_BANNER([Header consistency checks: composite compile.])
+m4_foreach([LANG],[C,C++],[MINGWRT_AT_CHECK_HEADERS_COMBINED(LANG)])
+
+# vim: filetype=config formatoptions=croql
+# $RCSfile$: end of file
diff --git a/mingwrt/tests/testsuite.at.in b/mingwrt/tests/testsuite.at.in
new file mode 100644 (file)
index 0000000..527b21d
--- /dev/null
@@ -0,0 +1,92 @@
+# @configure_input@
+#
+# Top level autotest module for instantiation of the mingwrt testsuite.
+#
+m4_define([AT_PACKAGE_STRING],[@PACKAGE_STRING@])
+m4_define([AT_PACKAGE_BUGREPORT],[@PACKAGE_BUGREPORT@])
+#
+# $Id$
+#
+# Written by Keith Marshall <keithmarshall@users.sourceforge.net>
+# Copyright (C) 2016, MinGW.org Project
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+
+
+# MINGW_AT_LANG( [LANGUAGE = C] )
+# -------------------------------
+# Select to programming language compiler which is to be used
+# when compiling subsequent program fragments, as specified in
+# MINGW_AT_CHECK_COMPILE or MINGW_AT_CHECK_RUN tests.
+#
+m4_define([MINGW_AT_LANG],[m4_if([$1],[C++],dnl
+[m4_define([at_lang_compile],[$at_compiler_cxx $CPPFLAGS $CFLAGS])]dnl
+[m4_define([at_lang_source],[at_source.cpp])],dnl
+[m4_define([at_lang_compile],[$at_compiler_cc $CPPFLAGS $CFLAGS])]dnl
+[m4_define([at_lang_source],[at_source.c])])dnl
+])# MINGW_AT_LANG
+
+# MINGW_AT_CHECK_COMPILE( SOURCE )
+# --------------------------------
+# Check that the SOURCE program fragment is compilable, using the
+# compiler appropriate to the currently selected source language;
+# the compiler is expected to complete with zero exit status, and
+# to have written nothing to either STDOUT or STDERR.
+#
+m4_define([MINGW_AT_CHECK_COMPILE],[AT_DATA([at_lang_source],$1
+) AT_CHECK([at_lang_compile -c at_lang_source -o /dev/null])
+])# MINGW_AT_CHECK_COMPILE
+
+# MINGW_AT_CHECK_RUN( SOURCE, [STATUS = 0], [STDOUT], [STDERR] )
+# --------------------------------------------------------------
+# Check that the SOURCE program fragment is both compilable, using
+# the compiler appropriate to the currently selected source language,
+# and may then be executed to exit with STATUS, and with output as
+# specified to each of STDOUT and STDERR.
+#
+m4_define([MINGW_AT_CHECK_RUN],[AT_DATA([at_lang_source],$1
+) AT_CHECK([at_lang_compile at_lang_source -o at_prog.exe -L../../lib])
+AT_CHECK([./at_prog.exe],[$2],[$3],[$4])
+])# MINGW_AT_CHECK_RUN
+
+# MINGW_AT_DATA_CRLF( FILENAME, TEXT )
+# ------------------------------------
+# Construct reference data file FILENAME, with content as specified
+# by TEXT, (which may comprise multiple lines), ensuring that each
+# line of TEXT is terminated according to the CRLF convention.
+#
+m4_define([MINGW_AT_DATA_CRLF],[AT_DATA([$1],[$2])
+AT_CHECK([awk '{sub("\r$",""); printf "%s\r\n", $][0}' $1],,[stdout])
+m4_if([$1],[stdout],,AT_CHECK([mv stdout $1]))dnl
+])# MINGW_AT_DATA_CRLF
+
+# Initialize autotest, and select C as default programming language.
+#
+AT_INIT
+MINGW_AT_LANG([C])
+
+# Individual test groups are specified separately, via the following
+# collection of autotest M4 include files.
+#
+m4_include([headers.at])
+
+# vim: filetype=config formatoptions=croql
+# $RCSfile$: end of file