forked from 389ds/389-ds-base
-
Notifications
You must be signed in to change notification settings - Fork 0
/
autogen.sh
executable file
·103 lines (95 loc) · 3.38 KB
/
autogen.sh
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#!/bin/sh
# set required versions of tools here
# the version is dotted integers like X.Y.Z where
# X, Y, and Z are integers
# comparisons are done using shell -lt, -gt, etc.
# this works if the numbers are zero filled as well
# so 06 == 6
# autoconf version required
# need 2.69 or later
ac_need_maj=2
ac_need_min=69
# automake version required
# need 1.13.4 or later
am_need_maj=1
am_need_min=13
am_need_rev=4
# libtool version required
# need 2.4.2 or later
lt_need_maj=2
lt_need_min=4
lt_need_rev=2
# should never have to touch anything below this line unless there is a bug
###########################################################################
# input
# arg1 - version string in the form "X.Y[.Z]" - the .Z is optional
# args remaining - the needed X, Y, and Z to match
# output
# return 0 - success - the version string is >= the required X.Y.Z
# return 1 - failure - the version string is < the required X.Y.Z
# NOTE: All input must be integers, otherwise you will see shell errors
checkvers() {
vers="$1"; shift
needmaj="$1"; shift
needmin="$1"; shift
if [ "$#" != "0" ]; then
needrev="$1"; shift
fi
verslist=`echo $vers | tr '.' ' '`
set $verslist
maj=$1; shift
min=$1; shift
if [ "$#" != "0" ]; then
rev=$1; shift
fi
if [ "$maj" -gt "$needmaj" ] ; then return 0; fi
if [ "$maj" -lt "$needmaj" ] ; then return 1; fi
# if we got here, maj == needmaj
if [ -z "$needmin" ] ; then return 0; fi
if [ "$min" -gt "$needmin" ] ; then return 0; fi
if [ "$min" -lt "$needmin" ] ; then return 1; fi
# if we got here, min == needmin
if [ -z "$needrev" ] ; then return 0; fi
if [ "$rev" -gt "$needrev" ] ; then return 0; fi
if [ "$rev" -lt "$needrev" ] ; then return 1; fi
# if we got here, rev == needrev
return 0
}
# We use GNU sed-isms, so if `gsed' exists, use that instead.
sed=sed
if command -v gsed >/dev/null
then
sed=gsed
fi
# Check autoconf version
AC_VERSION=`autoconf --version | $sed '/^autoconf/ {s/^.* \([1-9][0-9.]*\)$/\1/; q}'`
if checkvers "$AC_VERSION" $ac_need_maj $ac_need_min ; then
echo Found valid autoconf version $AC_VERSION
else
echo "You must have autoconf version $ac_need_maj.$ac_need_min or later installed (found version $AC_VERSION)."
exit 1
fi
# Check automake version
AM_VERSION=`automake --version | $sed '/^automake/ {s/^.* \([1-9][0-9.]*\)$/\1/; q}'`
if checkvers "$AM_VERSION" $am_need_maj $am_need_min $am_need_rev ; then
echo Found valid automake version $AM_VERSION
else
echo "You must have automake version $am_need_maj.$am_need_min.$am_need_rev or later installed (found version $AM_VERSION)."
exit 1
fi
# Check libtool version
# NOTE: some libtool versions report a letter at the end e.g. on RHEL6
# the version is 2.2.6b - for comparison purposes, just strip off the
# letter - note that the shell -lt and -gt comparisons will fail with
# test: 6b: integer expression expected if the number to compare
# contains a non-digit
LT_VERSION=`libtool --version | $sed '/GNU libtool/ {s/^.* \([1-9][0-9a-zA-Z.]*\)$/\1/; s/[a-zA-Z]//g; q}'`
if checkvers "$LT_VERSION" $lt_need_maj $lt_need_min $lt_need_rev ; then
echo Found valid libtool version $LT_VERSION
else
echo "You must have libtool version $lt_need_maj.$lt_need_min.$lt_need_rev or later installed (found version $LT_VERSION)."
exit 1
fi
# Run autoreconf
echo "Running autoreconf -fvi"
autoreconf -fvi