Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
On TravisCI (and most likely other systems), `AC_CHECK_HEADER_STDBOOL` is not (yet) available. This commit adds a copy of the macro in the m4 include folder. See: 23346de
- Loading branch information
Showing
1 changed file
with
102 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
# This file is part of Autoconf. -*- Autoconf -*- | ||
# Checking for headers. | ||
# | ||
# Copyright (C) 1988, 1999-2004, 2006, 2008-2012 Free Software | ||
# Foundation, Inc. | ||
|
||
# This file is part of Autoconf. This program is free | ||
# software; you can redistribute it and/or modify it under the | ||
# terms of the GNU General Public License as published by the | ||
# Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# Under Section 7 of GPL version 3, you are granted additional | ||
# permissions described in the Autoconf Configure Script Exception, | ||
# version 3.0, as published by the Free Software Foundation. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# and a copy of the Autoconf Configure Script Exception along with | ||
# this program; see the files COPYINGv3 and COPYING.EXCEPTION | ||
# respectively. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
# Written by David MacKenzie, with help from | ||
# Franc,ois Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor, | ||
# Roland McGrath, Noah Friedman, david d zuhn, and many others. | ||
|
||
# Copied from /usr/share/autoconf/autoconf/headers.m4 on a Fedora 20 system, | ||
# autoconf-2.69-14.fc20 | ||
|
||
# AC_CHECK_HEADER_STDBOOL | ||
# ----------------- | ||
# Check for stdbool.h that conforms to C99. | ||
AN_IDENTIFIER([bool], [AC_CHECK_HEADER_STDBOOL]) | ||
AN_IDENTIFIER([true], [AC_CHECK_HEADER_STDBOOL]) | ||
AN_IDENTIFIER([false],[AC_CHECK_HEADER_STDBOOL]) | ||
AC_DEFUN([AC_CHECK_HEADER_STDBOOL], | ||
[AC_CACHE_CHECK([for stdbool.h that conforms to C99], | ||
[ac_cv_header_stdbool_h], | ||
[AC_COMPILE_IFELSE( | ||
[AC_LANG_PROGRAM( | ||
[[ | ||
#include <stdbool.h> | ||
#ifndef bool | ||
"error: bool is not defined" | ||
#endif | ||
#ifndef false | ||
"error: false is not defined" | ||
#endif | ||
#if false | ||
"error: false is not 0" | ||
#endif | ||
#ifndef true | ||
"error: true is not defined" | ||
#endif | ||
#if true != 1 | ||
"error: true is not 1" | ||
#endif | ||
#ifndef __bool_true_false_are_defined | ||
"error: __bool_true_false_are_defined is not defined" | ||
#endif | ||
struct s { _Bool s: 1; _Bool t; } s; | ||
char a[true == 1 ? 1 : -1]; | ||
char b[false == 0 ? 1 : -1]; | ||
char c[__bool_true_false_are_defined == 1 ? 1 : -1]; | ||
char d[(bool) 0.5 == true ? 1 : -1]; | ||
/* See body of main program for 'e'. */ | ||
char f[(_Bool) 0.0 == false ? 1 : -1]; | ||
char g[true]; | ||
char h[sizeof (_Bool)]; | ||
char i[sizeof s.t]; | ||
enum { j = false, k = true, l = false * true, m = true * 256 }; | ||
/* The following fails for | ||
HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */ | ||
_Bool n[m]; | ||
char o[sizeof n == m * sizeof n[0] ? 1 : -1]; | ||
char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; | ||
/* Catch a bug in an HP-UX C compiler. See | ||
http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html | ||
http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html | ||
*/ | ||
_Bool q = true; | ||
_Bool *pq = &q; | ||
]], | ||
[[ | ||
bool e = &s; | ||
*pq |= q; | ||
*pq |= ! q; | ||
/* Refer to every declared value, to avoid compiler optimizations. */ | ||
return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l | ||
+ !m + !n + !o + !p + !q + !pq); | ||
]])], | ||
[ac_cv_header_stdbool_h=yes], | ||
[ac_cv_header_stdbool_h=no])]) | ||
AC_CHECK_TYPES([_Bool]) | ||
])# AC_CHECK_HEADER_STDBOOL | ||
|