Change in project setups.
authorMark Wooding <mdw@distorted.org.uk>
Tue, 7 Feb 2006 19:44:18 +0000 (19:44 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Tue, 7 Feb 2006 19:44:18 +0000 (19:44 +0000)
Replace lots of little `setup' scripts with a single `mdw-setup' script
here which works out what it needs to do.

Also, don't explicitly call `mkinstalldirs' from the Makefile.am,
because it doesn't exist any more.

Makefile.am
mdw-setup [new file with mode: 0755]
setup [deleted file]

index 460bc27..3e021de 100644 (file)
@@ -32,7 +32,7 @@ AUTOMAKE_OPTIONS = foreign
 
 ## --- What needs building ---
 
-bin_SCRIPTS = mklinks findlinks txtlib mkaclocal
+bin_SCRIPTS = mklinks findlinks txtlib mkaclocal mdw-setup
 
 ## --- Files to install in the repository ---
 
@@ -51,7 +51,7 @@ pkgdata_SCRIPTS = \
        install-ac maninst
 
 install-data-hook:
-       $(srcdir)/mkinstalldirs $(DESTDIR)$(aclocaldir)
+       $(mkinstalldirs) $(DESTDIR)$(aclocaldir)
        $(srcdir)/install-ac install \
                 $(srcdir)/aclocal.glob $(DESTDIR)$(aclocaldir)
 uninstall-hook:
diff --git a/mdw-setup b/mdw-setup
new file mode 100755 (executable)
index 0000000..d18a49a
--- /dev/null
+++ b/mdw-setup
@@ -0,0 +1,58 @@
+#! /bin/sh
+
+set -e
+
+### Basic setup stuff
+ego=$(echo "$0" | sed 's:^.*[/\\]::; s:\.*$::')
+usage="Usage: $ego [--debian]"
+
+### Parse options
+debian=no
+while [ $# -gt 0 ]; do
+  case "$1" in
+    --help | -h | --usage | -u)
+      echo "$usage"
+      exit
+      ;;
+    --debian)
+      debian=yes
+      ;;
+    --)
+      shift
+      break
+      ;;
+    -*)
+      echo >&2 "$ego: unknown option \`$1'"
+      exit 1
+      ;;
+  esac
+  shift
+done
+if [ $# -ne 0 ]; then
+  echo >&2 "$usage"
+  exit 1
+fi
+
+### Link any strange common files we need
+[ -f .links ] && mklinks
+
+### 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
+  find . -name Makefile.m4 -print | while read m4; do
+    am=$(echo $m4 | sed 's:.m4:.am:')
+    m4 $m4 >$am.new
+    mv $am.new $am
+  done
+  mkaclocal
+  autoconf
+  grep >/dev/null AM_CONFIG_HEADER $configure && autoheader
+  [ -f Makefile.am ] && automake -a
+fi
+
+### Maybe make a build directory
+[ $debian = no ] && [ ! -e build ] && mkdir build
diff --git a/setup b/setup
deleted file mode 100755 (executable)
index 5c7f1e0..0000000
--- a/setup
+++ /dev/null
@@ -1,7 +0,0 @@
-#! /bin/sh
-
-set -e
-mkaclocal || cp aclocal.glob aclocal.m4
-autoconf
-automake -a
-mkdir -p build