summaryrefslogtreecommitdiffstats
path: root/m4/stdbool.m4
blob: 281e8dc0c4f7d02f83b5c4de2116919afaf78675 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
dnl serial 1

dnl From Bruno Haible.
dnl Test whether <stdbool.h> is supported or must be substituted.

AC_DEFUN([gt_STDBOOL_H],
[dnl gcc 2.95.2 has an <stdbool.h> for which both 'true' and 'false' evaluate
dnl to 0 in preprocessor expressions.
AC_MSG_CHECKING([for stdbool.h])
AC_CACHE_VAL(gt_cv_header_stdbool_h, [
  AC_TRY_COMPILE([#include <stdbool.h>
#if false
int A[-1];
#endif
#define b -1
#if true
#undef b
#define b 1
#endif
int B[b];
], [], gt_cv_header_stdbool_h=yes, gt_cv_header_stdbool_h=no)])
AC_MSG_RESULT([$gt_cv_header_stdbool_h])
if test $gt_cv_header_stdbool_h = yes; then
  AC_DEFINE(HAVE_STDBOOL_H, 1,
            [Define if you have a working <stdbool.h> header file.])
  STDBOOL_H=''
else
  STDBOOL_H='stdbool.h'
fi
AC_SUBST(STDBOOL_H)
])