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 defined"
35 #ifndef __bool_true_false_are_defined
36 "error: __bool_true_false_are_defined is not defined"
39 struct s { _Bool s: 1; _Bool t; } s;
41 char a[true == 1 ? 1 : -1];
42 char b[false == 0 ? 1 : -1];
43 char c[__bool_true_false_are_defined == 1 ? 1 : -1];
44 char d[(bool) -0.5 == true ? 1 : -1];
45 char e[(bool) &s == true ? 1 : -1];
46 char f[(_Bool) -0.0 == false ? 1 : -1];
48 char h[sizeof (_Bool)];
51 [ return !a + !b + !c + !d + !e + !f + !g + !h + !i; ],
52 [ac_cv_header_stdbool_h=yes],
53 [ac_cv_header_stdbool_h=no])])
54 if test $ac_cv_header_stdbool_h = yes; then
55 AC_DEFINE(HAVE_STDBOOL_H, 1, [Define to 1 if stdbool.h conforms to C99.])