2 ### autogen.sh - tool to help build Emacs from a bzr checkout
4 ## Copyright (C) 2011 Free Software Foundation, Inc.
6 ## Author: Glenn Morris <rgm@gnu.org>
8 ## This file is part of GNU Emacs.
10 ## GNU Emacs is free software: you can redistribute it and/or modify
11 ## it under the terms of the GNU General Public License as published by
12 ## the Free Software Foundation, either version 3 of the License, or
13 ## (at your option) any later version.
15 ## GNU Emacs is distributed in the hope that it will be useful,
16 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ## GNU General Public License for more details.
20 ## You should have received a copy of the GNU General Public License
21 ## along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
25 ## The Emacs bzr repository does not include the configure script
26 ## (and associated helpers). The first time you fetch Emacs from bzr,
27 ## run this script to generate the necessary files.
28 ## For more details, see the file INSTALL.BZR.
33 progs
="autoconf automake"
35 ## Minimum versions we need:
36 autoconf_min
=`sed -n 's/^ *AC_PREREQ(\([0-9\.]*\)).*/\1/p' configure.in`
38 ## FIXME how to determine this from the sources?
42 ## $1 = program, eg "autoconf".
43 ## Echo the version string, eg "2.59".
44 ## FIXME does not handle things like "1.4a", but AFAIK those are
45 ## all old versions, so it is OK to fail there.
46 ## Also note that we do not handle micro versions.
49 $1 --version 2>&1 |
sed -n '1 s/.* \([1-9][0-9\.]*\).*/\1/p'
52 ## $1 = version string, eg "2.59"
53 ## Echo the major version, eg "2".
56 echo $1 |
sed -e 's/\([0-9][0-9]*\)\..*/\1/'
59 ## $1 = version string, eg "2.59"
60 ## Echo the minor version, eg "59".
63 echo $1 |
sed -e 's/[0-9][0-9]*\.\([0-9][0-9]*\).*/\1/'
67 ## $2 = minimum version.
68 ## Return 0 if program is present with version >= minumum version.
69 ## Return 1 if program is missing.
70 ## Return 2 if program is present but too old.
71 ## Return 3 for unexpected error (eg failed to parse version).
74 have_version
=`get_version $1`
76 [ x
"$have_version" = x
] && return 1
78 have_maj
=`major_version $have_version`
79 need_maj
=`major_version $2`
81 [ x
"$have_maj" != x
] && [ x
"$need_maj" != x
] ||
return 3
83 [ $have_maj -gt $need_maj ] && return 0
84 [ $have_maj -lt $need_maj ] && return 2
86 have_min
=`minor_version $have_version`
87 need_min
=`minor_version $2`
89 [ x
"$have_min" != x
] && [ x
"$need_min" != x
] ||
return 3
91 [ $have_min -ge $need_min ] && return 0
97 Checking whether you have the necessary tools...
98 (Read INSTALL.BZR for more details on building Emacs)
104 for prog
in $progs; do
106 eval min
=\$
${prog}_min
108 echo "Checking for $prog (need at least version $min)..."
110 check_version
$prog $min
118 *) stat
="unable to check" ;;
123 if [ $retval -ne 0 ]; then
124 missing
="$missing $prog"
125 eval ${prog}_why
=\""$stat"\"
131 if [ x
"$missing" != x
]; then
135 Building Emacs from Bzr requires the following specialized programs:
138 for prog
in $progs; do
139 eval min
=\$
${prog}_min
141 echo "$prog (minimum version $min)"
147 Your system seems to be missing the following tool(s):
150 for prog
in $missing; do
151 eval why
=\$
${prog}_why
158 If you think you have the required tools, please add them to your PATH
159 and re-run this script.
161 Otherwise, please try installing them.
162 On systems using rpm and yum, try: "yum install PACKAGE"
163 On systems using dpkg and apt, try: "apt-get install PACKAGE"
164 Then re-run this script.
166 If you do not have permission to do this, or if the version provided
167 by your system is too old, it is normally straightforward to build
168 these packages from source. You can find the sources at:
170 ftp://ftp.gnu.org/gnu/PACKAGE/
172 Download the package (make sure you get at least the minimum version
173 listed above), extract it using tar, then run configure, make,
174 make install. Add the installation directory to your PATH and re-run
177 If you know that the required versions are in your PATH, but this
178 script has made an error, then you can simply run
182 instead of this script.
184 If all else fails, you can try using the pre-built versions of the
185 generated files by doing:
187 ./autogen/copy_autogen
189 This is not recommended - see the comments in \`copy_autogen'.
191 Please report any problems with this script to bug-gnu-emacs@gnu.org .
197 echo "Your system has the required tools, running autoreconf..."
200 ## Let autoreconf figure out what, if anything, needs doing.
201 autoreconf
-I m4 ||
exit $?
203 echo "You can now run \`./configure'."
207 ### autogen.sh ends here