Debian Codegraph @

m4/ax_fsevents_have_file_events.m4

raw
1 # ===========================================================================
2 # http://www.gnu.org/software/autoconf-archive/ax_fsevents_have_file_events.html
3 # ===========================================================================
4 #
5 # SYNOPSIS
6 #
7 # AX_FSEVENTS_HAVE_FILE_EVENTS()
8 #
9 # DESCRIPTION
10 #
11 # This macro checks if the macOS FSEvents API supports file events, and if it
12 # supports the FSEventStreamSetDispatchQueue function.
13 #
14 # If the FSEvents API is supported, the ax_cv_fsevents_have_file_events environment
15 # variable is defined and set to "yes", and the HAVE_FSEVENTS_FILE_EVENTS symbol is
16 # defined.
17 #
18 # If the FSEventStreamSetDispatchQueue function is supported, the
19 # ax_cv_fsevents_have_fseventstreamsetdispatchqueue environment variable is
20 # defined and set to "yes", and the HAVE_FSEVENTS_FILE_EVENTS symbol is defined.
21 #
22 # CONTRIBUTING
23 #
24 # You can contribute changes on GitHub by forking this repository:
25 #
26 # https://github.com/emcrisostomo/CXX-Autoconf-Macros.git
27 #
28 # LICENSE
29 #
30 # Copyright (c) 2014-2025 Enrico M. Crisostomo <[email protected]>
31 #
32 # Copying and distribution of this file, with or without modification, are
33 # permitted in any medium without royalty provided the copyright notice
34 # and this notice are preserved. This file is offered as-is, without any
35 # warranty.
36
37 #serial 3
38
39 AC_DEFUN([AX_FSEVENTS_HAVE_FILE_EVENTS],
40 [dnl
41 AC_CACHE_CHECK(
42 [for FSEvents API in macOS],
43 ax_cv_fsevents_have_fsevents,
44 [dnl
45 AC_LANG_PUSH([C])
46 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
47 [#include <CoreServices/CoreServices.h>],
48 [int i = kFSEventStreamCreateFlagNone;]
49 )],
50 [ax_cv_fsevents_have_fsevents=yes],
51 [ax_cv_fsevents_have_fsevents=no]
52 )
53 AC_LANG_POP([C])])
54 AC_CACHE_CHECK(
55 [for file events in macOS FSEvents API],
56 ax_cv_fsevents_have_file_events,
57 [dnl
58 AC_LANG_PUSH([C])
59 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
60 [#include <CoreServices/CoreServices.h>],
61 [int i = kFSEventStreamCreateFlagFileEvents;]
62 )],
63 [ax_cv_fsevents_have_file_events=yes],
64 [ax_cv_fsevents_have_file_events=no]
65 )
66 AC_LANG_POP([C])])
67 AC_CACHE_CHECK(
68 [for FSEventStreamSetDispatchQueue in macOS FSEvents API],
69 ax_cv_fsevents_have_fseventstreamsetdispatchqueue,
70 [dnl
71 AC_LANG_PUSH([C])
72 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
73 [#include <CoreServices/CoreServices.h>],
74 [FSEventStreamSetDispatchQueue(NULL, NULL);]
75 )],
76 [ax_cv_fsevents_have_fseventstreamsetdispatchqueue=yes],
77 [ax_cv_fsevents_have_fseventstreamsetdispatchqueue=no]
78 )
79 AC_LANG_POP([C])])
80 if test x"$ax_cv_fsevents_have_fsevents" = "xyes"
81 then
82 AC_DEFINE(HAVE_FSEVENTS,
83 1,
84 [Define if macOS FSEvents API is supported.])
85 fi
86 if test x"$ax_cv_fsevents_have_file_events" = "xyes"
87 then
88 AC_DEFINE(HAVE_FSEVENTS_FILE_EVENTS,
89 1,
90 [Define if macOS FSEvents API supports file events.])
91 fi
92 if test x"$ax_cv_fsevents_have_fseventstreamsetdispatchqueue" = "xyes"
93 then
94 AC_DEFINE(HAVE_FSEVENTS_FSEVENTSTREAMSETDISPATCHQUEUE,
95 1,
96 [Define if macOS FSEvents API supports the FSEventStreamSetDispatchQueue function.])
97 fi
98 ])