This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Use a real compile to test for stdbool.h.
[metaconfig.git] / U / perl / i_stdbool.U
CommitLineData
19d22ecf
MB
1?RCS: $Id: i_stdbool.U,v $
2?RCS:
3?RCS: Copyright (c) 2011 H.Merijn Brand
4?RCS:
5?RCS: You may distribute under the terms of either the GNU General Public
6?RCS: License or the Artistic License, as specified in the README file.
7?RCS:
e4f95ab0 8?MAKE:i_stdbool: cat Compile rm_try Setvar
19d22ecf
MB
9?MAKE: -pick add $@ %<
10?S:i_stdbool:
11?S: This variable conditionally defines the I_STDBOOL symbol, which
12?S: indicates to the C program that <stdbool.h> exists and should
13?S: be included.
14?S:.
15?C:I_STDBOOL:
16?C: This symbol, if defined, indicates that <stdbool.h> exists and
17?C: can be included.
18?C:.
19?H:#$i_stdbool I_STDBOOL /**/
20?H:.
21?LINT:set i_stdbool
22: see if stdbool is available
e4f95ab0
AD
23: we want a real compile instead of Inhdr because some Solaris systems
24: have stdbool.h, but it can only be used if the compiler indicates it
25: is sufficiently c99-compliant.
26echo " "
27$cat >try.c <<EOCP
28#include <stdio.h>
29#include <stdbool.h>
30int func(bool x)
31{
32 return x ? 1 : 0;
33}
34int main(int argc, char **argv)
35{
36 return func(0);
37}
38EOCP
39set try
40if eval $compile; then
41 echo "<stdbool.h> found." >&4
42 val="$define"
43else
44 echo "<stdbool.h> NOT found." >&4
45 val="$undef"
46fi
47$rm_try
48set i_stdbool
49eval $setvar
19d22ecf 50