| 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 | ### Grind through the Autoconf machinery |
| 40 | configure= |
| 41 | for i in configure.ac configure.in; do |
| 42 | [ -f $i ] && configure=$i |
| 43 | done |
| 44 | if [ "$configure" ]; then |
| 45 | grep >/dev/null AM_PROG_LIBTOOL $configure && libtoolize |
| 46 | find . -name Makefile.m4 -print | while read m4; do |
| 47 | am=$(echo $m4 | sed 's:.m4:.am:') |
| 48 | m4 $m4 >$am.new |
| 49 | mv $am.new $am |
| 50 | done |
| 51 | mkaclocal |
| 52 | autoconf |
| 53 | grep >/dev/null AM_CONFIG_HEADER $configure && autoheader |
| 54 | [ -f Makefile.am ] && automake -a |
| 55 | fi |
| 56 | |
| 57 | ### Maybe make a build directory |
| 58 | [ $debian = no ] && [ ! -e build ] && mkdir build |