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