1#!/bin/sh
2# Copyright 1999-2014 the Claws Mail team.
3# This file is part of Claws Mail package, and distributed under the
4# terms of the General Public License version 3 (or later).
5# See COPYING file for license details.
6
7bisonver=`bison --version`
8
9if [ "$bisonver" = "" ]; then
10	echo Bison is needed to compile Claws Mail git
11	exit 1
12fi
13
14if [ "$LEX" != "" ]; then
15	flexver=`$LEX --version|awk '{print $2}'`
16else
17	flexver=`flex --version|awk '{print $2}'`
18fi
19
20if [ "$flexver" = "" ]; then
21	echo Flex 2.5.31 or greater is needed to compile Claws Mail git
22	exit 1
23else
24	flex_major=`echo $flexver|sed "s/\..*//"`
25	flex_minor=`echo $flexver|sed "s/$flex_major\.\(.*\)\..*/\1/"`
26	flex_micro=`echo $flexver|sed "s/$flex_major\.$flex_minor\.\(.*\)/\1/"`
27
28	flex_numversion=$(expr \
29		$flex_major \* 10000 + \
30		$flex_minor \* 100 + \
31		$flex_micro)
32
33	if [ $flex_numversion -lt 20531 ]; then
34		echo Flex 2.5.31 or greater is needed to compile Claws Mail git
35		exit 1
36	fi
37fi
38
39case `uname` in
40	Darwin*)
41		if [ "`glibtoolize --version`" = "" ]; then
42			echo MacOS requires glibtool from either Macport or brew
43			exit 1
44		fi
45		LIBTOOL="glibtoolize --force --copy"
46		;;
47	*)
48		LIBTOOL="libtoolize --force --copy"
49		;;
50esac
51
52${LIBTOOL} \
53  && aclocal -I m4 \
54  && autoconf \
55  && autoheader \
56  && automake --add-missing --foreign --copy
57if test -z "$NOCONFIGURE"; then
58exec ./configure --enable-maintainer-mode "$@"
59fi
60