summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2020-04-30 22:18:47 -0600
committerJason A. Donenfeld <Jason@zx2c4.com>2020-05-03 20:08:55 -0600
commit4685f980e24686a6b498602419a92c1d54478258 (patch)
treed4d04935d8ef8acce07e5438afe82a5ae3e4442a
parentcompat: detect Debian's backport of ip6_dst_lookup_flow into 4.19.118 (diff)
downloadwireguard-linux-compat-4685f980e24686a6b498602419a92c1d54478258.tar.xz
wireguard-linux-compat-4685f980e24686a6b498602419a92c1d54478258.zip
compat: use bash instead of bc for HZ-->USEC calculation
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r--src/compat/Kbuild.include6
1 files changed, 1 insertions, 5 deletions
diff --git a/src/compat/Kbuild.include b/src/compat/Kbuild.include
index db20bd5..e937671 100644
--- a/src/compat/Kbuild.include
+++ b/src/compat/Kbuild.include
@@ -53,11 +53,7 @@ endif
ifdef CONFIG_HZ
ifeq ($(wildcard $(CURDIR)/include/generated/timeconst.h),)
-HZ_IFDEF := $(shell echo 'define gcd(a,b){auto t;while(b){t=b;b=a%b;a=t;};return a;};hz=$(CONFIG_HZ);cd=gcd(hz,1000000);print "-DHZ_TO_USEC_NUM=",1000000/cd," -DHZ_TO_USEC_DEN=",hz/cd;halt;' | bc -q)
-ifeq ($(HZ_IFDEF),)
-$(error bc(1) is required for building)
-endif
-ccflags-y += $(HZ_IFDEF)
+ccflags-y += $(shell bash -c '((a=$(CONFIG_HZ), b=1000000)); while ((b > 0)); do ((t=b, b=a%b, a=t)); done; echo "-DHZ_TO_USEC_NUM=$$((1000000/a)) -DHZ_TO_USEC_DEN=$$(($(CONFIG_HZ)/a))";')
endif
endif