From: Howard Chu Date: Tue, 9 Dec 2025 17:45:27 +0000 (+0000) Subject: ITS#10306 configure: use cache for epoll/kqueue checks X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=09d24f1484d8dad2f636536b9a542675c23e1698;p=thirdparty%2Fopenldap.git ITS#10306 configure: use cache for epoll/kqueue checks --- diff --git a/configure.ac b/configure.ac index 82e4edabd0..a8f797fc3d 100644 --- a/configure.ac +++ b/configure.ac @@ -968,7 +968,8 @@ fi dnl ---------------------------------------------------------------- AC_CHECK_HEADERS( sys/epoll.h ) if test "${ac_cv_header_sys_epoll_h}" = yes; then - AC_MSG_CHECKING(for epoll system call) + AC_CACHE_CHECK([AC_LANG_SOURCE([for epoll system call])], + ol_cv_have_epoll,[ AC_RUN_IFELSE([AC_LANG_SOURCE([[#include #ifdef HAVE_SYS_POLL_H #include @@ -977,14 +978,20 @@ int main(int argc, char **argv) { int epfd = epoll_create(256); exit (epfd == -1 ? 1 : 0); -}]])],[AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_EPOLL,1, [define if your system supports epoll])],[AC_MSG_RESULT(no)],[AC_MSG_RESULT(no)]) +}]])], + [ol_cv_have_epoll=yes], + [ol_cv_have_epoll=no], + [ol_cv_have_epoll=no])]) + if test $ol_cv_have_epoll = yes ; then + AC_DEFINE(HAVE_EPOLL,1, [define if your system supports epoll]) + fi fi dnl ---------------------------------------------------------------- AC_CHECK_HEADERS( sys/event.h ) if test "${ac_cv_header_sys_event_h}" = yes; then -AC_MSG_CHECKING(for kqueue system call) + AC_CACHE_CHECK([AC_LANG_SOURCE([for kqueue system call])], + ol_cv_have_kqueue,[ AC_RUN_IFELSE([AC_LANG_SOURCE([[$ac_includes_default #ifdef HAVE_SYS_EVENT_H #include @@ -996,8 +1003,13 @@ int main(int argc, char **argv) { int kqfd = kqueue(); exit (kqfd == -1 ? 1 : 0); -}]])],[AC_MSG_RESULT(yes) -AC_DEFINE(HAVE_KQUEUE,1, [define if your system supports kqueue])],[AC_MSG_RESULT(no)],[AC_MSG_RESULT(no)]) +}]])], + [ol_cv_have_kqueue=yes], + [ol_cv_have_kqueue=no], + [ol_cv_have_kqueue=no])]) + if test $ol_cv_have_kqueue = yes ; then + AC_DEFINE(HAVE_KQUEUE,1, [define if your system supports kqueue]) + fi fi dnl ---------------------------------------------------------------- @@ -1006,13 +1018,19 @@ dnl "/dev/poll" needs as well... if test "${ac_cv_header_sys_devpoll_h}" = yes \ -a "${ac_cv_header_poll_h}" = yes ; \ then - AC_MSG_CHECKING(for /dev/poll) + AC_CACHE_CHECK([AC_LANG_SOURCE([for /dev/poll])], + ol_cv_have_devpoll,[ AC_RUN_IFELSE([AC_LANG_SOURCE([[int main(int argc, char **argv) { int devpollfd = open("/dev/poll", /* O_RDWR */ 2); exit (devpollfd == -1 ? 1 : 0); -}]])],[AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_DEVPOLL,1, [define if your system supports /dev/poll])],[AC_MSG_RESULT(no)],[AC_MSG_RESULT(no)]) +}]])], + [ol_cv_have_devpoll=yes], + [ol_cv_have_devpoll=no], + [ol_cv_have_devpoll=no])]) + if test $ol_cv_have_devpoll = yes ; then + AC_DEFINE(HAVE_DEVPOLL,1, [define if your system supports /dev/poll]) + fi fi dnl ----------------------------------------------------------------