summaryrefslogtreecommitdiff
path: root/auto/types
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2003-11-25 20:44:56 +0000
committerIgor Sysoev <igor@sysoev.ru>2003-11-25 20:44:56 +0000
commita8fa0a6a37b6e90324e0dcbf4733324199623841 (patch)
tree1a7edec9aa04946afc22299bf587823488fb492f /auto/types
parentd9d0ca12688034d481e2f1f5cf13a098338ec31d (diff)
downloadnginx-a8fa0a6a37b6e90324e0dcbf4733324199623841.tar.gz
nginx-0.0.1-2003-11-25-23:44:56 import
Diffstat (limited to 'auto/types')
-rw-r--r--auto/types/longlong31
-rw-r--r--auto/types/sizeof24
-rw-r--r--auto/types/socklen_t28
-rw-r--r--auto/types/time_t30
-rw-r--r--auto/types/typedef72
-rw-r--r--auto/types/uint64_t50
-rw-r--r--auto/types/uintptr_t53
7 files changed, 73 insertions, 215 deletions
diff --git a/auto/types/longlong b/auto/types/longlong
deleted file mode 100644
index f843d5ae4..000000000
--- a/auto/types/longlong
+++ /dev/null
@@ -1,31 +0,0 @@
-
-echo "Checking for long long size"
-
-BYTES=
-
-echo "int main() {" > autotest.c
-echo "printf(\"%d\", sizeof(long long));" >> autotest.c
-echo "return 0; }" >> autotest.c
-
-eval "${CC} -o autotest autotest.c > /dev/null 2>&1"
-
-if [ -x ./autotest ]; then
- BYTES=`./autotest`
- echo " + long long is $BYTES bytes"
-fi
-
-rm autotest*
-
-case $BYTES in
- 4)
- NGX_MAX_LONG_LONG=4294967295
- ;;
-
- 8)
- NGX_MAX_LONG_LONG=18446744073709551615
- ;;
-
- *)
- echo "$0: error: can not detect long long size"
- exit 1
-esac
diff --git a/auto/types/sizeof b/auto/types/sizeof
index bf7ee3c85..8f811136e 100644
--- a/auto/types/sizeof
+++ b/auto/types/sizeof
@@ -1,29 +1,37 @@
-echo "Checking for $NGX_TYPE size"
+echo "checking for $NGX_TYPE size"
-BYTES=
+NGX_BYTES=
echo "#include <sys/types.h>" > autotest.c
echo "int main() {" >> autotest.c
echo "printf(\"%d\", sizeof($NGX_TYPE));" >> autotest.c
echo "return 0; }" >> autotest.c
-eval "${CC} -o autotest autotest.c > /dev/null 2>&1"
+eval "$CC $CC_TEST_FLAGS -o autotest autotest.c > /dev/null 2>&1"
if [ -x ./autotest ]; then
- BYTES=`./autotest`
- echo " + $NGX_TYPE is $BYTES bytes"
+ NGX_BYTES=`./autotest`
+ echo " + $NGX_TYPE is $NGX_BYTES bytes"
fi
rm autotest*
-case $BYTES in
+case $NGX_BYTES in
4)
- NGX_MAX_SIZE=2147483647
+ if [ "$NGX_TYPE"="long" ]; then
+ NGX_MAX_SIZE=2147483647L
+ else
+ NGX_MAX_SIZE=2147483647
+ fi
;;
8)
- NGX_MAX_SIZE=9223372036854775807
+ if [ "$NGX_TYPE"="long long" ]; then
+ NGX_MAX_SIZE=9223372036854775807LL
+ else
+ NGX_MAX_SIZE=9223372036854775807L
+ fi
;;
*)
diff --git a/auto/types/socklen_t b/auto/types/socklen_t
deleted file mode 100644
index 84d39fb0c..000000000
--- a/auto/types/socklen_t
+++ /dev/null
@@ -1,28 +0,0 @@
-
-found=0
-
-echo 'Checking for socklen_t'
-
-echo '#include <sys/types.h>' > autotest.c
-echo '#include <sys/socket.h>' >> autotest.c
-echo 'int main() { socklen_t i = 0; return 0; }' >> autotest.c
-
-eval "${CC} -o autotest autotest.c > /dev/null 2>&1"
-
-if [ -x autotest ]; then
- echo ' + socklen_t found'
- found=1
-else
- echo ' + socklen_t not found'
- echo ' + uint32_t used'
- type='typedef uint32_t socklen_t;'
- found=2
-fi
-
-rm autotest*
-
-
-if [ $found = 2 ]; then
- echo $type >> ngx_auto_config.h
- echo >> ngx_auto_config.h
-fi
diff --git a/auto/types/time_t b/auto/types/time_t
deleted file mode 100644
index ecd80ef18..000000000
--- a/auto/types/time_t
+++ /dev/null
@@ -1,30 +0,0 @@
-
-echo "Checking for printf() time_t format"
-
-echo '#include <sys/types.h>' > autotest.c
-type=`${CPP} autotest.c | awk '/^typedef.*time_t/ {print \$2}'`
-rm autotest.c
-
-case $type in
- long)
- echo ' + long: "%ld" used'
- fmt='"%ld"'
- ;;
-
- int)
- echo ' + int: "%d" used'
- fmt='"%d"'
- ;;
-
- *)
- echo "$0: error: unknown time_t definition: \"$type\""
- exit 1
- ;;
-
-esac
-
-
-echo "#ifndef TIME_FMT" >> ngx_auto_config.h
-echo "#define TIME_FMT $fmt" >> ngx_auto_config.h
-echo "#endif" >> ngx_auto_config.h
-echo >> ngx_auto_config.h
diff --git a/auto/types/typedef b/auto/types/typedef
index 4c7acbd11..a842542df 100644
--- a/auto/types/typedef
+++ b/auto/types/typedef
@@ -1,32 +1,42 @@
-echo "Checking for $NGX_TYPE definition"
-
-echo "#include <sys/types.h>" > autotest.c
-TYPE=`${CPP} autotest.c | \
- awk "/^typedef.*$NGX_TYPE/ { for (i = 1; i< NF; i++) print $i}"`
-#rm autotest.c
-
-echo $TYPE
-
-case $TYPE in
- "long long")
- echo ' + defined as long long'
- NGX_FMT=$NGX_LONG_LONG_FMT
- ;;
-
- long)
- echo ' + defined as long'
- NGX_FMT=$NGX_LONG_FMT
- ;;
-
- int)
- echo ' + defined as int'
- NGX_FMT=$NGX_INT_FMT
- ;;
-
- *)
- echo "$0: error: unknown $NGX_TYPE definition: \"$TYPE\""
- exit 1
- ;;
-
-esac
+echo "checking for $NGX_TYPE"
+
+FOUND=NO
+
+for TYPE in $NGX_TYPE $NGX_TYPES
+do
+ echo "#include <sys/types.h>" > autotest.c
+ echo "#include <sys/socket.h>" >> autotest.c
+ echo "$NGX_INTTYPES_H" >> autotest.c
+ echo "int main() { $TYPE i = 0; return 0; }" >> autotest.c
+
+ eval "$CC -o autotest autotest.c > /dev/null 2>&1"
+
+ if [ -x autotest ]; then
+ if [ $TYPE = $NGX_TYPE ]; then
+ echo " + $NGX_TYPE found"
+ FOUND=YES
+ else
+ echo " + $TYPE used"
+ FOUND=$TYPE
+ fi
+ fi
+
+ rm autotest*
+
+ if [ $FOUND = NO ]; then
+ echo " + $TYPE not found"
+ else
+ break
+ fi
+done
+
+if [ $FOUND = NO ]; then
+ echo "$0: error: can not define $NGX_TYPE"
+ exit 1
+fi
+
+if [ $FOUND != YES ]; then
+ echo "typedef $FOUND $NGX_TYPE;" >> $NGX_AUTO_CONFIG_H
+ echo >> $NGX_AUTO_CONFIG_H
+fi
diff --git a/auto/types/uint64_t b/auto/types/uint64_t
deleted file mode 100644
index 070f9e4a3..000000000
--- a/auto/types/uint64_t
+++ /dev/null
@@ -1,50 +0,0 @@
-
-found=0
-
-echo 'Checking for uint64_t'
-
- echo '#include <sys/types.h>' > autotest.c
- echo 'int main() { uint64_t i = 0; return 0; }' >> autotest.c
-
- eval "${CC} -o autotest autotest.c > /dev/null 2>&1"
-
- if [ -x autotest ]; then
- echo ' + uint64_t found'
- found=1
- else
- echo ' + uint64_t not found'
- fi
-
- rm autotest*
-
-
-if [ $found = 0 ]; then
-
- echo '#include <sys/types.h>' > autotest.c
- echo 'int main() { u_int64_t i = 0; return 0; }' >> autotest.c
-
- eval "${CC} -o autotest autotest.c > /dev/null 2>&1"
-
- if [ -x autotest ]; then
- echo ' + u_int64_t used'
- type='typedef u_int64_t uint64_t;'
- found=2
- else
- echo ' + u_int64_t not found'
- fi
-
- rm autotest*
-
-fi
-
-
-if [ $found = 0 ]; then
- echo "$0: error: uint64_t not found"
- exit 1
-fi
-
-
-if [ $found = 2 ]; then
- echo $type >> ngx_auto_config.h
- echo >> ngx_auto_config.h
-fi
diff --git a/auto/types/uintptr_t b/auto/types/uintptr_t
index 568c6099d..93a01a8fa 100644
--- a/auto/types/uintptr_t
+++ b/auto/types/uintptr_t
@@ -1,47 +1,26 @@
-found=0
+echo 'checking for uintptr_t'
-echo 'Checking for uintptr_t'
+FOUND=NO
- echo '#include <sys/types.h>' > autotest.c
- echo 'int main() { uintptr_t i = 0; return i; }' >> autotest.c
+echo "#include <sys/types.h>" > autotest.c
+echo "int main() { uintptr_t i = 0; return 0; }" >> autotest.c
- eval "${CC} -o autotest autotest.c > /dev/null 2>&1"
+eval "$CC -o autotest autotest.c > /dev/null 2>&1"
- if [ -x autotest ]; then
- echo ' + uintptr_t found'
- found=1
- else
- echo ' + uintptr_t not found'
- fi
-
- rm autotest*
-
-
-if [ $found = 0 ]; then
- echo 'int main() { printf("%d", 8 * sizeof(void *)); return 0; }' \
- > autotest.c
- eval "${CC} -o autotest autotest.c > /dev/null 2>&1"
-
- if [ -x autotest ]; then
- type="uint`./autotest`_t"
- echo " + $type used"
- type="typedef $type uintptr_t;"
- found=2
- fi
-
- rm autotest*
+if [ -x autotest ]; then
+ echo " + uintptr_t found"
+ FOUND=YES
+else
+ echo " + uintptr_t not found"
fi
-
-if [ $found = 0 ]; then
- echo "$0: error: uintptr_t not found"
- exit 1
-fi
+rm autotest*
-if [ $found = 2 ]; then
- echo $type >> ngx_auto_config.h
- echo >> ngx_auto_config.h
+if [ $FOUND = NO ]; then
+ FOUND="uint`expr 8 \* $NGX_PTR_BYTES`_t"
+ echo " + $FOUND used"
+ echo "typedef $FOUND uintptr_t;" >> $NGX_AUTO_CONFIG_H
+ echo >> $NGX_AUTO_CONFIG_H
fi
-