Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nginx/nginx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/auto
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2004-06-27 22:01:57 +0400
committerIgor Sysoev <igor@sysoev.ru>2004-06-27 22:01:57 +0400
commitc02473048cee372cb8644e1f2d566431781074d2 (patch)
tree689654cd7b37636279b5587ddd3b45ad6bddbd3c /auto
parentb1af9bbcabf1bdbe119366971a2d0f6c3f8f595d (diff)
nginx-0.0.7-2004-06-27-22:01:57 import
Diffstat (limited to 'auto')
-rw-r--r--auto/endianess38
-rw-r--r--auto/fmt/fmt10
-rw-r--r--auto/fmt/ptrfmt10
-rw-r--r--auto/types/maxvalue6
-rw-r--r--auto/types/sizeof23
-rw-r--r--auto/types/typedef2
-rw-r--r--auto/types/uintptr_t2
-rw-r--r--auto/types/value6
-rwxr-xr-xauto/unix37
9 files changed, 89 insertions, 45 deletions
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 <stdio.h>
#include <sys/types.h>
#include <sys/time.h>
+#include <stdio.h>
#include <sys/resource.h>
$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 <sys/types.h>
#include <sys/time.h>
-#include <sys/resource.h>
$NGX_UNISTD_H
+#include <signal.h>
+#include <sys/resource.h>
$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 <signal.h>
#include <sys/types.h>
+#include <signal.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <sys/resource.h>
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