chiark / gitweb /
Generally bring up-to-date.
[cfd] / mdw-setup
1 #! /bin/sh
2
3 set -e
4
5 ### Basic setup stuff
6 ego=$(echo "$0" | sed 's:^.*[/\\]::; s:\.*$::')
7 usage="Usage: $ego [--debian]"
8
9 ### Parse options
10 debian=no
11 while [ $# -gt 0 ]; do
12   case "$1" in
13     --help | -h | --usage | -u)
14       echo "$usage"
15       exit
16       ;;
17     --debian)
18       debian=yes
19       ;;
20     --)
21       shift
22       break
23       ;;
24     -*)
25       echo >&2 "$ego: unknown option \`$1'"
26       exit 1
27       ;;
28   esac
29   shift
30 done
31 if [ $# -ne 0 ]; then
32   echo >&2 "$usage"
33   exit 1
34 fi
35
36 ### Link any strange common files we need
37 [ -f .links ] && mklinks
38
39 ### Do any local stuff
40 [ -x build-setup ] && ./build-setup start
41
42 ### Grind through the Autoconf machinery
43 configure=
44 for i in configure.ac configure.in; do
45   [ -f $i ] && configure=$i
46 done
47 if [ "$configure" ]; then
48   grep >/dev/null AM_PROG_LIBTOOL $configure && libtoolize
49   find . -name Makefile.m4 -print | while read m4; do
50     dir=$(echo $m4 | sed 's:/[^/]*$::')
51     (cd $dir &&
52      m4 Makefile.m4 >Makefile.am.new &&
53      mv Makefile.am.new Makefile.am)
54   done
55   aclocalargs=
56   for i in config m4; do [ -d $i ] && aclocalargs="$aclocalargs -I $i"; done
57   aclocal $aclocalargs
58   autoconf
59   grep >/dev/null AM_CONFIG_HEADER $configure && autoheader
60   [ -f Makefile.am ] && automake -a
61 fi
62
63 ### Do any local stuff
64 [ -x build-setup ] && ./build-setup end