b26d51ebd8a20c30ca5d226d4901d71d15d41df2
[openwrt/openwrt.git] / package / network / services / wireguard / patches / 100-portability.patch
1 tools: fix portability issue
2
3 Check if the compiler defines __linux__, instead of assuming that the
4 host OS is the same as the target OS.
5
6 Signed-off-by: Felix Fietkau <nbd@nbd.name>
7 ---
8 --- a/src/tools/Makefile
9 +++ b/src/tools/Makefile
10 @@ -43,7 +43,7 @@ CFLAGS += -DRUNSTATEDIR="\"$(RUNSTATEDIR
11 ifeq ($(DEBUG_TOOLS),y)
12 CFLAGS += -g
13 endif
14 -ifeq ($(shell uname -s),Linux)
15 +ifeq ($(strip $(shell echo __linux__ | $(CC) -E - | grep -v '^\#')),1)
16 LIBMNL_CFLAGS := $(shell $(PKG_CONFIG) --cflags libmnl 2>/dev/null)
17 LIBMNL_LDLIBS := $(shell $(PKG_CONFIG) --libs libmnl 2>/dev/null || echo -lmnl)
18 CFLAGS += $(LIBMNL_CFLAGS)