1 #!/bin/bash
3 # Copyright (c) 2004-2006 Lennart Poettering
4 #
5 # Permission is hereby granted, free of charge, to any person
6 # obtaining a copy of this software and associated documentation files
7 # (the "Software"), to deal in the Software without restriction,
8 # including without limitation the rights to use, copy, modify, merge,
9 # publish, distribute, sublicense, and/or sell copies of the Software,
10 # and to permit persons to whom the Software is furnished to do so,
11 # subject to the following conditions:
12 #
13 # The above copyright notice and this permission notice shall be
14 # included in all copies or substantial portions of the Software.
15 #
16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
20 # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
21 # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 # SOFTWARE.
25 VERSION=1.9
27 run_versioned() {
28 local P
29 local V
31 V=$(echo "$2" | sed -e 's,\.,,g')
33 if [ -e "`which $1$V`" ] ; then
34 P="$1$V"
35 else
36 if [ -e "`which $1-$2`" ] ; then
37 P="$1-$2"
38 else
39 P="$1"
40 fi
41 fi
43 shift 2
44 "$P" "$@"
45 }
47 set -ex
49 if [ "x$1" = "xam" ] ; then
50 run_versioned automake "$VERSION" -a -c --foreign
51 ./config.status
52 else
53 rm -rf autom4te.cache
54 rm -f config.cache
56 run_versioned aclocal "$VERSION"
57 run_versioned autoconf 2.59 -Wall
58 run_versioned autoheader 2.59
59 run_versioned automake "$VERSION" -a -c --foreign
61 if test "x$NOCONFIGURE" = "x"; then
62 CFLAGS="-g -O0" ./configure --sysconfdir=/etc "$@"
63 make clean
64 fi
65 fi