[PATCH] Configure: don't test alternatives if preferred feature is found
Piotr Sikora
piotrsikora at google.com
Tue Jun 28 22:26:14 UTC 2016
# HG changeset patch
# User Piotr Sikora <piotrsikora at google.com>
# Date 1467064812 25200
# Mon Jun 27 15:00:12 2016 -0700
# Node ID d1974e5bf34e45539bd2a4b3d08924fd3ed01639
# Parent d452cb27639f714bc43b7f3ede417e3e7f8efdd6
Configure: don't test alternatives if preferred feature is found.
While there, remove unused NGX_HAVE_READ_AHEAD.
Signed-off-by: Piotr Sikora <piotrsikora at google.com>
diff -r d452cb27639f -r d1974e5bf34e 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 d1974e5bf34e 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
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"
diff -r d452cb27639f -r d1974e5bf34e src/os/unix/ngx_files.c
--- a/src/os/unix/ngx_files.c
+++ b/src/os/unix/ngx_files.c
@@ -805,7 +805,7 @@ ngx_unlock_fd(ngx_fd_t fd)
}
-#if (NGX_HAVE_POSIX_FADVISE) && !(NGX_HAVE_F_READAHEAD)
+#if (NGX_HAVE_POSIX_FADVISE)
ngx_int_t
ngx_read_ahead(ngx_fd_t fd, size_t n)
diff -r d452cb27639f -r d1974e5bf34e src/os/unix/ngx_files.h
--- a/src/os/unix/ngx_files.h
+++ b/src/os/unix/ngx_files.h
@@ -303,15 +303,11 @@ ngx_err_t ngx_unlock_fd(ngx_fd_t fd);
#if (NGX_HAVE_F_READAHEAD)
-#define NGX_HAVE_READ_AHEAD 1
-
#define ngx_read_ahead(fd, n) fcntl(fd, F_READAHEAD, (int) n)
#define ngx_read_ahead_n "fcntl(fd, F_READAHEAD)"
#elif (NGX_HAVE_POSIX_FADVISE)
-#define NGX_HAVE_READ_AHEAD 1
-
ngx_int_t ngx_read_ahead(ngx_fd_t fd, size_t n);
#define ngx_read_ahead_n "posix_fadvise(POSIX_FADV_SEQUENTIAL)"
More information about the nginx-devel
mailing list