Skip to content

Commit

Permalink
make: Add build knobs for kqueue and inotify
Browse files Browse the repository at this point in the history
Add WITH_KQUEUE and WITH_INOTIFY, defaulting to auto-detect availability
of these APIs.
  • Loading branch information
Zirias committed Jul 29, 2024
1 parent 26f81bf commit 49a2a3e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
11 changes: 11 additions & 0 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,17 @@ DISTCLEANDIRS= tools/bin

NODIST= poser/zimk

HAVE_KQUEUE= $(shell echo '#include <sys/event.h>\n'\
'int (*f)(void) = kqueue;' | \
$(or $(CC),cc) -xc -c -o- - >/dev/null 2>&1 && echo 1)
HAVE_INOTIFY= $(shell echo '#include <sys/inotify.h>\n'\
'int (*f)(void) = inotify_init;' | \
$(or $(CC),cc) -xc -c -o- - >/dev/null 2>&1 && echo 1)
BOOLCONFVARS_OFF+= $(if $(HAVE_KQUEUE),,WITH_KQUEUE) \
$(if $(HAVE_INOTIFY),,WITH_INOTIFY)
BOOLCONFVARS_ON+= $(if $(HAVE_KQUEUE),WITH_KQUEUE,) \
$(if $(HAVE_INOTIFY),WITH_INOTIFY,)

include zimk/zimk.mk

ifeq ($(BUNDLED_POSER),1)
Expand Down
11 changes: 11 additions & 0 deletions src/bin/xmoji/xmoji.mk
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,15 @@ else
xmoji_PKGDEPS+= freetype2
endif

ifeq ($(WITH_KQUEUE),1)
ifeq ($(WITH_INOTIFY),1)
$(error Cannot enable both WITH_KQUEUE and WITH_INOTIFY)
endif
xmoji_DEFINES+= -DWITH_KQUEUE
endif

ifeq ($(WITH_INOTIFY),1)
xmoji_DEFINES+= -DWITH_INOTIFY
endif

$(call binrules,xmoji)

0 comments on commit 49a2a3e

Please sign in to comment.