Makefile.am: Ship `debian/compat'.
[cfd] / mdw-setup
CommitLineData
30a4312c 1#! /bin/sh
996a7fd0
MW
2### -*-sh-*-
3###
ba4d97a4 4### Set up a new project
996a7fd0
MW
5###
6### (c) 1997 Mark Wooding
7###
8
9###----- Licensing notice ---------------------------------------------------
10###
11### This file is part of the Common Files Distribution (`common').
12###
13### `Common' is free software; you can redistribute it and/or modify
14### it under the terms of the GNU General Public License as published by
15### the Free Software Foundation; either version 2 of the License, or
16### (at your option) any later version.
17###
18### `Common' is distributed in the hope that it will be useful,
19### but WITHOUT ANY WARRANTY; without even the implied warranty of
20### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21### GNU General Public License for more details.
22###
23### You should have received a copy of the GNU General Public License
24### along with `common'; if not, write to the Free Software Foundation,
25### Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
30a4312c
MW
26
27set -e
28
996a7fd0
MW
29###--------------------------------------------------------------------------
30### Basic setup stuff.
31
30a4312c 32ego=$(echo "$0" | sed 's:^.*[/\\]::; s:\.*$::')
996a7fd0
MW
33usage="Usage: $ego"
34
35###--------------------------------------------------------------------------
36### Parse command line arguments.
30a4312c 37
30a4312c
MW
38while [ $# -gt 0 ]; do
39 case "$1" in
40 --help | -h | --usage | -u)
41 echo "$usage"
42 exit
43 ;;
30a4312c
MW
44 --)
45 shift
46 break
47 ;;
48 -*)
49 echo >&2 "$ego: unknown option \`$1'"
50 exit 1
51 ;;
52 esac
53 shift
54done
996a7fd0 55
30a4312c
MW
56if [ $# -ne 0 ]; then
57 echo >&2 "$usage"
58 exit 1
59fi
60
996a7fd0
MW
61###--------------------------------------------------------------------------
62### Link any strange common files we need.
63
30a4312c
MW
64[ -f .links ] && mklinks
65
996a7fd0
MW
66###--------------------------------------------------------------------------
67### Do any initial local stuff.
68
ba4d97a4 69if [ -x build-setup ]; then ./build-setup start; fi
1f79a056 70
996a7fd0
MW
71###--------------------------------------------------------------------------
72### Grind through the Autoconf machinery.
73
30a4312c
MW
74configure=
75for i in configure.ac configure.in; do
76 [ -f $i ] && configure=$i
77done
78if [ "$configure" ]; then
ba4d97a4 79 grep >/dev/null AM_PROG_LIBTOOL $configure && libtoolize -f
30a4312c 80 find . -name Makefile.m4 -print | while read m4; do
3dc9c14b
MW
81 dir=$(echo $m4 | sed 's:/[^/]*$::')
82 (cd $dir &&
83 m4 Makefile.m4 >Makefile.am.new &&
84 mv Makefile.am.new Makefile.am)
30a4312c 85 done
1f79a056
MW
86 aclocalargs=
87 for i in config m4; do [ -d $i ] && aclocalargs="$aclocalargs -I $i"; done
88 aclocal $aclocalargs
996a7fd0
MW
89 autoconf --force
90 if grep >/dev/null 'AC_CONFIG_AUX_DIR' $configure; then
91 auxdir=$(
4fd54ed3 92 sed -n 's:^.*AC_CONFIG_AUX_DIR(\[\{0,1\}\([^])]*\)\]\{0,1\}).*$:\1:p' $configure)
996a7fd0
MW
93 mkdir -p $auxdir
94 fi
95 grep >/dev/null 'A[MC]_CONFIG_HEADER' $configure && autoheader
30a4312c
MW
96 [ -f Makefile.am ] && automake -a
97fi
98
996a7fd0
MW
99###--------------------------------------------------------------------------
100### Do any final local stuff.
101
ba4d97a4 102if [ -x build-setup ]; then ./build-setup end; fi
996a7fd0
MW
103
104###------ That's all, folks -------------------------------------------------