Skip to content

Commit a1c7c96

Browse files
committed
Fixes in configure tests
Disable kqueue if neither NOTE_CLOSE nor NOTE_CLOSE_WRITE is defined. Fix test for syscalls used by fakedns.
1 parent 298b988 commit a1c7c96

1 file changed

Lines changed: 24 additions & 7 deletions

File tree

configure.ac

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,13 @@ AC_ARG_ENABLE([dns-tests],
7777

7878
if test $status_dns_tests = yes; then
7979
AC_COMPILE_IFELSE(
80-
[AC_LANG_PROGRAM([
80+
[AC_LANG_PROGRAM([[
8181
#include <sys/syscall.h>
82-
int x[] = { SYS_connect, SYS_sendto, SYS_recvfrom };
83-
],
84-
[[void main(){}]])],
85-
[],
86-
[status_dns_tests=no])
82+
int x[1] = { SYS_connect, SYS_sendto, SYS_recvfrom };
83+
]],
84+
[return 0;])],
85+
[],
86+
[status_dns_tests=no])
8787
fi
8888

8989
AM_CONDITIONAL([COND_BUILD_FAKEDNS], [test "$status_dns_tests" = yes])
@@ -238,7 +238,24 @@ AC_CHECK_FUNCS([inotify_init kqueue])
238238
if test "$ac_cv_header_sys_inotify_h/$ac_cv_func_inotify_init" = yes/yes; then
239239
status_fsevmon=inotify
240240
elif test "$ac_cv_header_sys_event_h/$ac_cv_func_kqueue" = yes/yes; then
241-
status_fsevmon=kqueue
241+
# The code in src/watcher/kqueue.c relies on kqueue being able to report
242+
# that the file was modified and closed, either directly (via the
243+
# NOTE_CLOSE_WRITE event) or indirectly (looking for NOTE_CLOSE and
244+
# NOTE_WRITE). This code is disabled if neither NOTE_CLOSE nor
245+
# NOTE_CLOSE_WRITE is defined (notable cases: Darwin and NetBSD).
246+
AC_COMPILE_IFELSE(
247+
[AC_LANG_PROGRAM([
248+
#include <sys/event.h>
249+
],
250+
[
251+
#if defined(NOTE_CLOSE) || defined(NOTE_CLOSE_WRITE)
252+
return 0;
253+
#else
254+
# error "Either NOTE_CLOSE or NOTE_CLOSE_WRITE must be defined"
255+
#endif
256+
])],
257+
[status_fsevmon=kqueue],
258+
[status_fsevmon=none])
242259
else
243260
status_fsevmon=none
244261
fi

0 commit comments

Comments
 (0)