Fixed missing include in quartzcheck.cc
[xapian.git] / xapian-core / buildall
blob1bdcf61f739e81f09ca59641d9014838ff080518
1 #! /bin/sh
2 # buildall - run everything needed to bootstrap and configure a source tree
3 # from a CVS checkout.
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
23 # USA
24 # -----END-LICENCE-----
26 # VERSION="0.19"
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='.'
43 BUILDDIR="`pwd`"
44 # Be paranoid about not getting BUILDDIR
45 test -z "$BUILDDIR" && BUILDDIR='-'
47 ########################
48 # Function definitions #
49 ########################
51 display() {
52 # Display arguments, interpreting \n
53 # FIXME: Don't assume we have an echo which interprets \n correctly
54 echo -e "$@"
57 error() {
58 # Display an error message and stop
59 display "${PROGNAME}: error: $*" >&2
60 exit 1
63 run() {
64 # Run a program, stopping if it returns an error condition
65 cmd=$1
66 shift
67 display "${PROGNAME}: running $cmd $*"
68 $cmd "$@" || error "in $cmd $*"
71 # Check for existence of neccessary tools
73 display "${PROGNAME}: checking for tools"
75 ERRMSG=""
76 case "`autoconf --version|sed 's/.* //;q'`" in
77 "")
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" ;;
83 esac
84 case "`automake --version|sed 's/.* //;q' 2>/dev/null`" in
85 "")
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" ;;
89 1.6)
90 ERRMSG="${ERRMSG}Maintainer tool automake can't be version 1.6 - use 1.5 or at least 1.6.1\\n" ;;
91 esac
92 case "`libtool --version|sed 's/.* //;q' 2>/dev/null`" in
93 "")
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" ;;
97 esac
98 case "`bison --version|sed 's/.* //;q'`" in
99 "")
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]*)
102 ;; # 1.35 or newer
104 ERRMSG="${ERRMSG}Maintainer tool bison needs to be at least version 1.35\\n" ;;
105 esac
106 test -z "${ERRMSG}" ||\
107 error "${ERRMSG}See HACKING for details of developer tools needed"
109 ERRMSG=""
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" ;;
115 1.6)
116 ERRMSG="${ERRMSG}Maintainer tool aclocal can't be from automake version 1.6 - use 1.5 or at least 1.6.1\\n" ;;
117 esac
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" ;;
125 esac
126 test -z "${ERRMSG}" ||
127 error "${ERRMSG}See HACKING for details of developer tools needed"
129 # Change to srcdir
130 cd "${SRCDIR}"
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
142 run autoheader
143 run autoconf
144 run automake --add-missing
146 # Return to build directory
147 cd "${BUILDDIR}"
148 if test . != "${SRCDIR}" ; then
149 display "${PROGNAME}: returned to build directory, ${BUILDDIR}"
152 # Configure package
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
161 run ./config.status
162 else
163 run "${SRCDIR}/configure" "$@"