1#!/bin/sh
2
3set +e
4
5AUTORECONF=`which autoreconf`
6if test -z $AUTORECONF; then
7        echo "*** No autoreconf found, please install it ***"
8        exit 1
9fi
10
11INTLTOOLIZE=`which intltoolize`
12if test -z $INTLTOOLIZE; then
13        echo "*** No intltoolize found, please install the intltool package ***"
14        exit 1
15fi
16
17LIBTOOLIZE=`which libtoolize`
18if test -z $LIBTOOLIZE; then
19        LIBTOOLIZE=`which glibtoolize`
20        if ! test -z $LIBTOOLIZE; then
21                echo "Using glibtoolize. Is it OSX?"
22        fi
23fi
24
25if test -z $LIBTOOLIZE; then
26        echo "*** No libtoolize nor glibtoolize found, please install the intltool package ***"
27        exit 1
28fi
29
30echo "running libtooize ($LIBTOOLIZE)..."
31$LIBTOOLIZE  --ltdl --copy --force
32
33echo "running autopoint..."
34autopoint --force
35
36echo "running autoreconf..."
37AUTOPOINT='intltoolize --automake --copy' autoreconf --force --install --verbose
38
39# WORKAROUND 2013-08-15:
40# Patch the generated po/Makefile.in.in file so that locale files are installed
41# in the correct location on OS X and Free-BSD systems.  This is a workaround
42# for a bug in intltool.
43# See https://launchpad.net/bugs/398571 and https://bugs.launchpad.net/bugs/992047
44#
45# TODO: Drop this hack, and bump our intltool version requiement once the issue
46#       is fixed in intltool
47
48echo "patching po/Makefile.in.in..."
49sed 's/itlocaledir = $(prefix)\/$(DATADIRNAME)\/locale/itlocaledir = $(datarootdir)\/locale/' < po/Makefile.in.in > po/Makefile.in.in.tmp
50mv po/Makefile.in.in.tmp po/Makefile.in.in
51
52echo "Done! Please run ./configure now."
53