diff options
Diffstat (limited to 'auto')
-rwxr-xr-x | auto/configure | 4 | ||||
-rw-r--r-- | auto/fmt/fmt | 88 | ||||
-rw-r--r-- | auto/fmt/xfmt | 4 | ||||
-rw-r--r-- | auto/func | 46 | ||||
-rw-r--r-- | auto/inc | 44 | ||||
-rw-r--r-- | auto/init | 3 | ||||
-rw-r--r-- | auto/lib/conf | 24 | ||||
-rw-r--r-- | auto/lib/lib | 48 | ||||
-rw-r--r-- | auto/lib/md5/conf | 67 | ||||
-rw-r--r-- | auto/lib/test | 23 | ||||
-rw-r--r-- | auto/lib/zlib/conf | 28 | ||||
-rw-r--r-- | auto/options | 10 | ||||
-rw-r--r-- | auto/sources | 1 | ||||
-rw-r--r-- | auto/summary | 17 | ||||
-rw-r--r-- | auto/types/sizeof | 54 | ||||
-rw-r--r-- | auto/types/typedef | 65 | ||||
-rw-r--r-- | auto/types/uintptr_t | 42 | ||||
-rwxr-xr-x | auto/unix | 104 |
18 files changed, 435 insertions, 237 deletions
diff --git a/auto/configure b/auto/configure index 4966a7ca2..6d3fc5266 100755 --- a/auto/configure +++ b/auto/configure @@ -6,7 +6,7 @@ . auto/os/conf . auto/cc -. auto/lib/lib +. auto/lib/conf . auto/make . auto/lib/make @@ -15,3 +15,5 @@ echo > $NGX_AUTO_CONFIG_H if [ "$PLATFORM" != win32 ]; then . auto/unix fi + +. auto/summary diff --git a/auto/fmt/fmt b/auto/fmt/fmt index ebfbd53a9..13b9bd3ee 100644 --- a/auto/fmt/fmt +++ b/auto/fmt/fmt @@ -1,59 +1,77 @@ -echo "checking for $NGX_TYPE printf() format" +echo -n "checking for $ngx_type printf() format ..." +echo >> $NGX_ERR +echo "checking for $ngx_type printf() format" >> $NGX_ERR -NGX_FMT=NO +ngx_fmt=no +comma= -for FMT in $NGX_FORMATS +for fmt in $ngx_formats do - echo "#include <stdio.h>" > autotest.c - echo "#include <sys/types.h>" >> autotest.c - echo "#include <sys/time.h>" >> autotest.c - echo "#include <sys/resource.h>" >> autotest.c - echo "$NGX_INTTYPES_H" >> autotest.c - echo "$NGX_AUTO_CONFIG" >> autotest.c - echo "int main() {" >> autotest.c - echo "printf(\"${FMT}\", ($NGX_TYPE) $NGX_MAX_SIZE);" >> autotest.c - echo "return 0; }" >> autotest.c - - eval "$CC_WARN $CC_TEST_FLAGS -o autotest autotest.c > $NGX_ERR 2>&1" - - MAX_SIZE=`echo $NGX_MAX_SIZE | sed -e "s/L*\$//"` - - if [ -x ./autotest ]; then - if [ "`./autotest`" = $MAX_SIZE ]; then - if [ $NGX_FMT_COLLECT = YES ]; then - echo " + \"${FMT}\" is appropriate" + + cat << END > $NGX_AUTOTEST.c + +#include <stdio.h> +#include <sys/types.h> +#include <sys/time.h> +#include <sys/resource.h> +$NGX_INTTYPES_H +$NGX_AUTO_CONFIG + +int main() { + printf("$fmt", ($ngx_type) $ngx_max_size); + return 0; +} + +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*\$//"` + + if [ -x $NGX_AUTOTEST ]; then + if [ "`$NGX_AUTOTEST`" = $max_size ]; then + if [ $ngx_fmt_collect = yes ]; then + echo -n "$comma \"${fmt}\" is appropriate" else - echo " + \"${FMT}\" used" + echo -n "$comma \"${fmt}\" used" fi - NGX_FMT=$FMT + ngx_fmt=$fmt fi fi - rm autotest* + rm $NGX_AUTOTEST* - if [ $NGX_FMT != NO ]; then - if [ $NGX_FMT_COLLECT = YES ]; then - eval "NGX_${NGX_BYTES}_FMT=\"\${NGX_${NGX_BYTES}_FMT} \$NGX_FMT\"" + if [ $ngx_fmt != no ]; then + if [ $ngx_fmt_collect = yes ]; then + eval "ngx_${ngx_bytes}_fmt=\"\${ngx_${ngx_bytes}_fmt} \$ngx_fmt\"" + comma="," continue else break fi fi - echo " + \"${FMT}\" is not appropriate" + echo -n "$comma \"${fmt}\" is not appropriate" + comma="," done +echo -if [ $NGX_FMT = NO ]; then - echo "$0: error: printf() $NGX_TYPE format not found" +if [ $ngx_fmt = no ]; then + echo "$0: error: printf() $ngx_type format not found" exit 1 fi -if [ $NGX_FMT_COLLECT = NO ]; then - echo "#ifndef $NGX_FMT_NAME" >> $NGX_AUTO_CONFIG_H - echo "#define $NGX_FMT_NAME \"$NGX_FMT\"" >> $NGX_AUTO_CONFIG_H - echo "#endif" >> $NGX_AUTO_CONFIG_H - echo >> $NGX_AUTO_CONFIG_H +if [ $ngx_fmt_collect = no ]; then + cat << END >> $NGX_AUTO_CONFIG_H + +#ifndef $ngx_fmt_name +#define $ngx_fmt_name "$ngx_fmt" +#endif + +END + fi diff --git a/auto/fmt/xfmt b/auto/fmt/xfmt index 0256c5caa..31f4d717d 100644 --- a/auto/fmt/xfmt +++ b/auto/fmt/xfmt @@ -1,6 +1,6 @@ -echo "#ifndef $NGX_FMT_NAME" >> $NGX_AUTO_CONFIG_H -echo "#define $NGX_FMT_NAME \"$NGX_FMT\"" | sed -e 's/d"$/x"/' \ +echo "#ifndef $ngx_fmt_name" >> $NGX_AUTO_CONFIG_H +echo "#define $ngx_fmt_name \"$ngx_fmt\"" | sed -e 's/d"$/x"/' \ >> $NGX_AUTO_CONFIG_H echo "#endif" >> $NGX_AUTO_CONFIG_H echo >> $NGX_AUTO_CONFIG_H @@ -1,28 +1,42 @@ -echo "checking for $NGX_FUNC" +echo -n "checking for $ngx_func ..." +echo >> $NGX_ERR +echo "checking for $ngx_func" >> $NGX_ERR -NGX_FOUND=NO +ngx_found=no -func=`echo $NGX_FUNC | sed -e 's/()$//' | tr '[a-z]' '[A-Z]'` +func=`echo $ngx_func | sed -e 's/()$//' | tr '[a-z]' '[A-Z]'` -echo "$NGX_UNISTD_H" > autotest.c -echo "$NGX_FUNC_INC" >> autotest.c -echo "int main() { $NGX_FUNC_TEST; return 0; }" >> autotest.c +cat << END > $NGX_AUTOTEST.c -eval "$CC $CC_TEST_FLAGS -o autotest autotest.c $NGX_FUNC_LIBS > $NGX_ERR 2>&1" +$NGX_UNISTD_H +$ngx_func_inc -if [ -x autotest ]; then - echo " + $NGX_FUNC found" +int main() { + $ngx_func_test; + return 0; +} - echo "#ifndef HAVE_$func" >> $NGX_AUTO_CONFIG_H - echo "#define HAVE_$func 1" >> $NGX_AUTO_CONFIG_H - echo "#endif" >> $NGX_AUTO_CONFIG_H - echo >> $NGX_AUTO_CONFIG_H +END - NGX_FOUND=YES +eval "$CC $CC_TEST_FLAGS -o $NGX_AUTOTEST $NGX_AUTOTEST.c $ngx_func_libs \ + >> $NGX_ERR 2>&1" + +if [ -x $NGX_AUTOTEST ]; then + echo " found" + + cat << END >> $NGX_AUTO_CONFIG_H + +#ifndef HAVE_$func +#define HAVE_$func 1 +#endif + +END + + ngx_found=yes else - echo " + $NGX_FUNC not found" + echo " not found" fi -rm autotest* +rm $NGX_AUTOTEST* @@ -1,28 +1,40 @@ -echo "checking for $NGX_INC" +echo -n "checking for $ngx_inc ..." +echo >> $NGX_ERR +echo "checking for $ngx_inc" >> $NGX_ERR -NGX_FOUND=NO +ngx_found=no -inc=`echo $NGX_INC | sed -e 's/\./_/' | sed -e 's/\//_/' | tr '[a-z]' '[A-Z]'` +inc=`echo $ngx_inc | sed -e 's/\./_/' | sed -e 's/\//_/' | tr '[a-z]' '[A-Z]'` -echo "#include <$NGX_INC>" > autotest.c -echo "int main() { return 0; }" >> autotest.c +cat << END > $NGX_AUTOTEST.c -eval "${CC} -o autotest autotest.c > /dev/null 2>&1" +#include <$ngx_inc> -if [ -x autotest ]; then - echo " + $NGX_INC found" +int main() { + return 0; +} - echo "#ifndef HAVE_$inc" >> $NGX_AUTO_CONFIG_H - echo "#define HAVE_$inc 1" >> $NGX_AUTO_CONFIG_H - echo "#endif" >> $NGX_AUTO_CONFIG_H - echo >> $NGX_AUTO_CONFIG_H +END - eval "NGX_$inc='#include <$NGX_INC>'" - NGX_FOUND=YES +eval "${CC} -o $NGX_AUTOTEST $NGX_AUTOTEST.c >> $NGX_ERR 2>&1" + +if [ -x $NGX_AUTOTEST ]; then + echo " found" + + cat << END >> $NGX_AUTO_CONFIG_H + +#ifndef HAVE_$inc +#define HAVE_$inc 1 +#endif + +END + + eval "NGX_$inc='#include <$ngx_inc>'" + ngx_found=yes else - echo " + $NGX_INC not found" + echo " not found" fi -rm autotest* +rm $NGX_AUTOTEST* @@ -4,4 +4,5 @@ MAKEFILE=$OBJS/Makefile NGX_AUTO_CONFIG_H=$OBJS/ngx_auto_config.h NGX_MODULES_C=$OBJS/ngx_modules.c -NGX_ERR=autoconf.err +NGX_AUTOTEST=$OBJS/autotest +NGX_ERR=$OBJS/autoconf.err diff --git a/auto/lib/conf b/auto/lib/conf new file mode 100644 index 000000000..b5271a225 --- /dev/null +++ b/auto/lib/conf @@ -0,0 +1,24 @@ + +if [ $PCRE != NO ]; then + + CORE_INCS="$CORE_INCS -I $PCRE" + + if [ "$PLATFORM" = "win32" ]; then + CFLAGS="$CFLAGS -D PCRE_STATIC" + CORE_LIBS="$CORE_LIBS pcre.lib" + CORE_LINK="$CORE_LINK -libpath:$PCRE" + else + CORE_DEPS="$CORE_DEPS $PCRE/.libs/libpcre.a" + CORE_LIBS="$CORE_LIBS -L $PCRE/.libs -lpcre" + fi +fi + + +if [ $USE_MD5 = YES ]; then + . auto/lib/md5/conf +fi + + +if [ $USE_ZLIB = YES ]; then + . auto/lib/zlib/conf +fi diff --git a/auto/lib/lib b/auto/lib/lib deleted file mode 100644 index 848567974..000000000 --- a/auto/lib/lib +++ /dev/null @@ -1,48 +0,0 @@ - -if [ $PCRE != NO ]; then - - CORE_INCS="$CORE_INCS -I $PCRE" - - if [ "$PLATFORM" = "win32" ]; then - CFLAGS="$CFLAGS -D PCRE_STATIC" - CORE_LIBS="$CORE_LIBS pcre.lib" - CORE_LINK="$CORE_LINK -libpath:$PCRE" - else - CORE_DEPS="$CORE_DEPS $PCRE/.libs/libpcre.a" - CORE_LIBS="$CORE_LIBS -L $PCRE/.libs -lpcre" - fi -fi - - -if [ $MD5 != NO ]; then - - CFLAGS="$CFLAGS -D HAVE_OPENSSL_MD5" - CORE_INCS="$CORE_INCS -I $MD5" - - if [ "$PLATFORM" = "win32" ]; then - CORE_LIBS="$CORE_LIBS md5.lib" - CORE_LINK="$CORE_LINK -libpath:$MD5" - else - LINK_DEPS="$LINK_DEPS $MD5/libmd5.a" - CORE_LIBS="$CORE_LIBS -L $MD5 -lmd5" - fi - -elif [ $MD5_LIB != NO ]; then - CORE_LIBS="$CORE_LIBS $MD5_LIB" -fi - - -if [ $ZLIB != NO ]; then - CORE_INCS="$CORE_INCS -I $ZLIB" - - if [ "$PLATFORM" = "win32" ]; then - CORE_LIBS="$CORE_LIBS zlib.lib" - CORE_LINK="$CORE_LINK -libpath:$ZLIB" - else - LINK_DEPS="$LINK_DEPS $ZLIB/libz.a" - CORE_LIBS="$CORE_LIBS -L $ZLIB -lz" - fi - -elif [ $ZLIB_LIB != NO ]; then - CORE_LIBS="$CORE_LIBS $ZLIB_LIB" -fi diff --git a/auto/lib/md5/conf b/auto/lib/md5/conf new file mode 100644 index 000000000..e1755c1fc --- /dev/null +++ b/auto/lib/md5/conf @@ -0,0 +1,67 @@ + +if [ $MD5 != NO ]; then + + if grep MD5_Init $MD5/md5.h >/dev/null; then + # OpenSSL md5 + OPENSSL_MD5=YES + CFLAGS="$CFLAGS -D HAVE_OPENSSL_MD5" + else + # rsaref md5 + OPENSSL_MD5=NO + fi + + CORE_INCS="$CORE_INCS -I $MD5" + + if [ "$PLATFORM" = "win32" ]; then + CORE_LIBS="$CORE_LIBS md5.lib" + CORE_LINK="$CORE_LINK -libpath:$MD5" + else + LINK_DEPS="$LINK_DEPS $MD5/libmd5.a" + CORE_LIBS="$CORE_LIBS -L $MD5 -lmd5" + fi + +else + +ngx_lib_inc="#include <sys/types.h> +#include <md5.h>" + + # Solaris 8/9 + ngx_lib="rsaref md5" + ngx_lib_test="MD5_CTX md5; MD5Init(&md5)" + ngx_libs=-lmd5 + . auto/lib/test + + + if [ $ngx_found = yes ]; then + CORE_LIBS="$CORE_LIBS $ngx_libs" + MD5=YES + ngx_found=no + + else + # FreeBSD + ngx_lib="rsaref md" + ngx_lib_test="MD5_CTX md5; MD5Init(&md5)" + ngx_libs=-lmd + . auto/lib/test + fi + + + if [ $ngx_found = yes ]; then + CORE_LIBS="$CORE_LIBS $ngx_libs" + MD5=YES + ngx_found=no + + else + ngx_lib="OpenSSL md5" + ngx_lib_test="MD5_CTX md5; MD5_Init(&md5)" + ngx_libs=-lmd5 + . auto/lib/test + fi + + + if [ $ngx_found = yes ]; then + CFLAGS="$CFLAGS -D HAVE_OPENSSL_MD5" + CORE_LIBS="$CORE_LIBS $ngx_libs" + MD5=YES + fi +fi diff --git a/auto/lib/test b/auto/lib/test new file mode 100644 index 000000000..6d3f7e345 --- /dev/null +++ b/auto/lib/test @@ -0,0 +1,23 @@ + +echo "checking for $ngx_lib library" +echo >> $NGX_ERR +echo "checking for $ngx_lib library" >> $NGX_ERR + +ngx_found=no + +echo "$ngx_lib_inc" > $NGX_AUTOTEST.c +echo "int main() { $ngx_lib_test; return 0; }" >> $NGX_AUTOTEST.c + +eval "$CC $cc_test_flags -o $NGX_AUTOTEST $NGX_AUTOTEST.c $ngx_libs \ + >> $NGX_ERR 2>&1" + +if [ -x $NGX_AUTOTEST ]; then + echo " + $ngx_lib found" + + ngx_found=yes + +else + echo " + $ngx_lib not found" +fi + +rm $NGX_AUTOTEST* diff --git a/auto/lib/zlib/conf b/auto/lib/zlib/conf new file mode 100644 index 000000000..b8bbade0e --- /dev/null +++ b/auto/lib/zlib/conf @@ -0,0 +1,28 @@ + +if [ $ZLIB != NO ]; then + CORE_INCS="$CORE_INCS -I $ZLIB" + + if [ "$PLATFORM" = "win32" ]; then + CORE_LIBS="$CORE_LIBS zlib.lib" + CORE_LINK="$CORE_LINK -libpath:$ZLIB" + else + LINK_DEPS="$LINK_DEPS $ZLIB/libz.a" + CORE_LIBS="$CORE_LIBS -L $ZLIB -lz" + fi + +else + + ngx_lib_inc="#include <zlib.h>" + + ngx_lib="zlib" + ngx_lib_test="z_stream z; deflate(&z, Z_NO_FLUSH)" + ngx_libs=-lz + . auto/lib/test + + + if [ $ngx_found = yes ]; then + CORE_LIBS="$CORE_LIBS $ngx_libs" + ZLIB=YES + fi + +fi diff --git a/auto/options b/auto/options index 5b8ae4c16..1eb45a28d 100644 --- a/auto/options +++ b/auto/options @@ -1,5 +1,5 @@ -HELP=NO +help=no CC=gcc OBJS=objs @@ -11,9 +11,11 @@ HTTP_PROXY=YES PCRE=NO +USE_MD5=YES MD5=NO MD5_LIB=NO +USE_ZLIB=YES ZLIB=NO ZLIB_LIB=NO @@ -26,7 +28,7 @@ do esac case "$option" in - --help) HELP=YES ;; + --help) help=yes ;; --crossbuild=*) PLATFORM="$value" ;; @@ -51,7 +53,8 @@ do done -if [ $HELP = YES ]; then +if [ $help = yes ]; then + echo echo " --help this message" echo " --without-http_gzip_module disable http_gzip_module" @@ -63,6 +66,7 @@ if [ $HELP = YES ]; then echo " --with-pcre=DIR path to PCRE library" echo " --with-md5=DIR path to md5 library" echo " --with-zlib=DIR path to zlib library" + echo exit 1 fi diff --git a/auto/sources b/auto/sources index fa2b2df17..1e8790fd9 100644 --- a/auto/sources +++ b/auto/sources @@ -88,6 +88,7 @@ UNIX_DEPS="$CORE_DEPS $EVENT_DEPS \ UNIX_SRCS="$CORE_SRCS $EVENT_SRCS \ src/os/unix/ngx_time.c \ + src/os/unix/ngx_errno.c \ src/os/unix/ngx_sendv.c \ src/os/unix/ngx_files.c \ src/os/unix/ngx_socket.c \ diff --git a/auto/summary b/auto/summary new file mode 100644 index 000000000..19afd04b1 --- /dev/null +++ b/auto/summary @@ -0,0 +1,17 @@ + +echo +echo "Configuration summary" + +case $MD5 in + YES) echo " + using system md5 library" ;; + NO) echo " + md5 library is not found" ;; + *) echo " + using md5 library: $MD5" ;; +esac + +case $ZLIB in + YES) echo " + using system zlib library" ;; + NO) echo " + zlib library is not found" ;; + *) echo " + using zlib library: $ZLIB" ;; +esac + +echo diff --git a/auto/types/sizeof b/auto/types/sizeof index 2e9e9b2ca..d015aeaec 100644 --- a/auto/types/sizeof +++ b/auto/types/sizeof @@ -1,44 +1,52 @@ -echo "checking for $NGX_TYPE size" +echo -n "checking for $ngx_type size ..." +echo >> $NGX_ERR +echo "checking for $ngx_type size" >> $NGX_ERR -NGX_BYTES= +ngx_bytes= -echo "#include <sys/types.h>" > autotest.c -echo "#include <sys/time.h>" >> autotest.c -echo "#include <sys/resource.h>" >> autotest.c -echo "$NGX_INTTYPES_H" >> autotest.c -echo "$NGX_AUTO_CONFIG" >> autotest.c -echo "int main() {" >> autotest.c -echo "printf(\"%d\", sizeof($NGX_TYPE));" >> autotest.c -echo "return 0; }" >> autotest.c +cat << END > $NGX_AUTOTEST.c -eval "$CC $CC_TEST_FLAGS -o autotest autotest.c > /dev/null 2>&1" +#include <sys/time.h> +#include <sys/resource.h> +$NGX_INTTYPES_H +$NGX_AUTO_CONFIG -if [ -x ./autotest ]; then - NGX_BYTES=`./autotest` - echo " + $NGX_TYPE is $NGX_BYTES bytes" +int main() { + printf("%d", sizeof($ngx_type)); + return 0; +} + +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" fi -rm autotest* +rm $NGX_AUTOTEST* -case $NGX_BYTES in +case $ngx_bytes in 4) - if [ "$NGX_TYPE"="long" ]; then - NGX_MAX_SIZE=2147483647L + if [ "$ngx_type"="long" ]; then + ngx_max_size=2147483647L else - NGX_MAX_SIZE=2147483647 + ngx_max_size=2147483647 fi ;; 8) - if [ "$NGX_TYPE"="long long" ]; then - NGX_MAX_SIZE=9223372036854775807LL + if [ "$ngx_type"="long long" ]; then + ngx_max_size=9223372036854775807LL else - NGX_MAX_SIZE=9223372036854775807L + ngx_max_size=9223372036854775807L fi ;; *) - echo "$0: error: can not detect $NGX_TYPE size" + echo + echo "$0: error: can not detect $ngx_type size" exit 1 esac diff --git a/auto/types/typedef b/auto/types/typedef index c3155c450..d093e01d7 100644 --- a/auto/types/typedef +++ b/auto/types/typedef @@ -1,45 +1,56 @@ -echo "checking for $NGX_TYPE" +echo -n "checking for $ngx_type ..." +echo >> $NGX_ERR +echo "checking for $ngx_type" >> $NGX_ERR -FOUND=NO +found=no -for TYPE in $NGX_TYPE $NGX_TYPES +for type in $ngx_type $ngx_types do - echo "#include <sys/types.h>" > autotest.c - echo "#include <sys/socket.h>" >> autotest.c - echo "#include <sys/time.h>" >> autotest.c - echo "#include <sys/resource.h>" >> autotest.c - echo "#include <netinet/in.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 > $NGX_ERR 2>&1" - - if [ -x autotest ]; then - if [ $TYPE = $NGX_TYPE ]; then - echo " + $NGX_TYPE found" - FOUND=YES + + cat << END > $NGX_AUTOTEST.c + +#include <sys/types.h> +#include <sys/socket.h> +#include <sys/time.h> +#include <sys/resource.h> +#include <netinet/in.h> +$NGX_INTTYPES_H + +int main() { + $type i = 0; + return 0; +} + +END + + eval "$CC -o $NGX_AUTOTEST $NGX_AUTOTEST.c >> $NGX_ERR 2>&1" + + if [ -x $NGX_AUTOTEST ]; then + if [ $type = $ngx_type ]; then + echo " found" + found=yes else - echo " + $TYPE used" - FOUND=$TYPE + echo ", $type used" + found=$type fi fi - rm autotest* + rm $NGX_AUTOTEST* - if [ $FOUND = NO ]; then - echo " + $TYPE not found" + if [ $found = no ]; then + echo -n " $type not found" else break fi done -if [ $FOUND = NO ]; then - echo "$0: error: can not define $NGX_TYPE" +if [ $found = no ]; then + echo + 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 +if [ $found != yes ]; then + echo "typedef $found $ngx_type;" >> $NGX_AUTO_CONFIG_H fi diff --git a/auto/types/uintptr_t b/auto/types/uintptr_t index 7c941c0bf..eb375b08d 100644 --- a/auto/types/uintptr_t +++ b/auto/types/uintptr_t @@ -1,27 +1,37 @@ -echo 'checking for uintptr_t' +echo -n "checking for uintptr_t ... " +echo >> $NGX_ERR +echo "checking for uintptr_t" >> $NGX_ERR -FOUND=NO +found=no -echo "#include <sys/types.h>" > autotest.c -echo "$NGX_INTTYPES_H" >> autotest.c -echo "int main() { uintptr_t i = 0; return 0; }" >> autotest.c +cat << END > $NGX_AUTOTEST.c -eval "$CC -o autotest autotest.c > /dev/null 2>&1" +#include <sys/types.h> +$NGX_INTTYPES_H -if [ -x autotest ]; then - echo " + uintptr_t found" - FOUND=YES +int main() { + uintptr_t i = 0; + return 0; +} + +END + +eval "$CC -o $NGX_AUTOTEST $NGX_AUTOTEST.c >> $NGX_ERR 2>&1" + +if [ -x $NGX_AUTOTEST ]; then + echo " uintptr_t found" + found=yes else - echo " + uintptr_t not found" + echo -n " uintptr_t not found" fi -rm autotest* +rm $NGX_AUTOTEST* + +if [ $found = no ]; then + found="uint`expr 8 \* $ngx_ptr_bytes`_t" + echo ", $found used" -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 + echo "typedef $found uintptr_t;" >> $NGX_AUTO_CONFIG_H fi @@ -1,41 +1,41 @@ CC_WARN=$CC -NGX_FMT_COLLECT=YES +ngx_fmt_collect=yes # C types -NGX_TYPE="int"; . auto/types/sizeof; -NGX_FORMATS="%d"; . auto/fmt/fmt +ngx_type="int"; . auto/types/sizeof; +ngx_formats="%d"; . auto/fmt/fmt -NGX_TYPE="long"; . auto/types/sizeof; -NGX_FORMATS="%ld"; . auto/fmt/fmt +ngx_type="long"; . auto/types/sizeof; +ngx_formats="%ld"; . auto/fmt/fmt -NGX_TYPE="long long"; . auto/types/sizeof; -NGX_FORMATS="%lld %qd"; . 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_bytes=$ngx_bytes # headers -NGX_INC="unistd.h"; . auto/inc -NGX_INC="inttypes.h"; . auto/inc +ngx_inc="unistd.h"; . auto/inc +ngx_inc="inttypes.h"; . auto/inc #POSIX types -NGX_AUTO_CONFIG="#include \"$NGX_AUTO_CONFIG_H\"" +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="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 @@ -43,47 +43,53 @@ NGX_TYPES="int"; . auto/types/typedef # printf() formats CC_WARN=$CC_STRONG -NGX_FMT_COLLECT=NO +ngx_fmt_collect=no -NGX_FMT_NAME=OFF_T_FMT -NGX_TYPE="off_t"; . auto/types/sizeof -eval NGX_FORMATS=\${NGX_${NGX_BYTES}_FMT}; . auto/fmt/fmt +ngx_fmt_name=OFF_T_FMT; ngx_type="off_t"; . auto/types/sizeof +eval ngx_formats=\${ngx_${ngx_bytes}_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_fmt_name=TIME_T_FMT; ngx_type="time_t"; . auto/types/sizeof +eval ngx_formats=\${ngx_${ngx_bytes}_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 +ngx_fmt_name=SIZE_T_FMT; ngx_type="size_t"; . auto/types/sizeof +eval ngx_formats=\${ngx_${ngx_bytes}_fmt}; . auto/fmt/fmt -NGX_FMT_NAME=SIZE_T_X_FMT; . auto/fmt/xfmt +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 +ngx_fmt_name=PID_T_FMT; ngx_type="pid_t"; . auto/types/sizeof +eval ngx_formats=\${ngx_${ngx_bytes}_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 +ngx_fmt_name=RLIM_T_FMT; ngx_type="rlim_t"; . auto/types/sizeof +eval ngx_formats=\${ngx_${ngx_bytes}_fmt}; . auto/fmt/fmt # syscalls and libc calls -NGX_FUNC_INC= -NGX_FUNC_TEST="int fd = 0; char buf[1]; size_t size = 1; - ssize_t n; off_t offset = 0; - n = pread(fd, buf, size, offset)" -NGX_FUNC="pread()"; . auto/func +ngx_func="pread()" +ngx_func_inc= +ngx_func_test=" +char buf[1]; +ssize_t n; +n = pread(0, buf, 1, 0)" +. auto/func -NGX_FUNC_INC= -NGX_FUNC_TEST="int fd = 1; char buf[1]; size_t size = 1; - ssize_t n; off_t offset = 0; - n = pwrite(fd, buf, size, offset)" -NGX_FUNC="pwrite()"; . auto/func +ngx_func="pwrite()" +ngx_func_inc= +ngx_func_test=" +char buf[1]; +ssize_t n; +n = pwrite(1, buf, 1, 0)" +. auto/func -NGX_FUNC_INC="#include <time.h>" -NGX_FUNC_TEST="struct tm t; time_t c=0; localtime_r(&c, &t)" -NGX_FUNC="localtime_r()"; . auto/func +ngx_func="strerror_r()" +ngx_func_inc="#include <string.h>" +ngx_func_test="char buf[20]; strerror_r(1, buf, 20)" +. auto/func + + +ngx_func="localtime_r()" +ngx_func_inc="#include <time.h>" +ngx_func_test="struct tm t; time_t c=0; localtime_r(&c, &t)" +. auto/func |