-
Notifications
You must be signed in to change notification settings - Fork 52
/
autogen.sh
executable file
·177 lines (148 loc) · 5.01 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
#! /bin/sh
#
# See COPYRIGHT in top-level directory.
#
########################################################################
## Utility functions
########################################################################
recreate_tmp() {
rm -rf .tmp
mkdir .tmp 2>&1 >/dev/null
}
warn() {
echo "===> WARNING: $@"
}
error() {
echo "===> ERROR: $@"
}
echo_n() {
# "echo -n" isn't portable, must portably implement with printf
printf "%s" "$*"
}
echo "================================================================="
echo "Checking autotools installations"
echo "================================================================="
########################################################################
## Verify autoconf version
########################################################################
echo_n "Checking for autoconf version... "
recreate_tmp
ver=2.67
cat > .tmp/configure.ac<<EOF
AC_INIT
AC_PREREQ($ver)
AC_OUTPUT
EOF
if (cd .tmp && $autoreconf $autoreconf_args >/dev/null 2>&1 ) ; then
echo ">= $ver"
else
echo "bad autoconf installation"
cat <<EOF
You either do not have autoconf in your path or it is too old (version
$ver or higher required). You may be able to use
autoconf --version
Unfortunately, there is no standard format for the version output and
it changes between autotools versions. In addition, some versions of
autoconf choose among many versions and provide incorrect output).
EOF
exit 1
fi
########################################################################
## Verify automake version
########################################################################
echo_n "Checking for automake version... "
recreate_tmp
ver=1.12.3
cat > .tmp/configure.ac<<EOF
AC_INIT(testver,1.0)
AC_CONFIG_AUX_DIR([m4])
AC_CONFIG_MACRO_DIR([m4])
m4_ifdef([AM_INIT_AUTOMAKE],,[m4_fatal([AM_INIT_AUTOMAKE not defined])])
AM_INIT_AUTOMAKE([$ver foreign])
AC_MSG_RESULT([A message])
AC_OUTPUT([Makefile])
EOF
cat <<EOF >.tmp/Makefile.am
ACLOCAL_AMFLAGS = -I m4
EOF
if [ ! -d .tmp/m4 ] ; then mkdir .tmp/m4 >/dev/null 2>&1 ; fi
if (cd .tmp && $autoreconf $autoreconf_args >/dev/null 2>&1 ) ; then
echo ">= $ver"
else
echo "bad automake installation"
cat <<EOF
You either do not have automake in your path or it is too old (version
$ver or higher required). You may be able to use
automake --version
Unfortunately, there is no standard format for the version output and
it changes between autotools versions. In addition, some versions of
autoconf choose among many versions and provide incorrect output).
EOF
exit 1
fi
########################################################################
## Verify libtool version
########################################################################
echo_n "Checking for libtool version... "
recreate_tmp
ver=2.4
cat <<EOF >.tmp/configure.ac
AC_INIT(testver,1.0)
AC_CONFIG_AUX_DIR([m4])
AC_CONFIG_MACRO_DIR([m4])
m4_ifdef([LT_PREREQ],,[m4_fatal([LT_PREREQ not defined])])
LT_PREREQ($ver)
LT_INIT()
AC_MSG_RESULT([A message])
EOF
cat <<EOF >.tmp/Makefile.am
ACLOCAL_AMFLAGS = -I m4
EOF
if [ ! -d .tmp/m4 ] ; then mkdir .tmp/m4 >/dev/null 2>&1 ; fi
if (cd .tmp && $autoreconf $autoreconf_args >/dev/null 2>&1 ) ; then
echo ">= $ver"
else
echo "bad libtool installation"
cat <<EOF
You either do not have libtool in your path or it is too old
(version $ver or higher required). You may be able to use
libtool --version
Unfortunately, there is no standard format for the version output and
it changes between autotools versions. In addition, some versions of
autoconf choose among many versions and provide incorrect output).
EOF
exit 1
fi
echo
echo "================================================================="
echo "Generating required temporary files"
echo "================================================================="
########################################################################
## Building maint/Version
########################################################################
# build a substitute maint/Version script now that we store the single copy of
# this information in an m4 file for autoconf's benefit
echo_n "Generating a helper maint/Version... "
if autom4te -l M4sugar maint/Version.base.m4 > maint/Version ; then
echo "done"
else
echo "error"
error "unable to correctly generate maint/Version shell helper"
fi
########################################################################
## Building the README
########################################################################
echo_n "Updating the README... "
. ./maint/Version
if [ -f README.md ] ; then
sed -e "s/%VERSION%/${ABT_VERSION}/g" README.md > README
echo "done"
else
echo "error"
error "README.md file not present, unable to update README version number (perhaps we are running in a release tarball source tree?)"
fi
echo
echo "================================================================="
echo "Generating configure and friends"
echo "================================================================="
autoreconf -vif