]> git.ipfire.org Git - thirdparty/autoconf.git/commit
Disentangle HAVE__BOOL from ac_cv_header_stdbool_h.
authorZack Weinberg <zackw@panix.com>
Sat, 28 Nov 2020 16:08:28 +0000 (11:08 -0500)
committerZack Weinberg <zackw@panix.com>
Mon, 30 Nov 2020 16:45:25 +0000 (11:45 -0500)
commit9886b7a922fd90cc86b19106293250da652256aa
tree0f4676ef669f086ce9c5830545775c4c101a50e9
parentd81861ed01ffb50ab9f0b5ceab3f4df70510d531
Disentangle HAVE__BOOL from ac_cv_header_stdbool_h.

AC_CHECK_HEADER_STDBOOL is documented to make two checks: whether the
C99 header <stdbool.h> is available and fulfills its
specification (i.e. including it makes the type ‘bool’ and the
constants ‘true’ and ‘false’ available), and, independently, whether
the type ‘_Bool’ is available.

In C++, the type ‘_Bool’ is usually _not_ available, but <stdbool.h>
is still supposed to be include-able and the type ‘bool’ and the
constants ‘true’ and ‘false’ are still supposed to be available
(unconditionally).  However, the test for <stdbool.h> fulfilling its
specification freely used _Bool, and would therefore fail spuriously.
Correct this by checking for _Bool first, and then refactoring the
test program for <stdbool.h> so that it does all its tests using bool,
then repeats them with _Bool only when available.

* lib/autoconf/headers.m4 (AC_CHECK_HEADER_STDBOOL): Do the test for
  _Bool before the test for stdbool.h.  Test semantics of bool
  unconditionally; test _Bool only when HAVE__BOOL is defined.
lib/autoconf/headers.m4