blob: 53e6c6a35cfac78b24868f13cc34f45d48694d0c [file] [log] [blame]
cristy3ed852e2009-09-05 21:47:34 +00001dnl @synopsis AC_CXX_HAVE_BOOL
2dnl
3dnl If the compiler recognizes bool as a separate built-in type, define
4dnl HAVE_BOOL. Note that a typedef is not a separate type since you
5dnl cannot overload a function such that it accepts either the basic
6dnl type or the typedef.
7dnl
8dnl @category Cxx
9dnl @author Todd Veldhuizen
10dnl @author Luc Maisonobe <luc@spaceroots.org>
11dnl @version 2004-02-04
12dnl @license AllPermissive
13
14AC_DEFUN([AC_CXX_HAVE_BOOL],
15[AC_CACHE_CHECK(whether the compiler recognizes bool as a built-in type,
16ac_cv_cxx_have_bool,
17[AC_LANG_SAVE
18 AC_LANG_CPLUSPLUS
19 AC_TRY_COMPILE([
20int f(int x){return 1;}
21int f(char x){return 1;}
22int f(bool x){return 1;}
23],[bool b = true; return f(b);],
24 ac_cv_cxx_have_bool=yes, ac_cv_cxx_have_bool=no)
25 AC_LANG_RESTORE
26])
27if test "$ac_cv_cxx_have_bool" = yes; then
28 AC_DEFINE(HAVE_BOOL,,[define if bool is a built-in type])
29fi
30])