From d8ddf1307aec129f1e8da74ee0be01dd83f86c0d Mon Sep 17 00:00:00 2001 From: Lauri Nurmi Date: Thu, 24 Feb 2022 17:51:44 +0200 Subject: [PATCH] Fix compilation on recent FreeBSDs by ignoring On recent FreeBSDs, the "Linux-only" exists in the default include path, and is thus detected by configure. However, the header belongs to the epoll-shim emulation library, and it is doubtful whether using it on FreeBSD is a good idea. Therefore check that the operating system is actually Linux before enabling wxEpollDispatcher. Closes #22146. --- configure | 10 +++++++++- configure.in | 11 ++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/configure b/configure index e3a87f8cca..f1132b8694 100755 --- a/configure +++ b/configure @@ -35642,8 +35642,16 @@ fi done if test "$ac_cv_header_sys_epoll_h" = "yes"; then - $as_echo "#define wxUSE_EPOLL_DISPATCHER 1" >>confdefs.h + case "${host}" in + *-*-linux*) + $as_echo "#define wxUSE_EPOLL_DISPATCHER 1" >>confdefs.h + ;; + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: wxEpollDispatcher disabled, because OS is not Linux" >&5 +$as_echo "$as_me: WARNING: wxEpollDispatcher disabled, because OS is not Linux" >&2;} + ;; + esac else { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: sys/epoll.h not available, wxEpollDispatcher disabled" >&5 $as_echo "$as_me: WARNING: sys/epoll.h not available, wxEpollDispatcher disabled" >&2;} diff --git a/configure.in b/configure.in index 9fed41a9ae..16ff78cc72 100644 --- a/configure.in +++ b/configure.in @@ -6254,7 +6254,16 @@ if test "$wxUSE_CONSOLE_EVENTLOOP" = "yes"; then if test "$wxUSE_EPOLL_DISPATCHER" = "yes"; then AC_CHECK_HEADERS(sys/epoll.h,,, [AC_INCLUDES_DEFAULT()]) if test "$ac_cv_header_sys_epoll_h" = "yes"; then - AC_DEFINE(wxUSE_EPOLL_DISPATCHER) + dnl On FreeBSD or other *BSD sys/epoll.h may exist, but require + dnl linking with extra libraries, so we use epoll on Linux only. + case "${host}" in + *-*-linux*) + AC_DEFINE(wxUSE_EPOLL_DISPATCHER) + ;; + *) + AC_MSG_WARN([wxEpollDispatcher disabled, because OS is not Linux]) + ;; + esac else AC_MSG_WARN([sys/epoll.h not available, wxEpollDispatcher disabled]) fi