diff options
Diffstat (limited to 'auto/types')
| -rw-r--r-- | auto/types/socklen_t | 28 | ||||
| -rw-r--r-- | auto/types/time_t | 30 | ||||
| -rw-r--r-- | auto/types/uint64_t | 50 | ||||
| -rw-r--r-- | auto/types/uintptr_t | 45 |
4 files changed, 153 insertions, 0 deletions
diff --git a/auto/types/socklen_t b/auto/types/socklen_t new file mode 100644 index 000000000..84d39fb0c --- /dev/null +++ b/auto/types/socklen_t @@ -0,0 +1,28 @@ + +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 new file mode 100644 index 000000000..ecd80ef18 --- /dev/null +++ b/auto/types/time_t @@ -0,0 +1,30 @@ + +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/uint64_t b/auto/types/uint64_t new file mode 100644 index 000000000..070f9e4a3 --- /dev/null +++ b/auto/types/uint64_t @@ -0,0 +1,50 @@ + +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 new file mode 100644 index 000000000..f2cfe6225 --- /dev/null +++ b/auto/types/uintptr_t @@ -0,0 +1,45 @@ + +found=0 + +echo 'Checking for uintptr_t' + + echo '#include <sys/types.h>' > autotest.c + echo 'int main() { uintptr_t i = 0; return i; }' >> autotest.c + + 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 +fi + + +if [ $found = 0 ]; then + echo "$0: error: uintptr_t not found" + exit 1 +fi + + +if [ $found = 2 ]; then + echo $type >> ngx_auto_config.h + echo >> ngx_auto_config.h +fi + |
