Skip to content

Commit

Permalink
Build inotify fsmonitor on BSDs
Browse files Browse the repository at this point in the history
Check for existence of libinotify on some hardcoded paths (in addition
to the default include and library paths and any paths added by CFLAGS
or LDFLAGS) and if found then build inotify fsmonitor.
  • Loading branch information
tleedjarv committed May 21, 2023
1 parent 69e3e15 commit 52832eb
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
4 changes: 4 additions & 0 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ Please refer to instructions provided by the repository.

- lablgtk3 and its prerequisites (ocamlfind, GTK 3 and its dependencies)

##### Optional, on BSDs

- libinotify (optional, for building unison-fsmonitor)

##### Optional, for building the user manual

- LaTeX
Expand Down
14 changes: 14 additions & 0 deletions src/Makefile.OCaml
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,20 @@ ifeq ($(OSARCH),Linux)
FSMDIR = fsmonitor/inotify
endif

ifneq ($(findstring $(OSARCH),FreeBSD OpenBSD NetBSD DragonFly),)
LIBINOTIFY_LIB:=-cclib '$(shell pkg-config --libs libinotify 2> /dev/null || printf ' -linotify')'
LIBINOTIFY_INC:=-ccopt '$(shell pkg-config --cflags libinotify 2> /dev/null)'
FOUND_LIBINOTIFY := $(shell { printf '' > inotifytest__.ml ;\
$(CAMLC) $(CAMLCFLAGS) $(CAMLLDFLAGS) $(LIBINOTIFY_LIB) \
-o inotifytest__ inotifytest__.ml > /dev/null 2>&1 && printf true ; } ;\
rm -f inotifytest__.ml inotifytest__.cm[oix] inotifytest__.o inotifytest__ > /dev/null 2>&1)
ifeq ($(FOUND_LIBINOTIFY), true)
FSMDIR = fsmonitor/inotify
$(NAME_FSM)$(EXEC_EXT): CAMLCFLAGS += $(LIBINOTIFY_INC)
$(NAME_FSM)$(EXEC_EXT): CLIBS += $(LIBINOTIFY_LIB)
endif
endif

ifeq ($(OSARCH),SunOS)
FSMDIR = fsmonitor/solaris
endif
Expand Down

0 comments on commit 52832eb

Please sign in to comment.