1#!/bin/sh
2# Run this to generate all the initial makefiles, etc.
3
4set -e
5
6srcdir=`dirname $0`
7test -z "$srcdir" && srcdir=.
8
9ORIGDIR=`pwd`
10cd $srcdir
11PROJECT=harfbuzz
12TEST_TYPE=-f
13FILE=src/harfbuzz.h
14ACLOCAL=${ACLOCAL-aclocal}
15LIBTOOLIZE=${LIBTOOLIZE-libtoolize}
16AUTOMAKE=${AUTOMAKE-automake}
17AUTOHEADER=${AUTOHEADER-autoheader}
18AUTOCONF=${AUTOCONF-autoconf}
19LIBTOOLIZE_FLAGS="--copy --force"
20
21DIE=0
22
23have_libtool=false
24if $LIBTOOLIZE --version < /dev/null > /dev/null 2>&1 ; then
25	libtool_version=`$LIBTOOLIZE --version | sed 's/^[^0-9]*\([0-9].[0-9.]*\).*/\1/'`
26	case $libtool_version in
27	    1.4*|1.5*|1.6*|1.7*|2*)
28		have_libtool=true
29		;;
30	esac
31fi
32if $have_libtool ; then : ; else
33	echo
34	echo "You must have libtool 1.4 installed to compile $PROJECT."
35	echo "Install the appropriate package for your distribution,"
36	echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
37	DIE=1
38fi
39
40($AUTOCONF --version) < /dev/null > /dev/null 2>&1 || {
41	echo
42	echo "You must have autoconf installed to compile $PROJECT."
43	echo "libtool the appropriate package for your distribution,"
44	echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
45	DIE=1
46}
47
48have_automake=false
49need_libtoolize=true
50if $AUTOMAKE --version < /dev/null > /dev/null 2>&1 ; then
51	automake_version=`$AUTOMAKE --version | grep 'automake (GNU automake)' | sed 's/^[^0-9]*\(.*\)/\1/'`
52	case $automake_version in
53	   1.2*|1.3*|1.4) 
54		;;
55	   1.4*)
56	   	have_automake=true
57	        need_libtoolize=false
58		;;
59	   *)
60		have_automake=true
61		;;
62	esac
63fi
64if $have_automake ; then : ; else
65	echo
66	echo "You must have automake 1.4-p1 installed to compile $PROJECT."
67	echo "Get ftp://ftp.gnu.org/pub/gnu/automake/automake-1.4-p1.tar.gz"
68	echo "(or a newer version if it is available)"
69	DIE=1
70fi
71
72if test "$DIE" -eq 1; then
73	exit 1
74fi
75
76test $TEST_TYPE $FILE || {
77	echo "You must run this script in the top-level $PROJECT directory"
78	exit 1
79}
80
81if test -z "$AUTOGEN_SUBDIR_MODE"; then
82        if test -z "$*"; then
83                echo "I am going to run ./configure with no arguments - if you wish "
84                echo "to pass any to it, please specify them on the $0 command line."
85        fi
86fi
87
88echo Running $ACLOCAL $ACLOCAL_FLAGS
89$ACLOCAL $ACLOCAL_FLAGS
90
91# optionally run autoheader
92if $AUTOHEADER --version  < /dev/null > /dev/null 2>&1; then
93	echo Running $AUTOHEADER
94	$AUTOHEADER
95fi
96
97case $need_libtoolize in
98   true)
99   	echo Running $LIBTOOLIZE $LIBTOOLIZE_FLAGS
100   	$LIBTOOLIZE $LIBTOOLIZE_FLAGS
101	;;
102esac
103
104echo Running $AUTOMAKE -a $am_opt
105$AUTOMAKE -a $am_opt
106echo Running $AUTOCONF
107$AUTOCONF
108cd $ORIGDIR
109
110if test -z "$AUTOGEN_SUBDIR_MODE"; then
111	echo Running $srcdir/configure "$@"
112        $srcdir/configure "$@"
113
114        echo 
115        echo "Now type 'make' to compile $PROJECT."
116fi
117