-
Notifications
You must be signed in to change notification settings - Fork 3
/
autogen.sh
executable file
·189 lines (158 loc) · 5.4 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
#!/bin/sh
#
# Copyright (c) 2003, 2005, 2007, 2008, 2009, 2017 Dan McMahill
# All rights reserved.
#
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#
# a leftover cache from a different version will cause no end of headaches
rm -fr autom4te.cache
############################################################################
#
# autopoint (gettext)
#
echo "Checking autopoint version..."
ver=`autopoint --version | awk '{print $NF; exit}'`
ap_maj=`echo $ver | sed 's;\..*;;g'`
ap_min=`echo $ver | sed -e 's;^[0-9]*\.;;g' -e 's;\..*$;;g'`
ap_teeny=`echo $ver | sed -e 's;^[0-9]*\.[0-9]*\.;;g'`
echo " $ver"
case $ap_maj in
0)
if test $ap_min -lt 14 ; then
echo "You must have gettext >= 0.14.0 but you seem to have $ver"
exit 1
fi
;;
esac
echo "Running autopoint..."
autopoint --force || exit 1
############################################################################
#
# libtoolize (libtool)
#
case `uname` in
Darwin*)
LIBTOOLIZE=${LIBTOOLIZE:-glibtoolize}
;;
*)
LIBTOOLIZE=${LIBTOOLIZE:-libtoolize}
;;
esac
libtool_min_version=2.4.0
echo "Checking libtoolize version..."
${LIBTOOLIZE} --version 2>&1 > /dev/null
rc=$?
if test $rc -ne 0 ; then
echo "Could not determine the version of libtool on your machine"
echo "${LIBTOOLIZE} --version produced:"
libtool --version
exit 1
fi
lt_ver=`${LIBTOOLIZE} --version | awk '{print $NF; exit}'`
lt_maj=`echo $lt_ver | sed 's;[.].*;;g'`
lt_min=`echo $lt_ver | sed -e 's;^[0-9]*[.];;g' -e 's;[.].*$;;g'`
lt_teeny=`echo $lt_ver | sed -e 's;^[0-9]*[.][0-9]*[.];;g'`
echo " $lt_ver"
case $lt_maj in
0|1)
echo "You must have libtool >= ${libtool_min_version} but you seem to have $lt_ver"
exit 1
;;
2)
if test $lt_min -lt 4 ; then
echo "You must have libtool >= ${libtool_min_version} but you seem to have $lt_ver"
exit 1
fi
;;
*)
echo "You are running a newer libtool than wcalc has been tested with."
echo "It will probably work, but this is a warning that it may not."
;;
esac
echo "Running ${LIBTOOLIZE}..."
${LIBTOOLIZE} --force --copy --automake || exit 1
############################################################################
#
# aclocal
echo "Checking aclocal version..."
acl_ver=`aclocal --version | awk '{print $NF; exit}'`
echo " $acl_ver"
echo "Running aclocal..."
aclocal -I m4 $ACLOCAL_FLAGS || exit 1
echo "... done with aclocal."
############################################################################
#
# autoheader
echo "Checking autoheader version..."
ah_ver=`autoheader --version | awk '{print $NF; exit}'`
echo " $ah_ver"
echo "Running autoheader..."
autoheader || exit 1
echo "... done with autoheader."
############################################################################
#
# automake
echo "Checking automake version..."
am_ver=`automake --version | awk '{print $NF; exit}'`
echo " $am_ver"
echo "Running automake..."
automake --foreign --force --copy --add-missing || exit 1
echo "... done with automake."
############################################################################
#
# autoconf
# look for the AC_PREREQ([2.68]) line in configure.ac
autoconf_min_version=`awk '/^[ \t]*AC_PREREQ\(/ {v=$0; gsub(/^[^0-9]*/, "", v); gsub(/[^0-9]*$/, "", v); print v;}' configure.ac`
autoconf_rest=${autoconf_min_version}
autoconf_major=`echo $autoconf_rest | sed -e 's;[.].*;;g'`
autoconf_rest=`echo $autoconf_rest | sed -e 's;^[0-9]*[.]*;;g'`
echo "$autoconf_rest"
autoconf_minor=`echo $autoconf_rest | sed -e 's;[.].*;;g'`
autoconf_rest=`echo $autoconf_rest | sed -e 's;^[0-9]*[.]*;;g'`
echo "$autoconf_rest"
autoconf_teeny=${autoconf_rest}
if test -z "${autoconf_teeny}" ; then
autoconf_teeny=0
fi
echo "Extracted autoconf_min_version=${autoconf_min_version} from configure.ac (${autoconf_major} ${autoconf_minor} ${autoconf_teeny})"
echo "Checking autoconf version..."
ac_ver=`autoconf --version | awk '{print $NF; exit}'`
ac_maj=`echo $ac_ver | sed 's;\..*;;g'`
ac_min=`echo $ac_ver | sed -e 's;^[0-9]*\.;;g' -e 's;\..*$;;g'`
ac_teeny=`echo $ac_ver | sed -e 's;^[0-9]*\.[0-9]*\.;;g'`
echo " $ac_ver"
ac_too_old=no
ac_too_new=no
if test $ac_maj -lt $autoconf_major ; then
ac_too_old=yes
elif test $ac_maj -eq $autoconf_major -a $ac_min -lt $autoconf_minor ; then
ac_too_old=yes
elif test $ac_maj -gt $autoconf_major ; then
ac_too_new=yes
else
ac_too_old=no
fi
if test ${ac_too_old} = yes ; then
echo "You must have autoconf >= ${autoconf_min_version} but you seem to have $ac_ver"
exit 1
fi
if test ${ac_too_new} = yes ; then
echo "You are running a newer autoconf than wcalc has been tested with."
echo "It will probably work, but this is a warning that it may not."
fi
echo "Running autoconf..."
autoconf || exit 1
echo "... done with autoconf."