1#!/bin/sh
2# Generates ./configure, Makefile.in's and tools
3
4# Copyright (C) 2007, 2008, 2010  Sylvain Beucler
5
6# Copying and distribution of this file, with or without modification,
7# are permitted in any medium without royalty provided the copyright
8# notice and this notice are preserved.
9
10# Cf. doc/bootstrap.txt.
11
12# Stop at first error:
13set -e
14# Print commands:
15set -x
16
17if [ "x$1" = xclean ]; then
18    test ! -f Makefile || make maintainer-clean || true
19
20    # Generated by aclocal.
21    rm -f aclocal.m4
22    # Generated by autoheader.
23    rm -f config.h.in
24    # Generated by autoconf.
25    rm -f configure
26    rm -rf autom4te.cache/
27    # Generated or brought in by automake.
28    find -name "Makefile.in" | xargs -r rm
29    find autotools/ -type l | xargs -r rm
30    exit;
31fi
32
33
34if ! which pkg-config > /dev/null; then
35    echo "Please install 'pkg-config' (used to query installed dependencies)"
36    echo "Cf. http://pkgconfig.freedesktop.org/"
37    exit 1
38fi
39
40# Gnulib
41# Look for gnulib-tool. Use '|| true' because of 'set -e' above
42GNULIB_TOOL=`PATH=gnulib-git:$PATH:/usr/src/gnulib which gnulib-tool \
43    || true`
44if [ -z "$GNULIB_TOOL" ]; then
45    git clone git://git.savannah.gnu.org/gnulib.git gnulib-git
46    GNULIB_TOOL=./gnulib-git/gnulib-tool
47fi
48$GNULIB_TOOL --update --more-symlinks
49
50# Beware of gnulib/gettext interaction,
51# cf. http://lists.gnu.org/archive/html/bug-gnulib/2008-12/msg00041.html
52if autoreconf --install --symlink --force $*
53then echo "You now can run ./configure"
54else echo "*** Error: please check the messages above. ***"
55fi
56