Fix compilation on recent FreeBSDs by ignoring <sys/epoll.h>

On recent FreeBSDs, the "Linux-only" <sys/epoll.h> 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.
This commit is contained in:
Lauri Nurmi
2022-02-24 17:51:44 +02:00
committed by Vadim Zeitlin
parent 9129254574
commit d8ddf1307a
2 changed files with 19 additions and 2 deletions

10
configure vendored
View File

@@ -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;}

View File

@@ -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