From a16409280d9be2a2657fbe3060fe7c32b140013a Mon Sep 17 00:00:00 2001 From: Todd White Date: Thu, 13 Aug 2026 21:52:24 -0400 Subject: [PATCH] Require all the CFRunLoop headers together AC_CHECK_HEADERS runs its action once per header it finds, so finding unistd.h alone was enough to reach AC_SEARCH_LIBS and define HAVE_CFRUNLOOP_SUPPORT. On a host without poll.h the result is a config.h carrying HAVE_CFRUNLOOP_SUPPORT 1 next to an undefined HAVE_POLL_H, and the build then fails in CFRunLoop.c on the missing header. Collect the results and decide once. --- configure.ac | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/configure.ac b/configure.ac index d9beb3e..d2401b2 100644 --- a/configure.ac +++ b/configure.ac @@ -99,12 +99,15 @@ AC_ARG_ENABLE(cfrunloop, Disables CFRunLoop support and requiring pthread. Must be passed when building on Windows.], [], - [AC_CHECK_HEADERS([unistd.h fcntl.h poll.h limits.h pthread.h], - [AC_SEARCH_LIBS(pthread_join, [pthread pthreadG32 pthreadVC2], - [AC_DEFINE(HAVE_CFRUNLOOP_SUPPORT, 1, - [Define to 1 if the required libraries and headers for CFRunLoop are present.])], - [AC_MSG_ERROR([Missing pthread library for CFRunLoop support.])])], - [AC_MSG_ERROR([Missing headers for CFRunLoop support.])])]) + [gs_cv_cfrunloop_headers=yes + AC_CHECK_HEADERS([unistd.h fcntl.h poll.h limits.h pthread.h], [], + [gs_cv_cfrunloop_headers=no]) + AS_IF([test "x$gs_cv_cfrunloop_headers" = "xyes"], + [AC_SEARCH_LIBS(pthread_join, [pthread pthreadG32 pthreadVC2], + [AC_DEFINE(HAVE_CFRUNLOOP_SUPPORT, 1, + [Define to 1 if the required libraries and headers for CFRunLoop are present.])], + [AC_MSG_ERROR([Missing pthread library for CFRunLoop support.])])], + [AC_MSG_ERROR([Missing headers for CFRunLoop support.])])]) #--- # Check for ICU