11#[=============================================================================[ 
2- Check for items required by  listening queue implemented in FPM . 
2+ Check FPM  listening queue implementation . 
33
4- Cache variables:  
4+ ##  Cache variables
55
66* `HAVE_LQ_TCP_INFO` 
7+ 
78  Whether `TCP_INFO` is present. 
9+ 
810* `HAVE_LQ_TCP_CONNECTION_INFO` 
11+ 
912  Whether `TCP_CONNECTION_INFO` is present. 
13+ 
1014* `HAVE_LQ_SO_LISTENQ` 
15+ 
1116  Whether `SO_LISTENQLEN` and `SO_LISTENQLIMIT` are available as alternative to 
1217  `TCP_INFO` and `TCP_CONNECTION_INFO`. 
1318#]=============================================================================] 
@@ -18,7 +23,8 @@ include(CheckSourceCompiles)
1823include (CMakePushCheckState)
1924include (PHP/SystemExtensions)
2025
21- message (CHECK_START "Checking for TCP_INFO" )
26+ message (CHECK_START "Checking FPM listening queue implementation" )
27+ 
2228cmake_push_check_state(RESET)
2329  # Requires _DEFAULT_SOURCE, which is enabled by _GNU_SOURCE. 
2430  set (CMAKE_REQUIRED_LIBRARIES PHP::SystemExtensions)
@@ -36,36 +42,26 @@ cmake_push_check_state(RESET)
3642    }
3743  ]] HAVE_LQ_TCP_INFO)
3844cmake_pop_check_state()
39- if (HAVE_LQ_TCP_INFO)
40-   message (CHECK_PASS "yes" )
41- else ()
42-   message (CHECK_FAIL "no" )
43- endif ()
4445
4546# For macOS. 
46- message (CHECK_START "Checking for TCP_CONNECTION_INFO" )
47- check_source_compiles(C [[
48-   #include <netinet/tcp.h>
49- 
50-   int main(void)
51-   {
52-     struct tcp_connection_info ti;
53-     int x = TCP_CONNECTION_INFO;
54-     (void)ti;
55-     (void)x;
56- 
57-     return 0;
58-   }
59- ]] HAVE_LQ_TCP_CONNECTION_INFO)
60- if (HAVE_LQ_TCP_CONNECTION_INFO)
61-   message (CHECK_PASS "yes" )
62- else ()
63-   message (CHECK_FAIL "no" )
47+ if (NOT  HAVE_LQ_TCP_INFO)
48+   check_source_compiles(C [[
49+     #include <netinet/tcp.h>
50+ 
51+     int main(void)
52+     {
53+       struct tcp_connection_info ti;
54+       int x = TCP_CONNECTION_INFO;
55+       (void)ti;
56+       (void)x;
57+ 
58+       return 0;
59+     }
60+   ]] HAVE_LQ_TCP_CONNECTION_INFO)
6461endif ()
6562
6663# For FreeBSD. 
67- if (NOT  HAVE_LQ_TCP_INFO AND  NOT  HAVE_LQ_TCP_CONNECTION_INFO)
68-   message (CHECK_START "Checking for SO_LISTENQLEN and SO_LISTENQLIMIT" )
64+ if (NOT  HAVE_LQ_TCP_INFO AND  NOT  HAVE_LQ_TCP_INFO)
6965  check_source_compiles(C [[
7066    #include <sys/socket.h>
7167
@@ -79,9 +75,10 @@ if(NOT HAVE_LQ_TCP_INFO AND NOT HAVE_LQ_TCP_CONNECTION_INFO)
7975      return 0;
8076    }
8177  ]] HAVE_LQ_SO_LISTENQ)
82-   if (HAVE_LQ_SO_LISTENQ)
83-     message (CHECK_PASS "yes" )
84-   else ()
85-     message (CHECK_FAIL "no" )
86-   endif ()
78+ endif ()
79+ 
80+ if (HAVE_LQ_TCP_INFO OR  HAVE_LQ_TCP_CONNECTION_INFO OR  HAVE_LQ_SO_LISTENQ)
81+   message (CHECK_PASS "found" )
82+ else ()
83+   message (CHECK_FAIL "not found, FPM listening queue is disabled" )
8784endif ()
0 commit comments