xtables-addons: build: fix configure compatiblity with POSIX shells
[openwrt.git] / package / network / utils / xtables-addons / patches / 002-fix-kernel-version-detection.patch
index e4101ad..6a7a099 100644 (file)
@@ -1,11 +1,11 @@
 --- a/configure.ac
 +++ b/configure.ac
-@@ -44,7 +44,7 @@ regular_CFLAGS="-Wall -Waggregate-return
+@@ -44,7 +44,7 @@ regular_CFLAGS="-Wall -Waggregate-return -Wmissing-declarations \
  
  if test -n "$kbuilddir"; then
        AC_MSG_CHECKING([kernel version that we will build against])
--      krel="$(make -sC "$kbuilddir" M=$PWD kernelrelease)";
-+      krel="$(make -sC "$kbuilddir" M=$PWD kernelversion)";
-       kmajor="${krel%%[[^0-9]]*}";
-       kmajor="$(($kmajor+0))";
-       krel="${krel:${#kmajor}}";
+-      krel="$(make -sC "$kbuilddir" M=$PWD kernelrelease | $AWK -v 'FS=[[^0-9.]]' '{print $1; exit}')";
++      krel="$(make -sC "$kbuilddir" M=$PWD kernelversion | $AWK -v 'FS=[[^0-9.]]' '{print $1; exit}')";
+       save_IFS=$IFS;
+       IFS='.';
+       set x $krel;