chiark / gitweb /
d224f31fb542572def6af8eb8e5331b16ae37d7a
[elogind.git] / bootstrap.sh
1 #!/bin/bash
2
3 # This file is part of nss-myhostname.
4 #
5 # Copyright 2008 Lennart Poettering
6 #
7 # nss-myhostname is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU Lesser General Public License
9 # as published by the Free Software Foundation, either version 2.1 of
10 # the License, or (at your option) any later version.
11 #
12 # nss-myhostname is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 # Lesser General Public License for more details.
16 #
17 # You should have received a copy of the GNU Lesser General Public
18 # License along with nss-myhostname. If not, If not, see
19 # <http://www.gnu.org/licenses/>.
20
21 VERSION=1.9
22
23 run_versioned() {
24     local P
25     local V
26
27     V=$(echo "$2" | sed -e 's,\.,,g')
28
29     if [ -e "`which $1$V 2> /dev/null`" ] ; then
30         P="$1$V"
31     else
32         if [ -e "`which $1-$2 2> /dev/null`" ] ; then
33             P="$1-$2"
34         else
35             P="$1"
36         fi
37     fi
38
39     shift 2
40     "$P" "$@"
41 }
42
43 set -ex
44
45 if [ "x$1" = "xam" ] ; then
46     run_versioned automake "$VERSION" -a -c --foreign
47     ./config.status
48 else
49     rm -rf autom4te.cache
50     rm -f config.cache
51
52     touch config.rpath
53     test "x$LIBTOOLIZE" = "x" && LIBTOOLIZE=libtoolize
54
55     mkdir -p m4
56     "$LIBTOOLIZE" -c --force
57     run_versioned aclocal "$VERSION" -I m4
58     run_versioned autoconf 2.59 -Wall
59     run_versioned autoheader 2.59
60     run_versioned automake "$VERSION" --copy --foreign --add-missing
61
62     if test "x$NOCONFIGURE" = "x"; then
63         CFLAGS="-g -O0" ./configure --sysconfdir=/etc --localstatedir=/var "$@"
64         make clean
65     fi
66 fi