Skip to content

Commit 9e4960e

Browse files
committed
Add --disable-epoll.
1 parent 737a8bd commit 9e4960e

2 files changed

Lines changed: 21 additions & 7 deletions

File tree

Tools/configure/conf_platform.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212

1313
import pyconf
1414

15+
DISABLE_EPOLL = pyconf.arg_enable(
16+
"epoll", help="disable epoll (default is yes if supported)"
17+
)
18+
1519

1620
def setup_machdep(v):
1721
"""Detect MACHDEP from uname or cross-compile host triplet."""
@@ -830,10 +834,14 @@ def check_special_functions(v):
830834
pyconf.check_func("fchdir", headers=["unistd.h"])
831835
pyconf.check_func("fsync", headers=["unistd.h"])
832836
pyconf.check_func("fdatasync", headers=["unistd.h"])
833-
pyconf.check_func(
834-
"epoll_create", headers=["sys/epoll.h"], define="HAVE_EPOLL"
835-
)
836-
pyconf.check_func("epoll_create1", headers=["sys/epoll.h"])
837+
disable_epoll = DISABLE_EPOLL.is_no()
838+
pyconf.checking("for --disable-epoll")
839+
pyconf.result("yes" if disable_epoll else "no")
840+
if not disable_epoll:
841+
pyconf.check_func(
842+
"epoll_create", headers=["sys/epoll.h"], define="HAVE_EPOLL"
843+
)
844+
pyconf.check_func("epoll_create1", headers=["sys/epoll.h"])
837845
pyconf.check_func("kqueue", headers=["sys/types.h", "sys/event.h"])
838846
pyconf.check_func("prlimit", headers=["sys/time.h", "sys/resource.h"])
839847
pyconf.check_func(

Tools/configure/configure.awk

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2588,6 +2588,7 @@ function _pyconf_register_options() {
25882588
pyconf_arg_enable("bolt", "", "enable usage of the llvm-bolt post-link optimizer (default is no)", "", "", "no")
25892589
pyconf_arg_with("platlibdir", "", "Python library directory name (default is \"lib\")", "", "", "")
25902590
pyconf_arg_with("wheel_pkg_dir", "", "Directory of wheel packages used by ensurepip (default: none)", "", "", "")
2591+
pyconf_arg_enable("epoll", "", "disable epoll (default is yes if supported)", "", "", "")
25912592
pyconf_arg_with("c_locale_coercion", "yes", "enable C locale coercion to a UTF-8 based locale (default is yes)", "", "", "")
25922593
pyconf_arg_with("openssl", "", "root of the OpenSSL directory", "DIR", "", "")
25932594
pyconf_arg_with("openssl_rpath", "", "Set runtime library directory (rpath) for OpenSSL libraries, no (default): don't set rpath, auto: auto-detect from --with-openssl and pkg-config, DIR: set an explicit rpath", "DIR|auto|no", "", "")
@@ -6784,7 +6785,7 @@ function u_check_posix_functions( ANDROID_API_LEVEL, _i_name, blocked_len, ma
67846785
}
67856786
}
67866787

6787-
function u_check_special_functions( _pyconf_cond_sys_eventfd_h, _pyconf_cond_sys_memfd_h, _pyconf_cond_sys_mman_h, _pyconf_cond_sys_timerfd_h, ac_cv_have_chflags, ac_cv_have_lchflags) {
6788+
function u_check_special_functions( _pyconf_cond_sys_eventfd_h, _pyconf_cond_sys_memfd_h, _pyconf_cond_sys_mman_h, _pyconf_cond_sys_timerfd_h, ac_cv_have_chflags, ac_cv_have_lchflags, disable_epoll) {
67886789
pyconf_checking("whether dirfd is declared")
67896790
if (pyconf_check_decl("dirfd", "sys/types.h dirent.h", "HAVE_DIRFD")) {
67906791
pyconf_result("yes")
@@ -6797,8 +6798,13 @@ function u_check_special_functions( _pyconf_cond_sys_eventfd_h, _pyconf_cond_
67976798
pyconf_check_func("fchdir", "unistd.h", "HAVE_FCHDIR")
67986799
pyconf_check_func("fsync", "unistd.h", "HAVE_FSYNC")
67996800
pyconf_check_func("fdatasync", "unistd.h", "HAVE_FDATASYNC")
6800-
pyconf_check_func("epoll_create", "sys/epoll.h", "HAVE_EPOLL")
6801-
pyconf_check_func("epoll_create1", "sys/epoll.h", "HAVE_EPOLL_CREATE1")
6801+
disable_epoll = (pyconf_option_is_no("enable_epoll") ? "yes" : "no")
6802+
pyconf_checking("for --disable-epoll")
6803+
pyconf_result((((disable_epoll != "") && (disable_epoll != "no")) ? "yes" : "no"))
6804+
if ((!((disable_epoll != "") && (disable_epoll != "no")))) {
6805+
pyconf_check_func("epoll_create", "sys/epoll.h", "HAVE_EPOLL")
6806+
pyconf_check_func("epoll_create1", "sys/epoll.h", "HAVE_EPOLL_CREATE1")
6807+
}
68026808
pyconf_check_func("kqueue", "sys/types.h sys/event.h", "HAVE_KQUEUE")
68036809
pyconf_check_func("prlimit", "sys/time.h sys/resource.h", "HAVE_PRLIMIT")
68046810
pyconf_check_func("_dyld_shared_cache_contains_path", "mach-o/dyld.h", "HAVE_DYLD_SHARED_CACHE_CONTAINS_PATH")

0 commit comments

Comments
 (0)