xref: /unit/auto/types (revision 0:a63ceefd6ab0)
1*0Sigor@sysoev.ru
2*0Sigor@sysoev.ru# Copyright (C) Igor Sysoev
3*0Sigor@sysoev.ru# Copyright (C) NGINX, Inc.
4*0Sigor@sysoev.ru
5*0Sigor@sysoev.ru
6*0Sigor@sysoev.ru# Sizes of C types.
7*0Sigor@sysoev.ru
8*0Sigor@sysoev.ru# "-Wall -Werror" or similar constraints in default CFLAGS may require
9*0Sigor@sysoev.ru# to use "%zu" format to printf() result of sizeof().  But "%zu" may
10*0Sigor@sysoev.ru# be unavailable, so the "(int)" cast is a simple and portable solution:
11*0Sigor@sysoev.ru#     printf("%d", (int) sizeof(TYPE));
12*0Sigor@sysoev.ru
13*0Sigor@sysoev.ru
14*0Sigor@sysoev.runxt_feature="int size"
15*0Sigor@sysoev.runxt_feature_name=NXT_INT_SIZE
16*0Sigor@sysoev.runxt_feature_run=value
17*0Sigor@sysoev.runxt_feature_incs=
18*0Sigor@sysoev.runxt_feature_libs=
19*0Sigor@sysoev.runxt_feature_test="#include <stdio.h>
20*0Sigor@sysoev.ru
21*0Sigor@sysoev.ru                  int main() {
22*0Sigor@sysoev.ru                      printf(\"%d\", (int) sizeof(int));
23*0Sigor@sysoev.ru                      return 0;
24*0Sigor@sysoev.ru                  }"
25*0Sigor@sysoev.ru. auto/feature
26*0Sigor@sysoev.ru
27*0Sigor@sysoev.ru
28*0Sigor@sysoev.runxt_feature="long size"
29*0Sigor@sysoev.runxt_feature_name=NXT_LONG_SIZE
30*0Sigor@sysoev.runxt_feature_run=value
31*0Sigor@sysoev.runxt_feature_incs=
32*0Sigor@sysoev.runxt_feature_libs=
33*0Sigor@sysoev.runxt_feature_test="#include <stdio.h>
34*0Sigor@sysoev.ru
35*0Sigor@sysoev.ru                  int main() {
36*0Sigor@sysoev.ru                      printf(\"%d\", (int) sizeof(long));
37*0Sigor@sysoev.ru                      return 0;
38*0Sigor@sysoev.ru                  }"
39*0Sigor@sysoev.ru. auto/feature
40*0Sigor@sysoev.ru
41*0Sigor@sysoev.ru
42*0Sigor@sysoev.runxt_feature="long long size"
43*0Sigor@sysoev.runxt_feature_name=NXT_LONG_LONG_SIZE
44*0Sigor@sysoev.runxt_feature_run=value
45*0Sigor@sysoev.runxt_feature_incs=
46*0Sigor@sysoev.runxt_feature_libs=
47*0Sigor@sysoev.runxt_feature_test="#include <stdio.h>
48*0Sigor@sysoev.ru
49*0Sigor@sysoev.ru                  int main() {
50*0Sigor@sysoev.ru                      printf(\"%d\", (int) sizeof(long long));
51*0Sigor@sysoev.ru                      return 0;
52*0Sigor@sysoev.ru                  }"
53*0Sigor@sysoev.ru. auto/feature
54*0Sigor@sysoev.ru
55*0Sigor@sysoev.ru
56*0Sigor@sysoev.runxt_feature="void * size"
57*0Sigor@sysoev.runxt_feature_name=NXT_PTR_SIZE
58*0Sigor@sysoev.runxt_feature_run=value
59*0Sigor@sysoev.runxt_feature_incs=
60*0Sigor@sysoev.runxt_feature_libs=
61*0Sigor@sysoev.runxt_feature_test="#include <stdio.h>
62*0Sigor@sysoev.ru
63*0Sigor@sysoev.ru                  int main() {
64*0Sigor@sysoev.ru                      printf(\"%d\", (int) sizeof(void *));
65*0Sigor@sysoev.ru                      return 0;
66*0Sigor@sysoev.ru                  }"
67*0Sigor@sysoev.ru. auto/feature
68*0Sigor@sysoev.ru
69*0Sigor@sysoev.ru
70*0Sigor@sysoev.rucase "$nxt_feature_value" in
71*0Sigor@sysoev.ru    8) NXT_64BIT=1 ;;
72*0Sigor@sysoev.ru    *) NXT_64BIT=0 ;;
73*0Sigor@sysoev.ruesac
74*0Sigor@sysoev.ru
75*0Sigor@sysoev.ru
76*0Sigor@sysoev.runxt_feature="size_t size"
77*0Sigor@sysoev.runxt_feature_name=NXT_SIZE_T_SIZE
78*0Sigor@sysoev.runxt_feature_run=value
79*0Sigor@sysoev.runxt_feature_incs=
80*0Sigor@sysoev.runxt_feature_libs=
81*0Sigor@sysoev.runxt_feature_test="#include <stdio.h>
82*0Sigor@sysoev.ru
83*0Sigor@sysoev.ru                  int main() {
84*0Sigor@sysoev.ru                      printf(\"%d\", (int) sizeof(size_t));
85*0Sigor@sysoev.ru                      return 0;
86*0Sigor@sysoev.ru                  }"
87*0Sigor@sysoev.ru. auto/feature
88*0Sigor@sysoev.ru
89*0Sigor@sysoev.ru
90*0Sigor@sysoev.runxt_feature="off_t size"
91*0Sigor@sysoev.runxt_feature_name=NXT_OFF_T_SIZE
92*0Sigor@sysoev.runxt_feature_run=value
93*0Sigor@sysoev.runxt_feature_incs=
94*0Sigor@sysoev.runxt_feature_libs=
95*0Sigor@sysoev.runxt_feature_test="#define _FILE_OFFSET_BITS  64
96*0Sigor@sysoev.ru                  #include <unistd.h>
97*0Sigor@sysoev.ru                  #include <stdio.h>
98*0Sigor@sysoev.ru
99*0Sigor@sysoev.ru                  int main() {
100*0Sigor@sysoev.ru                      printf(\"%d\", (int) sizeof(off_t));
101*0Sigor@sysoev.ru                      return 0;
102*0Sigor@sysoev.ru                  }"
103*0Sigor@sysoev.ru. auto/feature
104*0Sigor@sysoev.ru
105*0Sigor@sysoev.ru
106*0Sigor@sysoev.runxt_feature="time_t size"
107*0Sigor@sysoev.runxt_feature_name=NXT_TIME_T_SIZE
108*0Sigor@sysoev.runxt_feature_run=value
109*0Sigor@sysoev.runxt_feature_incs=
110*0Sigor@sysoev.runxt_feature_libs=
111*0Sigor@sysoev.runxt_feature_test="#include <time.h>
112*0Sigor@sysoev.ru                  #include <stdio.h>
113*0Sigor@sysoev.ru
114*0Sigor@sysoev.ru                  int main() {
115*0Sigor@sysoev.ru                      printf(\"%d\", (int) sizeof(time_t));
116*0Sigor@sysoev.ru                      return 0;
117*0Sigor@sysoev.ru                  }"
118*0Sigor@sysoev.ru. auto/feature
119