Skip to content

Commit 47cbd66

Browse files
authored
Refactor FPM checks (#8)
- Cross-compilation enhancements to be able to set PROC_MEM_FILE - mach_vm_read check simplified as the signature is a bit different vm_map_read_t vs vm_map_t first argument. The `check_symbol_exists()` is sufficient check in this case and avoids writing entire signature. - clock_get*time() check moved to fpm's CMakeLists.txt directly - Some FPM checks now have a bit simpler configure log/output messages - The toolchains template improved and refactored - Fixed some nits in FindNetSnmp module
1 parent 828f093 commit 47cbd66

File tree

6 files changed

+413
-402
lines changed

6 files changed

+413
-402
lines changed

cmake/cmake/modules/FindNetSnmp.cmake

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,20 @@ Module defines the following `IMPORTED` target(s):
55
66
* `NetSnmp::NetSnmp` - The package library, if found.
77
8-
Result variables:
8+
## Result variables
99
1010
* `NetSnmp_FOUND` - Whether the package has been found.
1111
*` NetSnmp_INCLUDE_DIRS` - Include directories needed to use this package.
1212
*` NetSnmp_LIBRARIES` - Libraries needed to link to the package library.
1313
* `NetSnmp_VERSION` - Package version, if found.
1414
15-
Cache variables:
15+
## Cache variables
1616
1717
* `NetSnmp_INCLUDE_DIR` - Directory containing package library headers.
1818
* `NetSnmp_LIBRARY` - The path to the package library.
1919
* `NetSnmp_EXECUTABLE` - Path to net-snmp-config utility.
2020
21-
Hints:
21+
## Hints
2222
2323
The `NetSnmp_ROOT` variable adds custom search path.
2424
#]=============================================================================]
@@ -60,13 +60,19 @@ if(NetSnmp_EXECUTABLE)
6060
string(APPEND _netsnmp_config_include_dir "/include")
6161
endif()
6262

63-
# TODO: To be added.
63+
# TODO: To be added when linking static NetSnmp library.
6464
execute_process(
6565
COMMAND "${NetSnmp_EXECUTABLE}" --external-libs
6666
OUTPUT_VARIABLE _netsnmp_config_external_libraries
6767
OUTPUT_STRIP_TRAILING_WHITESPACE
6868
ERROR_QUIET
6969
)
70+
separate_arguments(
71+
_netsnmp_config_external_libraries
72+
NATIVE_COMMAND
73+
"${_netsnmp_config_external_libraries}"
74+
)
75+
list(FILTER _netsnmp_config_external_libraries INCLUDE REGEX "^(-L|-l)")
7076

7177
execute_process(
7278
COMMAND "${NetSnmp_EXECUTABLE}" --libdir

cmake/cmake/modules/PHP/CheckClockGettime.cmake

Lines changed: 0 additions & 77 deletions
This file was deleted.
Lines changed: 30 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
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)
1823
include(CMakePushCheckState)
1924
include(PHP/SystemExtensions)
2025

21-
message(CHECK_START "Checking for TCP_INFO")
26+
message(CHECK_START "Checking FPM listening queue implementation")
27+
2228
cmake_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)
3844
cmake_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)
6461
endif()
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")
8784
endif()

0 commit comments

Comments
 (0)