3 # Autotest module for checking integrity of MinGW runtime headers.
4 # Each header is first individually compiled, to ensure that it is
5 # both valid and self contained; all are then compiled together, to
6 # verify mutual consistency.
10 # Written by Keith Marshall <keithmarshall@users.sourceforge.net>
11 # Copyright (C) 2016, MinGW.org Project
14 # Permission is hereby granted, free of charge, to any person obtaining a
15 # copy of this software and associated documentation files (the "Software"),
16 # to deal in the Software without restriction, including without limitation
17 # the rights to use, copy, modify, merge, publish, distribute, sublicense,
18 # and/or sell copies of the Software, and to permit persons to whom the
19 # Software is furnished to do so, subject to the following conditions:
21 # The above copyright notice and this permission notice (including the next
22 # paragraph) shall be included in all copies or substantial portions of the
25 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
26 # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
27 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
28 # AUTHORS OR THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
29 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
30 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
31 # DEALINGS IN THE SOFTWARE.
34 # MINGWRT_AT_PACKAGE_HEADERS
35 # --------------------------
36 # Specify the gamut of package headers to be tested. This list is updated
37 # dynamically, when running "make check"; there is no need to edit it.
39 m4_define([MINGWRT_AT_PACKAGE_HEADERS],[dnl
96 ])# MINGWRT_AT_PACKAGE_HEADERS
98 # MINGWRT_AT_HASH_INCLUDE( HEADER )
99 # ---------------------------------
100 # Emit a single "#include <HEADER>" statement into a generated
101 # program language source file.
103 m4_define([MINGWRT_AT_HASH_INCLUDE],dnl
105 ]])# MINGWRT_AT_HASH_INCLUDE
107 # MINGWRT_AT_CHECK_HEADERS_STANDALONE( LANG )
108 # -------------------------------------------
109 # Check compilability and self-containment of all package headers,
110 # when each is compiled individually, using the LANG compiler.
112 m4_define([MINGWRT_AT_CHECK_HEADERS_STANDALONE],[MINGW_AT_LANG([$1])dnl
113 AT_BANNER([Header integrity checks: stand-alone compile; language = $1.])
114 m4_foreach_w([HEADER],MINGWRT_AT_PACKAGE_HEADERS,[dnl
115 AT_SETUP([#include <]HEADER[>])AT_KEYWORDS([$1 $1-headers])
116 AS_VAR_APPEND([CPPFLAGS],[" -Wall -Wextra -Wsystem-headers"])
117 m4_if(HEADER,[unistd.h],AS_VAR_APPEND([CPPFLAGS],[" -Wno-deprecated-declarations"]))
118 m4_if(HEADER,[sys/stat.h],AS_VAR_APPEND([CPPFLAGS],[" -D_MINGW_S_IFBLK_KLUDGE"]))
119 MINGW_AT_CHECK_COMPILE([dnl
120 #define __IN_MINGWRT_TESTSUITE__ 1
121 m4_if(HEADER,[values.h],MINGWRT_AT_HASH_INCLUDE([_mingw.h]))dnl
122 MINGWRT_AT_HASH_INCLUDE(HEADER)dnl
123 int main(){ return __MINGW32_MAJOR_VERSION; }])
125 ])])# MINGWRT_AT_CHECK_HEADERS_STANDALONE
127 # Run it, for each of LANG = C and LANG = C++
129 m4_foreach([LANG],[C,C++],[MINGWRT_AT_CHECK_HEADERS_STANDALONE(LANG)])
131 # MINGWRT_AT_CHECK_HEADERS_COMBINED( LANG )
132 # -----------------------------------------
133 # Check compilability of package headers, when all are included within
134 # a single translation unit, and compiled using the LANG compiler.
136 m4_define([MINGWRT_AT_CHECK_HEADERS_COMBINED],[MINGW_AT_LANG([$1])dnl
137 AT_SETUP([#include all; language = $1])AT_KEYWORDS([$1 $1-headers])
138 AS_VAR_APPEND([CPPFLAGS],[" -Wall -Wextra -Wsystem-headers"])
139 m4_if([$1],[C],AS_VAR_APPEND([CPPFLAGS],[" -Wno-deprecated-declarations"]))
140 MINGW_AT_CHECK_COMPILE([dnl
141 #define _MINGW_S_IFBLK_KLUDGE 1
142 #define __IN_MINGWRT_TESTSUITE__ 1
143 m4_foreach_w([HEADER],MINGWRT_AT_PACKAGE_HEADERS,[dnl
144 MINGWRT_AT_HASH_INCLUDE(HEADER)])
145 int main(){ return __MINGW32_MAJOR_VERSION; }])
147 ])# MINGWRT_AT_CHECK_HEADERS_COMBINED
149 # Run it, for each of LANG = C and LANG = C++
151 AT_BANNER([Header consistency checks: composite compile.])
152 m4_foreach([LANG],[C,C++],[MINGWRT_AT_CHECK_HEADERS_COMBINED(LANG)])
154 # vim: filetype=config formatoptions=croql
155 # $RCSfile$: end of file