From c02473048cee372cb8644e1f2d566431781074d2 Mon Sep 17 00:00:00 2001 From: Igor Sysoev Date: Sun, 27 Jun 2004 18:01:57 +0000 Subject: nginx-0.0.7-2004-06-27-22:01:57 import --- auto/endianess | 38 ++++++++++++++++++++++++++++++++++++++ auto/fmt/fmt | 10 +++++----- auto/fmt/ptrfmt | 10 +++++----- auto/types/maxvalue | 6 ------ auto/types/sizeof | 23 ++++++++++++++--------- auto/types/typedef | 2 +- auto/types/uintptr_t | 2 +- auto/types/value | 6 ++++++ auto/unix | 37 +++++++++++++++++++------------------ 9 files changed, 89 insertions(+), 45 deletions(-) create mode 100644 auto/endianess delete mode 100644 auto/types/maxvalue create mode 100644 auto/types/value (limited to 'auto') diff --git a/auto/endianess b/auto/endianess new file mode 100644 index 000000000..fb9e25547 --- /dev/null +++ b/auto/endianess @@ -0,0 +1,38 @@ + +echo $ngx_n "checking for system endianess ..." $ngx_c +echo >> $NGX_ERR +echo "checking for system endianess" >> $NGX_ERR + + +cat << END > $NGX_AUTOTEST.c + +int main() { + int i = 0x11223344; + char *p; + + p = (char *) &i; + if (*p == 0x44) return 0; + return 1; +} + +END + +eval "${CC} -o $NGX_AUTOTEST $NGX_AUTOTEST.c >> $NGX_ERR 2>&1" + +if [ -x $NGX_AUTOTEST ]; then + if $NGX_AUTOTEST 2>&1 > /dev/null; then + echo " little endianess" + have=HAVE_LITTLE_ENDIAN . auto/have + else + echo " big endianess" + fi + + rm $NGX_AUTOTEST* + +else + rm $NGX_AUTOTEST* + + echo + echo "$0: error: can not detect system endianess" + exit 1 +fi diff --git a/auto/fmt/fmt b/auto/fmt/fmt index f1c9c5978..daca06900 100644 --- a/auto/fmt/fmt +++ b/auto/fmt/fmt @@ -11,15 +11,15 @@ do cat << END > $NGX_AUTOTEST.c -#include #include #include +#include #include $NGX_INTTYPES_H $NGX_AUTO_CONFIG int main() { - printf("$fmt", ($ngx_type) $ngx_max_size); + printf("$fmt", ($ngx_type) $ngx_max_value); return 0; } @@ -28,10 +28,10 @@ END eval "$CC_WARN $CC_TEST_FLAGS -o $NGX_AUTOTEST $NGX_AUTOTEST.c \ >> $NGX_ERR 2>&1" - max_size=`echo $ngx_max_size | sed -e "s/L*\$//"` + max_value=`echo $ngx_max_value | sed -e "s/L*\$//"` if [ -x $NGX_AUTOTEST ]; then - if [ "`$NGX_AUTOTEST`" = $max_size ]; then + if [ "`$NGX_AUTOTEST`" = $max_value ]; then if [ $ngx_fmt_collect = yes ]; then echo $ngx_n "$comma \"${fmt}\" is appropriate" $ngx_c else @@ -45,7 +45,7 @@ END if [ $ngx_fmt != no ]; then if [ $ngx_fmt_collect = yes ]; then - eval "ngx_${ngx_bytes}_fmt=\"\${ngx_${ngx_bytes}_fmt} \$ngx_fmt\"" + eval "ngx_${ngx_size}_fmt=\"\${ngx_${ngx_size}_fmt} \$ngx_fmt\"" comma="," continue else diff --git a/auto/fmt/ptrfmt b/auto/fmt/ptrfmt index d69867714..20f0d320c 100644 --- a/auto/fmt/ptrfmt +++ b/auto/fmt/ptrfmt @@ -13,7 +13,7 @@ do cat << END > $NGX_AUTOTEST.c int main() { - printf("$fmt", ($ngx_type) $ngx_max_size); + printf("$fmt", ($ngx_type) $ngx_max_value); return 0; } @@ -22,10 +22,10 @@ END eval "$CC_WARN $CC_TEST_FLAGS -o $NGX_AUTOTEST $NGX_AUTOTEST.c \ >> $NGX_ERR 2>&1" - max_size=`echo $ngx_max_size | sed -e "s/L*\$//"` + max_value=`echo $ngx_max_value | sed -e "s/L*\$//"` if [ -x $NGX_AUTOTEST ]; then - if [ "`$NGX_AUTOTEST`" = $max_size ]; then + if [ "`$NGX_AUTOTEST`" = $max_value ]; then ngx_fmt=$fmt fi fi @@ -49,8 +49,8 @@ if [ $ngx_fmt = no ]; then fi -if [ $ngx_ptr_bytes = 4 ]; then - fmtX="%0`expr 2 \* $ngx_ptr_bytes`" +if [ $ngx_ptr_size = 4 ]; then + fmtX="%0`expr 2 \* $ngx_ptr_size`" else fmtX="%" fi diff --git a/auto/types/maxvalue b/auto/types/maxvalue deleted file mode 100644 index 91752a26d..000000000 --- a/auto/types/maxvalue +++ /dev/null @@ -1,6 +0,0 @@ - -cat << END >> $NGX_AUTO_CONFIG_H - -#ifndef $ngx_type_max_value -#define $ngx_type_max_value $ngx_max_size -#endif diff --git a/auto/types/sizeof b/auto/types/sizeof index ebb0fa9b6..102f343bc 100644 --- a/auto/types/sizeof +++ b/auto/types/sizeof @@ -3,14 +3,15 @@ echo $ngx_n "checking for $ngx_type size ..." $ngx_c echo >> $NGX_ERR echo "checking for $ngx_type size" >> $NGX_ERR -ngx_bytes= +ngx_size= cat << END > $NGX_AUTOTEST.c #include #include -#include $NGX_UNISTD_H +#include +#include $NGX_INTTYPES_H $NGX_AUTO_CONFIG @@ -24,27 +25,31 @@ END eval "$CC $CC_TEST_FLAGS -o $NGX_AUTOTEST $NGX_AUTOTEST.c >> $NGX_ERR 2>&1" if [ -x $NGX_AUTOTEST ]; then - ngx_bytes=`$NGX_AUTOTEST` - echo " $ngx_bytes bytes" + ngx_size=`$NGX_AUTOTEST` + echo " $ngx_size bytes" fi rm $NGX_AUTOTEST* -case $ngx_bytes in +case $ngx_size in 4) if [ "$ngx_type"="long" ]; then - ngx_max_size=2147483647L + ngx_max_value=2147483647L else - ngx_max_size=2147483647 + ngx_max_value=2147483647 fi + + ngx_max_len='sizeof("-2147483648") - 1' ;; 8) if [ "$ngx_type"="long long" ]; then - ngx_max_size=9223372036854775807LL + ngx_max_value=9223372036854775807LL else - ngx_max_size=9223372036854775807L + ngx_max_value=9223372036854775807L fi + + ngx_max_len='sizeof("-9223372036854775808") - 1' ;; *) diff --git a/auto/types/typedef b/auto/types/typedef index 531bb7e2f..2bf67cff2 100644 --- a/auto/types/typedef +++ b/auto/types/typedef @@ -10,8 +10,8 @@ do cat << END > $NGX_AUTOTEST.c -#include #include +#include #include #include #include diff --git a/auto/types/uintptr_t b/auto/types/uintptr_t index f46ffb6b4..cd2df8da5 100644 --- a/auto/types/uintptr_t +++ b/auto/types/uintptr_t @@ -30,7 +30,7 @@ rm $NGX_AUTOTEST* if [ $found = no ]; then - found="uint`expr 8 \* $ngx_ptr_bytes`_t" + found="uint`expr 8 \* $ngx_ptr_size`_t" echo ", $found used" echo "typedef $found uintptr_t;" >> $NGX_AUTO_CONFIG_H diff --git a/auto/types/value b/auto/types/value new file mode 100644 index 000000000..c08012ce2 --- /dev/null +++ b/auto/types/value @@ -0,0 +1,6 @@ + +cat << END >> $NGX_AUTO_CONFIG_H + +#ifndef $ngx_param +#define $ngx_param $ngx_value +#endif diff --git a/auto/unix b/auto/unix index f4bc83da0..36b9744d8 100755 --- a/auto/unix +++ b/auto/unix @@ -13,32 +13,31 @@ ngx_formats="%ld"; . auto/fmt/fmt ngx_type="long long"; . auto/types/sizeof ngx_formats="%lld %qd"; . auto/fmt/fmt -ngx_type="void *"; . auto/types/sizeof; ngx_ptr_bytes=$ngx_bytes +ngx_type="void *"; . auto/types/sizeof; ngx_ptr_size=$ngx_size ngx_fmt_name=PTR_FMT; -eval ngx_formats=\${ngx_${ngx_bytes}_fmt}; . auto/fmt/ptrfmt +eval ngx_formats=\${ngx_${ngx_ptr_size}_fmt}; . auto/fmt/ptrfmt # POSIX types NGX_AUTO_CONFIG="#include \"../$NGX_AUTO_CONFIG_H\"" -ngx_type="uint64_t" -ngx_types="u_int64_t"; . auto/types/typedef +ngx_type="uint64_t"; ngx_types="u_int64_t"; . auto/types/typedef -ngx_type="sig_atomic_t" -ngx_types="int"; . auto/types/typedef +ngx_type="sig_atomic_t"; ngx_types="int"; . auto/types/typedef +. auto/types/sizeof +ngx_param=SIG_ATOMIC_T_SIZE; ngx_value=$ngx_size; . auto/types/value -ngx_type="socklen_t" -ngx_types="uint32_t"; . auto/types/typedef +ngx_type="socklen_t"; ngx_types="uint32_t"; . auto/types/typedef -ngx_type="in_addr_t" -ngx_types="uint32_t"; . auto/types/typedef +ngx_type="in_addr_t"; ngx_types="uint32_t"; . auto/types/typedef -ngx_type="rlim_t" -ngx_types="int"; . auto/types/typedef +ngx_type="rlim_t"; ngx_types="int"; . auto/types/typedef . auto/types/uintptr_t +. auto/endianess + # printf() formats @@ -46,22 +45,24 @@ CC_WARN=$CC_STRONG ngx_fmt_collect=no ngx_fmt_name=OFF_T_FMT; ngx_type="off_t"; . auto/types/sizeof -ngx_type_max_value=OFF_T_MAX_VALUE; . auto/types/maxvalue -eval ngx_formats=\${ngx_${ngx_bytes}_fmt}; . auto/fmt/fmt +ngx_param=OFF_T_MAX_VALUE; ngx_value=$ngx_max_value; . auto/types/value +eval ngx_formats=\${ngx_${ngx_size}_fmt}; . auto/fmt/fmt ngx_fmt_name=TIME_T_FMT; ngx_type="time_t"; . auto/types/sizeof -eval ngx_formats=\${ngx_${ngx_bytes}_fmt}; . auto/fmt/fmt +ngx_param=TIME_T_SIZE; ngx_value=$ngx_size; . auto/types/value +ngx_param=TIME_T_LEN; ngx_value=$ngx_max_len; . auto/types/value +eval ngx_formats=\${ngx_${ngx_size}_fmt}; . auto/fmt/fmt ngx_fmt_name=SIZE_T_FMT; ngx_type="size_t"; . auto/types/sizeof -eval ngx_formats=\${ngx_${ngx_bytes}_fmt}; . auto/fmt/fmt +eval ngx_formats=\${ngx_${ngx_size}_fmt}; . auto/fmt/fmt ngx_fmt_name=SIZE_T_X_FMT; . auto/fmt/xfmt ngx_fmt_name=PID_T_FMT; ngx_type="pid_t"; . auto/types/sizeof -eval ngx_formats=\${ngx_${ngx_bytes}_fmt}; . auto/fmt/fmt +eval ngx_formats=\${ngx_${ngx_size}_fmt}; . auto/fmt/fmt ngx_fmt_name=RLIM_T_FMT; ngx_type="rlim_t"; . auto/types/sizeof -eval ngx_formats=\${ngx_${ngx_bytes}_fmt}; . auto/fmt/fmt +eval ngx_formats=\${ngx_${ngx_size}_fmt}; . auto/fmt/fmt # syscalls, libc calls and some features -- cgit v1.2.3