Check usability of inotify before selecting it

A libinotify compatibility library exists for BSD systems. If this
was installed, configure would find sys/inotify.h but the build
would fail to link unless the library was added to the link line.
By also checking for inotify_init() this problem can be avoided.

Given that there is native support for kqueue, there is no need
to handle linking with libinotify.
This commit is contained in:
Oliver Kiddle
2020-04-15 12:31:11 +02:00
parent 697bd07441
commit 1eaa510c05
2 changed files with 26 additions and 18 deletions

29
configure vendored
View File

@@ -32967,23 +32967,24 @@ fi
if test "$wxUSE_FSWATCHER" = "yes"; then
if test "$USE_WIN32" != 1; then
if test "$wxUSE_UNIX" = "yes"; then
for ac_header in sys/inotify.h
do :
ac_fn_c_check_header_compile "$LINENO" "sys/inotify.h" "ac_cv_header_sys_inotify_h" "$ac_includes_default
"
if test "x$ac_cv_header_sys_inotify_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_SYS_INOTIFY_H 1
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether inotify is usable" >&5
$as_echo_n "checking whether inotify is usable... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int main() { return inotify_init(); }
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
wx_cv_inotify_usable=yes; $as_echo "#define wxHAS_INOTIFY 1" >>confdefs.h
else
wx_cv_inotify_usable=no
fi
done
if test "$ac_cv_header_sys_inotify_h" = "yes"; then
$as_echo "#define wxHAS_INOTIFY 1" >>confdefs.h
else
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $wx_cv_inotify_usable" >&5
$as_echo "$wx_cv_inotify_usable" >&6; }
if test "$wx_cv_inotify_usable" = "no"; then
for ac_header in sys/event.h
do :
ac_fn_c_check_header_compile "$LINENO" "sys/event.h" "ac_cv_header_sys_event_h" "$ac_includes_default