1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174
|
# Copyright (C) Igor Sysoev
# Copyright (C) NGINX, Inc.
# Sizes of C types.
# "-Wall -Werror" or similar constraints in default CFLAGS may require
# to use "%zu" format to printf() result of sizeof(). But "%zu" may
# be unavailable, so the "(int)" cast is a simple and portable solution:
# printf("%d", (int) sizeof(TYPE));
njs_feature="sizeof(int)"
njs_feature_name=NJS_INT_SIZE
njs_feature_run=value
njs_feature_incs=
njs_feature_libs=
njs_feature_test="#include <stdio.h>
int main() {
printf(\"%d\", (int) sizeof(int));
return 0;
}"
. auto/feature
njs_feature="sizeof(u_int)"
njs_feature_name=NJS_UINT_SIZE
njs_feature_run=value
njs_feature_incs=
njs_feature_libs=
njs_feature_test="#include <sys/types.h>
#include <stdio.h>
int main() {
printf(\"%d\", (int) sizeof(u_int));
return 0;
}"
. auto/feature
njs_feature="sizeof(void *)"
njs_feature_name=NJS_PTR_SIZE
njs_feature_run=value
njs_feature_incs=
njs_feature_libs=
njs_feature_test="#include <stdio.h>
int main() {
printf(\"%d\", (int) sizeof(void *));
return 0;
}"
. auto/feature
njs_feature="sizeof(uintptr_t)"
njs_feature_name=NJS_UINTPTR_T_SIZE
njs_feature_run=value
njs_feature_incs=
njs_feature_libs=
njs_feature_test="#include <stdint.h>
#include <stdio.h>
int main() {
printf(\"%d\", (int) sizeof(uintptr_t));
return 0;
}"
. auto/feature
case "$njs_feature_value" in
8) NJS_64BIT=1 ;;
*) NJS_64BIT=0 ;;
esac
njs_feature="sizeof(size_t)"
njs_feature_name=NJS_SIZE_T_SIZE
njs_feature_run=value
njs_feature_incs=
njs_feature_libs=
njs_feature_test="#include <stdio.h>
int main() {
printf(\"%d\", (int) sizeof(size_t));
return 0;
}"
. auto/feature
njs_feature="sizeof(off_t)"
njs_feature_name=NJS_OFF_T_SIZE
njs_feature_run=value
njs_feature_incs=
njs_feature_libs=
njs_feature_test="#define _FILE_OFFSET_BITS 64
#include <unistd.h>
#include <stdio.h>
int main() {
printf(\"%d\", (int) sizeof(off_t));
return 0;
}"
. auto/feature
njs_feature="sizeof(time_t)"
njs_feature_name=NJS_TIME_T_SIZE
njs_feature_run=value
njs_feature_incs=
njs_feature_libs=
njs_feature_test="#include <time.h>
#include <stdio.h>
int main(void) {
printf(\"%d\", (int) sizeof(time_t));
return 0;
}"
. auto/feature
# Ensuring that double type is always evaluated at standard
# precision required by njs_diyfp_t
case $NJS_CC_NAME in
gcc)
NJS_CFLAGS="$NJS_CFLAGS -fexcess-precision=standard"
;;
clang)
njs_found=no
njs_feature="flag -ffp-eval-method=double"
njs_feature_name=NJS_HAVE_FP_EVAL_METHOD
njs_feature_run=no
njs_feature_incs="-ffp-eval-method=double"
njs_feature_libs=
njs_feature_test="int main(void) {
return 0;
}"
. auto/feature
if [ $njs_found = yes ]; then
NJS_CFLAGS="$NJS_CFLAGS -ffp-eval-method=double"
fi
;;
SunC)
njs_found=no
njs_feature="flag -xarch=sse2"
njs_feature_name=NJS_HAVE_XARCH_SSE2
njs_feature_run=no
njs_feature_incs="-xarch=sse2"
njs_feature_libs=
njs_feature_test="int main(void) {
return 0;
}"
. auto/feature
if [ $njs_found = yes ]; then
NJS_CFLAGS="$NJS_CFLAGS -xarch=sse2"
fi
;;
esac
|