2 # buildall - run everything needed to bootstrap and configure a source tree
5 # ----START-LICENCE----
6 # Copyright 1999,2000,2001 BrightStation PLC
7 # Copyright 2001 James Aylett
8 # Copyright 2002 Ananova Ltd
10 # This program is free software; you can redistribute it and/or
11 # modify it under the terms of the GNU General Public License as
12 # published by the Free Software Foundation; either version 2 of the
13 # License, or (at your option) any later version.
15 # This program 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 this program; if not, write to the Free Software
22 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
24 # -----END-LICENCE-----
27 # Details of this script
28 PROGNAME
="`echo $0 | sed -e 's#^.*/##'`"
30 # Little bit of paranoia
31 test -z "${PROGNAME}" && PROGNAME
="[buildall]"
33 #######################
34 # Get directory names #
35 #######################
37 # Get the source directory, ie the directory
38 # Don't use dirname in case we haven't got GNU tools
39 SRCDIR
="`echo $0 | sed -e 's#/[^/]*$##'`"
40 # Be paranoid about not getting SRCDIR
41 test -z "$SRCDIR" && SRCDIR
='.'
44 # Be paranoid about not getting BUILDDIR
45 test -z "$BUILDDIR" && BUILDDIR
='-'
47 ########################
48 # Function definitions #
49 ########################
52 # Display arguments, interpreting \n
53 # FIXME: Don't assume we have an echo which interprets \n correctly
58 # Display an error message and stop
59 display
"${PROGNAME}: error: $*" >&2
64 # Run a program, stopping if it returns an error condition
67 display
"${PROGNAME}: running $cmd $*"
68 $cmd "$@" || error
"in $cmd $*"
71 # Check for existence of neccessary tools
73 display
"${PROGNAME}: checking for tools"
76 case "`autoconf --version|sed 's/.* //;q'`" in
78 ERRMSG
="${ERRMSG}Maintainer tool autoconf not found\\n" ;;
79 2.
[5-9][0-9]|
2.
[5-9][0-9][^
0-9]*)
82 ERRMSG
="${ERRMSG}Maintainer tool autoconf needs to be at least version 2.50\\n" ;;
84 case "`automake --version|sed 's/.* //;q' 2>/dev/null`" in
86 ERRMSG
="${ERRMSG}Maintainer tool automake not found\\n" ;;
87 0.
*|
1.
[0-4]|
1.
[0-4][^
0-9]*)
88 ERRMSG
="${ERRMSG}Maintainer tool automake needs to be at least version 1.5\\n" ;;
90 ERRMSG
="${ERRMSG}Maintainer tool automake can't be version 1.6 - use 1.5 or at least 1.6.1\\n" ;;
92 case "`libtool --version|sed 's/.* //;q' 2>/dev/null`" in
94 ERRMSG
="${ERRMSG}Maintainer tool libtool not found\\n" ;;
95 [0].
*|
1.
[0123]|
1.
[0123][^
0-9]*|
1.1[012]|
1.3|
1.3[^
0-9]*|
1.3.
[012]|
1.3.
[012][^
0-9]*)
96 ERRMSG
="${ERRMSG}Maintainer tool libtool needs to be at least version 1.3.3\\n" ;;
98 case "`bison --version|sed 's/.* //;q'`" in
100 ERRMSG
="${ERRMSG}Maintainer tool bison not found\\n" ;;
101 1.3[5-9]|
1.
[4-9][0-9]|
1.
[1-9][0-9][0-9]*|
[2-9].
*|
[1-9][0-9]*)
104 ERRMSG
="${ERRMSG}Maintainer tool bison needs to be at least version 1.35\\n" ;;
106 test -z "${ERRMSG}" ||\
107 error
"${ERRMSG}See HACKING for details of developer tools needed"
110 case "`aclocal --version|sed 's/.* //;q' 2>/dev/null`" in
112 ERRMSG
="${ERRMSG}Maintainer tool aclocal (part of automake) not found\\n" ;;
113 0.
*|
1.
[0-4]|
1.
[0-4][^
0-9]*)
114 ERRMSG
="${ERRMSG}Maintainer tool aclocal needs to be from automake at least version 1.5\\n" ;;
116 ERRMSG
="${ERRMSG}Maintainer tool aclocal can't be from automake version 1.6 - use 1.5 or at least 1.6.1\\n" ;;
118 case "`autoheader --version|sed 's/.* //;q'`" in
120 ERRMSG
="${ERRMSG}Maintainer tool autoheader (part of autoconf) not found\\n" ;;
121 2.
[5-9][0-9]|
2.
[5-9][0-9][^
0-9]*)
124 ERRMSG
="${ERRMSG}Maintainer tool autoheader needs to be from autoconf at least version 2.50\\n" ;;
126 test -z "${ERRMSG}" ||
127 error
"${ERRMSG}See HACKING for details of developer tools needed"
131 if test .
!= "${SRCDIR}" ; then
132 display
"${PROGNAME}: changed to source directory, `pwd`"
135 if (exec >/dev
/null
2>&1 ; xapian-config
--prefix; exit $?
) then
136 ACLOCAL_FLAGS
="$ACLOCAL_FLAGS -I `xapian-config --prefix`/share/aclocal"
139 # Build configure script and Makefile.in's
140 run libtoolize
--force --automake
141 run aclocal
$ACLOCAL_FLAGS
144 run automake
--add-missing
146 # Return to build directory
148 if test .
!= "${SRCDIR}" ; then
149 display
"${PROGNAME}: returned to build directory, ${BUILDDIR}"
154 if test -f config.status
&& test -z "$*" ; then
155 # If no parameters, assume that we just wish to re-run the configure,
156 # using same parameters as last time.
157 # (Note: make should automatically perform these steps if and when
158 # neccessary, but this is useful for situations where make has got
159 # confused - for example, when a broken makefile has been created.)
160 run .
/config.status
--recheck
163 run
"${SRCDIR}/configure" "$@"