Add/update tests.
[eruntime.git] / bootstrap
bloba14883f0ec3cd50f5d470829eb423e51d7010e2e
1 #!/bin/bash
3 # {{{
5 # Copyright (C) 2006 Elfyn McBratney.
6 # All rights reserved.
8 # This file is part of eruntime.
10 # License:
12 # eruntime is free software; you can redistribute it and/or modify
13 # it under the terms of the GNU General Public License, version 2,
14 # as published by the Free Software Foundation.
16 # eruntime is distributed in the hope that it will be useful, but
17 # WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU General Public License for more details.
21 # You should have received a copy of the GNU General Public License
22 # along with eruntime; if not, write to:
24 # Free Software Foundation, Inc.
25 # 59 Temple Place
26 # Suite 330
27 # Boston, MA 02111-1307
28 # USA
30 # Authors:
32 # Elfyn McBratney <elfyn.mcbratney@gmail.com>
34 # }}}
36 prog="$(basename $0)"
38 force=no
39 configure=no
41 # {{{ usage()
42 usage() {
43 echo "Usage: $prog [options...]"
44 echo " -f, --force Force run of \`autoconf' and \`autoheader'"
45 echo " -c, --conf Run \`configure' after bootstrapping"
46 echo " -h, --help Display usage information"
47 exit 0
49 # }}}
51 # {{{ die()
52 die() {
53 echo "${prog}: error: $*" >&2
54 exit 1
56 # }}}
58 while [[ $# > 0 ]]; do
59 arg="$1"
60 shift
62 case "${arg}" in
63 -f|--force)
64 force=yes
67 -c|--conf)
68 configure=yes
69 break 2
72 -h|--help)
73 usage
77 die "invalid argument \`${arg}'"
79 esac
80 done
82 [[ -e configure.ac ]] || \
83 die "this script must be run from top-level source directory"
85 if [[ ${force} == yes || ! -e configure || configure.ac -nt configure ]]; then
86 echo "bootstrapping..."
87 for tool in auto{conf,header}; do
88 ${tool} || die "${tool} failed"
89 done
92 if [[ ${configure} == yes ]]; then
93 echo "configuring..."
94 ./configure "$@" || die "configure failed"
97 exit 0
100 # vim: ts=8 sw=8 noet fdm=marker tw=80