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