Commit | Line | Data |
---|---|---|
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: | |
a814b14a | 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 | |
a814b14a 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. | |
26 | echo " " | |
27 | $cat >try.c <<EOCP | |
28 | #include <stdio.h> | |
29 | #include <stdbool.h> | |
30 | int func(bool x) | |
31 | { | |
32 | return x ? 1 : 0; | |
33 | } | |
34 | int main(int argc, char **argv) | |
35 | { | |
36 | return func(0); | |
37 | } | |
38 | EOCP | |
39 | set try | |
40 | if eval $compile; then | |
41 | echo "<stdbool.h> found." >&4 | |
42 | val="$define" | |
43 | else | |
44 | echo "<stdbool.h> NOT found." >&4 | |
45 | val="$undef" | |
46 | fi | |
47 | $rm_try | |
48 | set i_stdbool | |
49 | eval $setvar | |
19d22ecf | 50 |