e0b11b5459e5e4cd49c80b76ed945eb96aa96e8d
[librecmc/librecmc.git] /
1 From f07a0a5cb8b3c5e1aee8b30c7fa21ccfbf24a95a Mon Sep 17 00:00:00 2001
2 Message-Id: <f07a0a5cb8b3c5e1aee8b30c7fa21ccfbf24a95a.1459880505.git.mschiffer@universe-factory.net>
3 From: Matthias Schiffer <mschiffer@universe-factory.net>
4 Date: Fri, 1 Apr 2016 22:24:00 +0200
5 Subject: [PATCH] build: fix configure compatiblity with POSIX shells
6
7 The kernel version detection code uses some bashisms, which makes the build
8 fail on Debian systems where /bin/sh links to dash. Replace with POSIX-
9 conforming commands at the cost of requiring awk.
10 ---
11  configure.ac | 24 +++++++++---------------
12  1 file changed, 9 insertions(+), 15 deletions(-)
13
14 diff --git a/configure.ac b/configure.ac
15 index 82a1355..5a5ea57 100644
16 --- a/configure.ac
17 +++ b/configure.ac
18 @@ -44,21 +44,15 @@ regular_CFLAGS="-Wall -Waggregate-return -Wmissing-declarations \
19  
20  if test -n "$kbuilddir"; then
21         AC_MSG_CHECKING([kernel version that we will build against])
22 -       krel="$(make -sC "$kbuilddir" M=$PWD kernelrelease)";
23 -       kmajor="${krel%%[[^0-9]]*}";
24 -       kmajor="$(($kmajor+0))";
25 -       krel="${krel:${#kmajor}}";
26 -       krel="${krel#.}";
27 -       kminor="${krel%%[[^0-9]]*}";
28 -       kminor="$(($kminor+0))";
29 -       krel="${krel:${#kminor}}";
30 -       krel="${krel#.}";
31 -       kmicro="${krel%%[[^0-9]]*}";
32 -       kmicro="$(($kmicro+0))";
33 -       krel="${krel:${#kmicro}}";
34 -       krel="${krel#.}";
35 -       kstable="${krel%%[[^0-9]]*}";
36 -       kstable="$(($kstable+0))";
37 +       krel="$(make -sC "$kbuilddir" M=$PWD kernelrelease | $AWK -v 'FS=[[^0-9.]]' '{print $1; exit}')";
38 +       save_IFS=$IFS;
39 +       IFS='.';
40 +       set x $krel;
41 +       IFS=$save_IFS;
42 +       kmajor="$(($2+0))";
43 +       kminor="$(($3+0))";
44 +       kmicro="$(($4+0))";
45 +       kstable="$(($5+0))";
46         if test -z "$kmajor" -o -z "$kminor" -o -z "$kmicro"; then
47                 echo "WARNING: Version detection did not succeed. Continue at own luck.";
48         else
49 -- 
50 2.8.0
51