File: autogen.sh

package info (click to toggle)
ibutils 1.5.7+0.2.gbd7e502-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 38,728 kB
  • sloc: cpp: 159,552; ansic: 74,818; tcl: 13,816; sh: 13,204; makefile: 431; yacc: 333; lex: 169; awk: 53; perl: 49
file content (85 lines) | stat: -rwxr-xr-x 1,899 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/bin/bash
cd ${0%*/*}
# get two strings of version numbers
# parse the two strings and compare
function compare_versions() {
   cat <<EOF > /tmp/$$.awk
/[0-9]+\.[0-9]+(\.[0-9]+)?[    ]+[0-9]+\.[0-9]+(\.[0-9]+)?/{
  vb = "$2";
  nb = split(vb,b,"[.]");
  va = "$1";
  na = split(va,a,"[.]");
  for (i = na + 1; i < 4; i++) {
      a[i] = 0;
  }
  for (i = nb + 1; i < 4; i++) {
      b[i] = 0;
  }
  for (i = 1; i <= 3; i++) {
    if (b[i] < a[i]) {
#      print "FAIL:" va ">" vb " at index:" i;
        exit(1);
    } else if (b[i] > a[i]) {
#       print "OK:" va "<" vb " at index:" i;
       exit(0);
    }
  }
#  print "OK:" va "==" vb;
  exit(0);
}
{
  exit(1);
}
EOF
  echo "$1 $2 " | awk -f /tmp/$$.awk
  status=$?
  rm /tmp/$$.awk
  return $status
}

cd ${0%*/*}

# make sure autoconf is up-to-date
ac_ver=`autoconf --version | head -n 1 | awk '{print $NF}'`
compare_versions 2.59 $ac_ver
if test $? = 1; then
    echo Min autoconf version is 2.59
    exit 1
fi

# make sure automake is up-to-date
am_ver=`automake --version | head -n 1 | awk '{print $NF}'`
compare_versions 1.9.2 $am_ver
if test $? = 1; then
    echo Min automake version is 1.9.2
    exit 1
fi

# make sure libtool is up-to-date
lt_ver=`libtool --version | head -n 1 | awk '{print $4}'`
compare_versions 1.4.2 $lt_ver
if test $? = 1; then
    echo Min libtool version is 1.4.2
    exit 1
fi

# cleanup
find . \( -name Makefile.in -o -name aclocal.m4 -o -name autom4te.cache -o -name configure -o -name aclocal.m4 \) -exec \rm -rf {} \; -prune

# handle our own autoconf:
aclocal -I config 2>&1 |  grep -v "arning: underquoted definition of"
automake --add-missing --gnu --copy --force
autoconf

# visit all sub directories with autogen.sh
anyErr=0
for a in `ls */autogen.sh`; do
    echo Visiting $a
    $a 2>&1 | sed 's/^/|/'
    if test $? != 0; then
        echo $a failed
        anyErr=1
    fi
done

exit $anyErr