1#!/bin/sh
2
3# set -x
4
5# remove /everything/ ready to remake
6rm -f Makefile Makefile.in aclocal.m4 config.* configure depcomp
7rm -rf autom4te.cache
8rm -f install-sh intltool-* ltmain.sh missing mkinstalldirs
9rm -f src/*.o src/nip2 src/Makefile src/Makefile.in
10
11# glib-gettextize asks us to copy these files to m4 if they aren't there
12# I don't have $ACDIR/isc-posix.m4, how mysterious
13ACDIR=`aclocal --print-ac-dir`
14
15# OS X with brew sets ACDIR to
16# /usr/local/Cellar/automake/x.y.z/share/aclocal, the staging area, which is
17# totally wrong argh
18if [ ! -d $ACDIR ]; then
19	ACDIR=/usr/local/share/aclocal
20fi
21
22mkdir -p m4
23cp $ACDIR/codeset.m4 m4
24cp $ACDIR/gettext.m4 m4
25cp $ACDIR/glibc21.m4 m4
26cp $ACDIR/iconv.m4 m4
27cp $ACDIR/lcmessage.m4 m4
28cp $ACDIR/progtest.m4 m4
29
30# some systems need libtoolize, some glibtoolize ... how annoying
31echo -n "testing for glibtoolize ... "
32if glibtoolize --version >/dev/null 2>&1; then
33  LIBTOOLIZE=glibtoolize
34  echo using glibtoolize
35else
36  LIBTOOLIZE=libtoolize
37  echo using libtoolize
38fi
39
40aclocal
41# this produces a lot of benign but misleading output ... hide it and hope for
42# the best
43glib-gettextize --force --copy > /dev/null
44test -r aclocal.m4 && chmod u+w aclocal.m4
45autoconf
46autoheader
47$LIBTOOLIZE --copy --force --automake
48automake --add-missing --copy
49
50./configure $*
51