1 # Check for stdbool.h that conforms to C99.
3 # Copyright (C) 2002 Free Software Foundation, Inc.
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2, or (at your option)
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
20 AC_DEFUN([AC_HEADER_STDBOOL],
21 [AC_CACHE_CHECK([for stdbool.h that conforms to C99],
22 [ac_cv_header_stdbool_h],
27 "error: bool is not defined"
30 "error: false is not defined"
33 "error: false is not 0"
36 "error: false is not defined"
39 "error: true is not 1"
41 #ifndef __bool_true_false_are_defined
42 "error: __bool_true_false_are_defined is not defined"
45 struct s { _Bool s: 1; _Bool t; } s;
47 char a[true == 1 ? 1 : -1];
48 char b[false == 0 ? 1 : -1];
49 char c[__bool_true_false_are_defined == 1 ? 1 : -1];
50 char d[(bool) -0.5 == true ? 1 : -1];
52 char f[(_Bool) -0.0 == false ? 1 : -1];
54 char h[sizeof (_Bool)];
57 [ return !a + !b + !c + !d + !e + !f + !g + !h + !i; ],
58 [ac_cv_header_stdbool_h=yes],
59 [ac_cv_header_stdbool_h=no])])
60 if test $ac_cv_header_stdbool_h = yes; then
61 AC_DEFINE(HAVE_STDBOOL_H, 1, [Define to 1 if stdbool.h conforms to C99.])