1#!/bin/sh
2# Run this to generate all the initial makefiles, etc.
3
4PROJECT=lasso
5TEST_TYPE=-f
6FILE=lasso.pc.in
7
8# a silly hack that generates autoregen.sh but it's handy
9echo "#!/bin/sh" > autoregen.sh
10echo "./autogen.sh $@ \$@" >> autoregen.sh
11chmod +x autoregen.sh
12
13DIE=0
14
15srcdir=`dirname $0`
16test -z "$srcdir" && srcdir=.
17
18THEDIR="`pwd`"
19
20cd "$srcdir"
21
22(autoconf --version) < /dev/null > /dev/null 2>&1 || {
23	echo
24	echo "You must have autoconf installed to compile $PROJECT."
25	echo "Download the appropriate package for your distribution,"
26	echo "or get the source tarball at ftp://ftp.gnu.org/gnu/autoconf/"
27	DIE=1
28}
29
30if automake-1.16 --version < /dev/null > /dev/null 2>&1; then
31    AUTOMAKE=automake-1.16
32    ACLOCAL=aclocal-1.16
33elif automake-1.15 --version < /dev/null > /dev/null 2>&1; then
34    AUTOMAKE=automake-1.15
35    ACLOCAL=aclocal-1.15
36elif automake-1.14 --version < /dev/null > /dev/null 2>&1; then
37    AUTOMAKE=automake-1.14
38    ACLOCAL=aclocal-1.14
39elif automake-1.13 --version < /dev/null > /dev/null 2>&1; then
40    AUTOMAKE=automake-1.13
41    ACLOCAL=aclocal-1.13
42elif automake-1.12 --version < /dev/null > /dev/null 2>&1; then
43    AUTOMAKE=automake-1.12
44    ACLOCAL=aclocal-1.12
45elif automake-1.11 --version < /dev/null > /dev/null 2>&1; then
46    AUTOMAKE=automake-1.11
47    ACLOCAL=aclocal-1.11
48elif automake-1.10 --version < /dev/null > /dev/null 2>&1; then
49    AUTOMAKE=automake-1.10
50    ACLOCAL=aclocal-1.10
51elif automake-1.9 --version < /dev/null > /dev/null 2>&1; then
52    AUTOMAKE=automake-1.9
53    ACLOCAL=aclocal-1.9
54elif automake-1.8 --version < /dev/null > /dev/null 2>&1; then
55    AUTOMAKE=automake-1.8
56    ACLOCAL=aclocal-1.8
57elif automake-1.7 --version < /dev/null > /dev/null 2>&1; then
58    AUTOMAKE=automake-1.7
59    ACLOCAL=aclocal-1.7
60elif automake-1.6 --version < /dev/null > /dev/null 2>&1; then
61    AUTOMAKE=automake-1.6
62    ACLOCAL=aclocal-1.6
63else
64	echo
65	echo "You must have automake installed to compile $PROJECT."
66	echo "Download the appropriate package for your distribution,"
67	echo "or get the source tarball at ftp://ftp.gnu.org/gnu/automake/"
68	DIE=1
69fi
70
71if test "$DIE" -eq 1; then
72	exit 1
73fi
74
75test $TEST_TYPE $FILE || {
76	echo "You must run this script in the top-level $PROJECT directory"
77	exit 1
78}
79
80if test "$#" = 0; then
81	echo "I am going to run ./configure with no arguments - if you wish "
82        echo "to pass any to it, please specify them on the $0 command line."
83fi
84
85# to support timj aclocal setup we are shipping gnome-doc-utils.m4
86# and making sure automake picks it up ;)
87# this is bad as -I prepends to the search path
88echo "* Running libtoolize"
89libtoolize --copy --force
90
91GTKDOCIZE=`which gtkdocize`
92if test -z $GTKDOCIZE; then
93        echo "You don't have gtk-doc installed, and thus"
94        echo "won't be able to generate the documentation."
95        touch gtk-doc.make
96else
97        echo "* Running gtkdocize"
98        $GTKDOCIZE --flavour no-tmpl || exit $?
99fi
100
101echo "* Running $ACLOCAL"
102$ACLOCAL $ACLOCAL_FLAGS -I m4 || exit $?
103
104echo "* Running autoconf"
105autoconf || exit $?
106(autoheader --version)  < /dev/null > /dev/null 2>&1 && autoheader
107
108echo "* Running $AUTOMAKE"
109$AUTOMAKE --add-missing -Wno-portability $am_opt || exit $?
110
111cd "$THEDIR"
112
113if [ "$1" != "noconfig" ]; then
114	$srcdir/configure --enable-gtk-doc --enable-maintainer-mode "$@" || exit $?
115fi
116
117echo
118echo "Now type 'make install' to install $PROJECT."
119