summaryrefslogtreecommitdiff
path: root/autogen.sh
blob: 862253412192d9c36536f890982adc8651d58b4b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/sh

set_git_hooks()
{
    # assume that the current directory is the source tree
    if [ -d ".git" ] ; then
        for hook in $(ls -1 .git-hooks) ; do
            cd .git/hooks
            if [ ! -e "${hook?}" -o -L "${hook?}" ] ; then
                rm -f "${hook?}"
                ln -sf "../../.git-hooks/${hook?}" "${hook?}"
            fi
            cd - > /dev/null
        done
    fi
}

TESTLIBTOOLIZE="glibtoolize libtoolize"

LIBTOOLIZEFOUND="0"

srcdir=`dirname $0`
test -z "$srcdir" && srcdir=.

olddir=`pwd`
cd $srcdir

set_git_hooks

aclocal --version > /dev/null 2> /dev/null || {
    echo "error: aclocal not found"
    exit 1
}
automake --version > /dev/null 2> /dev/null || {
    echo "error: automake not found"
    exit 1
}

for i in $TESTLIBTOOLIZE; do
    if which $i > /dev/null 2>&1; then
        LIBTOOLIZE=$i
        LIBTOOLIZEFOUND="1"
        break
    fi
done

if [ "$LIBTOOLIZEFOUND" = "0" ]; then
        echo "$0: need libtoolize tool to build libcdr" >&2
        exit 1
fi

amcheck=`automake --version | grep 'automake (GNU automake) 1.5'`
if test "x$amcheck" = "xautomake (GNU automake) 1.5"; then
    echo "warning: you appear to be using automake 1.5"
    echo "         this version has a bug - GNUmakefile.am dependencies are not generated"
fi

rm -rf autom4te*.cache

$LIBTOOLIZE --force --copy || {
    echo "error: libtoolize failed"
    exit 1
}
aclocal $ACLOCAL_FLAGS || {
    echo "error: aclocal $ACLOCAL_FLAGS failed"
    exit 1
}
autoheader || {
    echo "error: autoheader failed"
    exit 1
}
automake -a -c --foreign || {
    echo "warning: automake failed"
}
autoconf || {
    echo "error: autoconf failed"
    exit 1
}