X-Git-Url: https://git.distorted.org.uk/~mdw/cfd/blobdiff_plain/30a4312c4913b956df15351e48a48b781c2cd1f5..60e6fde89a2e73210de48cd56b1c022f9aeec2b6:/mdw-setup diff --git a/mdw-setup b/mdw-setup index d18a49a..e4513e0 100755 --- a/mdw-setup +++ b/mdw-setup @@ -1,22 +1,46 @@ #! /bin/sh +### -*-sh-*- +### +### Set up a new project +### +### (c) 1997 Mark Wooding +### + +###----- Licensing notice --------------------------------------------------- +### +### This file is part of the Common Files Distribution (`common'). +### +### `Common' is free software; you can redistribute it and/or modify +### it under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2 of the License, or +### (at your option) any later version. +### +### `Common' is distributed in the hope that it will be useful, +### but WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +### GNU General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with `common'; if not, write to the Free Software Foundation, +### Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. set -e -### Basic setup stuff -ego=$(echo "$0" | sed 's:^.*[/\\]::; s:\.*$::') -usage="Usage: $ego [--debian]" +###-------------------------------------------------------------------------- +### Basic setup stuff. + +ego=${0##*[/\\]}; ego=${ego%%.*} +usage="Usage: $ego" + +###-------------------------------------------------------------------------- +### Parse command line arguments. -### Parse options -debian=no while [ $# -gt 0 ]; do case "$1" in --help | -h | --usage | -u) echo "$usage" exit ;; - --debian) - debian=yes - ;; --) shift break @@ -28,31 +52,53 @@ while [ $# -gt 0 ]; do esac shift done + if [ $# -ne 0 ]; then echo >&2 "$usage" exit 1 fi -### Link any strange common files we need +###-------------------------------------------------------------------------- +### Link any strange common files we need. + [ -f .links ] && mklinks -### Grind through the Autoconf machinery +###-------------------------------------------------------------------------- +### Do any initial local stuff. + +if [ -x build-setup ]; then ./build-setup start; fi + +###-------------------------------------------------------------------------- +### Grind through the Autoconf machinery. + configure= for i in configure.ac configure.in; do [ -f $i ] && configure=$i done if [ "$configure" ]; then - grep >/dev/null AM_PROG_LIBTOOL $configure && libtoolize + grep >/dev/null AM_PROG_LIBTOOL $configure && libtoolize -f find . -name Makefile.m4 -print | while read m4; do - am=$(echo $m4 | sed 's:.m4:.am:') - m4 $m4 >$am.new - mv $am.new $am + dir=${m4%/*} + (cd $dir && + m4 Makefile.m4 >Makefile.am.new && + mv Makefile.am.new Makefile.am) done - mkaclocal - autoconf - grep >/dev/null AM_CONFIG_HEADER $configure && autoheader + aclocalargs= + for i in config m4; do [ -d $i ] && aclocalargs="$aclocalargs -I $i"; done + aclocal $aclocalargs + autoconf --force + if grep >/dev/null 'AC_CONFIG_AUX_DIR' $configure; then + auxdir=$( + sed -n 's:^.*AC_CONFIG_AUX_DIR(\[\{0,1\}\([^])]*\)\]\{0,1\}).*$:\1:p' $configure) + mkdir -p $auxdir + fi + grep >/dev/null 'A[MC]_CONFIG_HEADER' $configure && autoheader [ -f Makefile.am ] && automake -a fi -### Maybe make a build directory -[ $debian = no ] && [ ! -e build ] && mkdir build +###-------------------------------------------------------------------------- +### Do any final local stuff. + +if [ -x build-setup ]; then ./build-setup end; fi + +###------ That's all, folks -------------------------------------------------