Automatically detect when -luuid is needed (on Linux with tours enabled)

This is done in a cross-compile-friendly manner with cpp rather than
uname. printf is used rather than echo due to inconsistent handling of
the -e option across different shells.
This commit is contained in:
James Le Cuirot 2022-09-22 22:29:55 +01:00
parent 5ca1924ace
commit cac1b95be0
No known key found for this signature in database
GPG Key ID: 1226415D00DD3137
5 changed files with 15 additions and 8 deletions

View File

@ -23,6 +23,14 @@ CFLAGS += -DGHASHPREC=$(GHASHPREC)
LIBS += -llmdb
LIBS += -lpthread
define CPP_CONDITION
printf '#if $(1) \n
true \n
#else \n
#error false \n
#endif' | $(CPP) -P - >/dev/null 2>&1 && echo yes
endef
ifeq ($(WITH_MQTT),yes)
CFLAGS += -DWITH_MQTT=1
CFLAGS += $(MOSQUITTO_INC)
@ -56,6 +64,12 @@ endif
ifeq ($(WITH_TOURS),yes)
CFLAGS += -DWITH_TOURS
OTR_EXTRA_OBJS +=
# Debian requires uuid-dev
# RHEL/CentOS needs libuuid-devel
ifeq ($(shell $(call CPP_CONDITION,__linux__)),yes)
LIBS += -luuid
endif
endif
ifeq ($(WITH_GREENWICH),yes)

View File

@ -40,7 +40,7 @@ WITH_MQTT ?= yes
WITH_HTTP ?= yes
# Do you want recorder support for shared views? Requires WITH_HTTP
# also requires -luuid on Linux (see below at MORELIBS)
# also requires -luuid on Linux.
WITH_TOURS ?= yes
# Do you have Lua libraries installed and want the Lua hook integration?
@ -93,10 +93,6 @@ CONFIGFILE = /etc/default/ot-recorder
MOSQUITTO_INC = -I/usr/include
MOSQUITTO_LIB = -L/usr/lib
# Debian requires uuid-dev
# RHEL/CentOS needs libuuid-devel
MORELIBS += -luuid # -lssl
# Milliseconds (ms) timeout for reverse geocoding
GEOCODE_TIMEOUT = 4000

View File

@ -19,7 +19,6 @@ GHASHPREC = 7
JSON_INDENT ?= no
MOSQUITTO_INC = -I/usr/include
MOSQUITTO_LIB = -L/usr/lib
MORELIBS = -luuid # -lssl
LUA_CFLAGS = `pkg-config --cflags lua`
LUA_LIBS = `pkg-config --libs lua`

View File

@ -19,7 +19,6 @@ GHASHPREC = 7
JSON_INDENT ?= no
MOSQUITTO_INC = -I/usr/include
MOSQUITTO_LIB = -L/usr/lib
MORELIBS = -luuid # -lssl
LUA_CFLAGS = `pkg-config --cflags lua`
LUA_LIBS = `pkg-config --libs lua`
SODIUM_CFLAGS = `pkg-config --cflags libsodium`

View File

@ -20,7 +20,6 @@ GHASHPREC = 7
JSON_INDENT ?= no
MOSQUITTO_INC = -I/usr/include
MOSQUITTO_LIB = -L/usr/lib
MORELIBS = -luuid # -lssl
LUA_CFLAGS = `pkg-config --cflags lua`
LUA_LIBS = `pkg-config --libs lua`