100-portability.patch 624 B

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