Welcome! Log In Create A New Profile

Advanced

Re: [PATCH] Configure: don't test alternatives if preferred feature is found

June 28, 2016 08:56AM
Hi Piotr,

On Mon, Jun 27, 2016 at 07:55:17PM -0700, Piotr Sikora wrote:
> # HG changeset patch
> # User Piotr Sikora <piotrsikora@google.com>
> # Date 1467064812 25200
> # Mon Jun 27 15:00:12 2016 -0700
> # Node ID e4375e338d9acf927ffdc4cd18c704bb7ea1fd4e
> # Parent d452cb27639f714bc43b7f3ede417e3e7f8efdd6
> Configure: don't test alternatives if preferred feature is found.
>
> Signed-off-by: Piotr Sikora <piotrsikora@google.com>
>
> diff -r d452cb27639f -r e4375e338d9a auto/cc/conf
> --- a/auto/cc/conf
> +++ b/auto/cc/conf
> @@ -197,6 +197,7 @@ if [ "$NGX_PLATFORM" != win32 ]; then
>
> if [ "$NGX_CC_NAME" = "ccc" ]; then
> echo "checking for C99 variadic macros ... disabled"
> + ngx_found=no
> else
> ngx_feature="C99 variadic macros"
> ngx_feature_name="NGX_HAVE_C99_VARIADIC_MACROS"
> @@ -209,20 +210,24 @@ if [ "$NGX_PLATFORM" != win32 ]; then
> var(0, buf, \"%d\", 1);
> if (buf[0] != '1') return 1"
> . auto/feature
> - fi
> + fi
>
>
> - ngx_feature="gcc variadic macros"
> - ngx_feature_name="NGX_HAVE_GCC_VARIADIC_MACROS"
> - ngx_feature_run=yes
> - ngx_feature_incs="#include <stdio.h>
> + if [ $ngx_found = no ]; then
> +
> + ngx_feature="gcc variadic macros"
> + ngx_feature_name="NGX_HAVE_GCC_VARIADIC_MACROS"
> + ngx_feature_run=yes
> + ngx_feature_incs="#include <stdio.h>
> #define var(dummy, args...) sprintf(args)"
> - ngx_feature_path=
> - ngx_feature_libs=
> - ngx_feature_test="char buf[30]; buf[0] = '0';
> - var(0, buf, \"%d\", 1);
> - if (buf[0] != '1') return 1"
> - . auto/feature
> + ngx_feature_path=
> + ngx_feature_libs=
> + ngx_feature_test="char buf[30]; buf[0] = '0';
> + var(0, buf, \"%d\", 1);
> + if (buf[0] != '1') return 1"
> + . auto/feature
> +
> + fi
>
>
> ngx_feature="gcc builtin 64 bit byteswap"
> diff -r d452cb27639f -r e4375e338d9a auto/unix
> --- a/auto/unix
> +++ b/auto/unix
> @@ -184,14 +184,18 @@ ngx_feature_test="fcntl(0, F_READAHEAD,
> . auto/feature
>
>
> -ngx_feature="posix_fadvise()"
> -ngx_feature_name="NGX_HAVE_POSIX_FADVISE"
> -ngx_feature_run=no
> -ngx_feature_incs="#include <fcntl.h>"
> -ngx_feature_path=
> -ngx_feature_libs=
> -ngx_feature_test="posix_fadvise(0, 0, 0, POSIX_FADV_SEQUENTIAL);"
> -. auto/feature
> +if [ $ngx_found = no ]; then
> +
> + ngx_feature="posix_fadvise()"
> + ngx_feature_name="NGX_HAVE_POSIX_FADVISE"
> + ngx_feature_run=no
> + ngx_feature_incs="#include <fcntl.h>"
> + ngx_feature_path=
> + ngx_feature_libs=
> + ngx_feature_test="posix_fadvise(0, 0, 0, POSIX_FADV_SEQUENTIAL);"
> + . auto/feature
> +
> +fi

So far I have mixed feelings about this patch, but if it gets
accepted then the compile-time condition for ngx_read_ahead()
in src/os/unix/ngx_files.c can be simplified to only test
NGX_HAVE_POSIX_FADVISE. Also, there is the currently unused
macro NGX_HAVE_READ_AHEAD.

>
>
> ngx_feature="O_DIRECT"
> @@ -208,25 +212,34 @@ if [ $ngx_found = yes -a "$NGX_SYSTEM" =
> have=NGX_HAVE_ALIGNED_DIRECTIO . auto/have
> fi
>
> -ngx_feature="F_NOCACHE"
> -ngx_feature_name="NGX_HAVE_F_NOCACHE"
> -ngx_feature_run=no
> -ngx_feature_incs="#include <fcntl.h>"
> -ngx_feature_path=
> -ngx_feature_libs=
> -ngx_feature_test="fcntl(0, F_NOCACHE, 1);"
> -. auto/feature
>
> +if [ $ngx_found = no ]; then
>
> -ngx_feature="directio()"
> -ngx_feature_name="NGX_HAVE_DIRECTIO"
> -ngx_feature_run=no
> -ngx_feature_incs="#include <sys/types.h>
> - #include <sys/fcntl.h>"
> -ngx_feature_path=
> -ngx_feature_libs=
> -ngx_feature_test="directio(0, DIRECTIO_ON);"
> -. auto/feature
> + ngx_feature="F_NOCACHE"
> + ngx_feature_name="NGX_HAVE_F_NOCACHE"
> + ngx_feature_run=no
> + ngx_feature_incs="#include <fcntl.h>"
> + ngx_feature_path=
> + ngx_feature_libs=
> + ngx_feature_test="fcntl(0, F_NOCACHE, 1);"
> + . auto/feature
> +
> +fi
> +
> +
> +if [ $ngx_found = no ]; then
> +
> + ngx_feature="directio()"
> + ngx_feature_name="NGX_HAVE_DIRECTIO"
> + ngx_feature_run=no
> + ngx_feature_incs="#include <sys/types.h>
> + #include <sys/fcntl.h>"
> + ngx_feature_path=
> + ngx_feature_libs=
> + ngx_feature_test="directio(0, DIRECTIO_ON);"
> + . auto/feature
> +
> +fi
>
>
> ngx_feature="statfs()"
> @@ -242,16 +255,20 @@ ngx_feature_test="struct statfs fs;
> . auto/feature
>
>
> -ngx_feature="statvfs()"
> -ngx_feature_name="NGX_HAVE_STATVFS"
> -ngx_feature_run=no
> -ngx_feature_incs="#include <sys/types.h>
> - #include <sys/statvfs.h>"
> -ngx_feature_path=
> -ngx_feature_libs=
> -ngx_feature_test="struct statvfs fs;
> - statvfs(\".\", &fs);"
> -. auto/feature
> +if [ $ngx_found = no ]; then
> +
> + ngx_feature="statvfs()"
> + ngx_feature_name="NGX_HAVE_STATVFS"
> + ngx_feature_run=no
> + ngx_feature_incs="#include <sys/types.h>
> + #include <sys/statvfs.h>"
> + ngx_feature_path=
> + ngx_feature_libs=
> + ngx_feature_test="struct statvfs fs;
> + statvfs(\".\", &fs);"
> + . auto/feature
> +
> +fi
>
>
> ngx_feature="dlopen()"
> @@ -356,28 +373,36 @@ ngx_feature_test="setsockopt(0, IPPROTO_
>
> # Linux transparent proxying
>
> -ngx_feature="IP_TRANSPARENT"
> -ngx_feature_name="NGX_HAVE_TRANSPARENT_PROXY"
> -ngx_feature_run=no
> -ngx_feature_incs="#include <sys/socket.h>
> - #include <netinet/in.h>"
> -ngx_feature_path=
> -ngx_feature_libs=
> -ngx_feature_test="setsockopt(0, IPPROTO_IP, IP_TRANSPARENT, NULL, 0)"
> -. auto/feature
> +if [ $ngx_found = no ]; then
> +
> + ngx_feature="IP_TRANSPARENT"
> + ngx_feature_name="NGX_HAVE_TRANSPARENT_PROXY"
> + ngx_feature_run=no
> + ngx_feature_incs="#include <sys/socket.h>
> + #include <netinet/in.h>"
> + ngx_feature_path=
> + ngx_feature_libs=
> + ngx_feature_test="setsockopt(0, IPPROTO_IP, IP_TRANSPARENT, NULL, 0)"
> + . auto/feature
> +
> +fi
>
>
> # FreeBSD bind to any address for transparent proxying
>
> -ngx_feature="IP_BINDANY"
> -ngx_feature_name="NGX_HAVE_TRANSPARENT_PROXY"
> -ngx_feature_run=no
> -ngx_feature_incs="#include <sys/socket.h>
> - #include <netinet/in.h>"
> -ngx_feature_path=
> -ngx_feature_libs=
> -ngx_feature_test="setsockopt(0, IPPROTO_IP, IP_BINDANY, NULL, 0)"
> -. auto/feature
> +if [ $ngx_found = no ]; then
> +
> + ngx_feature="IP_BINDANY"
> + ngx_feature_name="NGX_HAVE_TRANSPARENT_PROXY"
> + ngx_feature_run=no
> + ngx_feature_incs="#include <sys/socket.h>
> + #include <netinet/in.h>"
> + ngx_feature_path=
> + ngx_feature_libs=
> + ngx_feature_test="setsockopt(0, IPPROTO_IP, IP_BINDANY, NULL, 0)"
> + . auto/feature
> +
> +fi
>
>
> # BSD way to get IPv4 datagram destination address
> @@ -395,15 +420,19 @@ ngx_feature_test="setsockopt(0, IPPROTO_
>
> # Linux way to get IPv4 datagram destination address
>
> -ngx_feature="IP_PKTINFO"
> -ngx_feature_name="NGX_HAVE_IP_PKTINFO"
> -ngx_feature_run=no
> -ngx_feature_incs="#include <sys/socket.h>
> - #include <netinet/in.h>"
> -ngx_feature_path=
> -ngx_feature_libs=
> -ngx_feature_test="setsockopt(0, IPPROTO_IP, IP_PKTINFO, NULL, 0)"
> -. auto/feature
> +if [ $ngx_found = no ]; then
> +
> + ngx_feature="IP_PKTINFO"
> + ngx_feature_name="NGX_HAVE_IP_PKTINFO"
> + ngx_feature_run=no
> + ngx_feature_incs="#include <sys/socket.h>
> + #include <netinet/in.h>"
> + ngx_feature_path=
> + ngx_feature_libs=
> + ngx_feature_test="setsockopt(0, IPPROTO_IP, IP_PKTINFO, NULL, 0)"
> + . auto/feature
> +
> +fi
>
>
> # RFC 3542 way to get IPv6 datagram destination address
> @@ -772,16 +801,20 @@ ngx_feature_test="void *p; int n; n = po
> . auto/feature
>
>
> -ngx_feature="memalign()"
> -ngx_feature_name="NGX_HAVE_MEMALIGN"
> -ngx_feature_run=no
> -ngx_feature_incs="#include <stdlib.h>
> - #include <malloc.h>"
> -ngx_feature_path=
> -ngx_feature_libs=
> -ngx_feature_test="void *p; p = memalign(4096, 4096);
> - if (p == NULL) return 1"
> -. auto/feature
> +if [ $ngx_found = no ]; then
> +
> + ngx_feature="memalign()"
> + ngx_feature_name="NGX_HAVE_MEMALIGN"
> + ngx_feature_run=no
> + ngx_feature_incs="#include <stdlib.h>
> + #include <malloc.h>"
> + ngx_feature_path=
> + ngx_feature_libs=
> + ngx_feature_test="void *p; p = memalign(4096, 4096);
> + if (p == NULL) return 1"
> + . auto/feature
> +
> +fi
>
>
> ngx_feature="mmap(MAP_ANON|MAP_SHARED)"
> @@ -797,33 +830,42 @@ ngx_feature_test="void *p;
> . auto/feature
>
>
> -ngx_feature='mmap("/dev/zero", MAP_SHARED)'
> -ngx_feature_name="NGX_HAVE_MAP_DEVZERO"
> -ngx_feature_run=yes
> -ngx_feature_incs="#include <sys/mman.h>
> - #include <sys/stat.h>
> - #include <fcntl.h>"
> -ngx_feature_path=
> -ngx_feature_libs=
> -ngx_feature_test='void *p; int fd;
> - fd = open("/dev/zero", O_RDWR);
> - p = mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
> - if (p == MAP_FAILED) return 1;'
> -. auto/feature
> +if [ $ngx_found = no ]; then
>
> + ngx_feature='mmap("/dev/zero", MAP_SHARED)'
> + ngx_feature_name="NGX_HAVE_MAP_DEVZERO"
> + ngx_feature_run=yes
> + ngx_feature_incs="#include <sys/mman.h>
> + #include <sys/stat.h>
> + #include <fcntl.h>"
> + ngx_feature_path=
> + ngx_feature_libs=
> + ngx_feature_test='void *p; int fd;
> + fd = open("/dev/zero", O_RDWR);
> + p = mmap(NULL, 4096, PROT_READ|PROT_WRITE,
> + MAP_SHARED, fd, 0);
> + if (p == MAP_FAILED) return 1;'
> + . auto/feature
>
> -ngx_feature="System V shared memory"
> -ngx_feature_name="NGX_HAVE_SYSVSHM"
> -ngx_feature_run=yes
> -ngx_feature_incs="#include <sys/ipc.h>
> - #include <sys/shm.h>"
> -ngx_feature_path=
> -ngx_feature_libs=
> -ngx_feature_test="int id;
> - id = shmget(IPC_PRIVATE, 4096, (SHM_R|SHM_W|IPC_CREAT));
> - if (id == -1) return 1;
> - shmctl(id, IPC_RMID, NULL);"
> -. auto/feature
> +fi
> +
> +
> +if [ $ngx_found = no ]; then
> +
> + ngx_feature="System V shared memory"
> + ngx_feature_name="NGX_HAVE_SYSVSHM"
> + ngx_feature_run=yes
> + ngx_feature_incs="#include <sys/ipc.h>
> + #include <sys/shm.h>"
> + ngx_feature_path=
> + ngx_feature_libs=
> + ngx_feature_test="int id;
> + id = shmget(IPC_PRIVATE, 4096, (SHM_R|SHM_W|IPC_CREAT));
> + if (id == -1) return 1;
> + shmctl(id, IPC_RMID, NULL);"
> + . auto/feature
> +
> +fi
>
>
> ngx_feature="POSIX semaphores"
>
> _______________________________________________
> nginx-devel mailing list
> nginx-devel@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx-devel
>

--
Ruslan Ermilov
Assume stupidity not malice

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[PATCH] Configure: don't test alternatives if preferred feature is found

Piotr Sikora 604 June 27, 2016 10:58PM

Re: [PATCH] Configure: don't test alternatives if preferred feature is found

ru@nginx.com 610 June 28, 2016 08:56AM

Re: [PATCH] Configure: don't test alternatives if preferred feature is found

Maxim Dounin 385 June 28, 2016 09:26AM

Re: [PATCH] Configure: don't test alternatives if preferred feature is found

Piotr Sikora 385 June 28, 2016 05:26PM

Re: [PATCH] Configure: don't test alternatives if preferred feature is found

Piotr Sikora 385 June 28, 2016 05:18PM

[PATCH] Configure: don't test alternatives if preferred feature is found

Piotr Sikora 405 June 28, 2016 06:28PM

[PATCH] Configure: don't test alternatives if preferred feature is found

Piotr Sikora 377 June 28, 2016 06:30PM

Re: [PATCH] Configure: don't test alternatives if preferred feature is found

Maxim Dounin 385 June 30, 2016 10:18AM

Re: [PATCH] Configure: don't test alternatives if preferred feature is found

Piotr Sikora 440 June 30, 2016 03:46PM

[PATCH] Configure: don't test alternatives if preferred feature is found

Piotr Sikora 392 June 30, 2016 03:46PM

[PATCH] Configure: don't test alternatives if preferred feature is found

Piotr Sikora 381 June 30, 2016 03:54PM

Re: [PATCH] Configure: don't test alternatives if preferred feature is found

Piotr Sikora 398 June 30, 2016 03:58PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 274
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready