1#!/bin/sh
2
3# Run this script to build samba from GIT.
4
5while true; do
6    case $1 in
7	--version-file)
8	    VERSION_FILE=$2
9	    shift 2
10	    ;;
11	*)
12	    break
13	    ;;
14    esac
15done
16
17## insert all possible names (only works with 
18## autoconf 2.x)
19TESTAUTOHEADER="autoheader autoheader-2.53 autoheader2.50 autoheader259 autoheader253"
20TESTAUTOCONF="autoconf autoconf-2.53 autoconf2.50 autoconf259 autoconf253"
21
22AUTOHEADERFOUND="0"
23AUTOCONFFOUND="0"
24
25
26##
27## Look for autoheader 
28##
29for i in $TESTAUTOHEADER; do
30	if which $i > /dev/null 2>&1; then
31		if test `$i --version | head -n 1 | cut -d.  -f 2 | sed "s/[^0-9]//g"` -ge 53; then
32			AUTOHEADER=$i
33			AUTOHEADERFOUND="1"
34			break
35		fi
36	fi
37done
38
39## 
40## Look for autoconf
41##
42
43for i in $TESTAUTOCONF; do
44	if which $i > /dev/null 2>&1; then
45		if test `$i --version | head -n 1 | cut -d.  -f 2 | sed "s/[^0-9]//g"` -ge 53; then
46			AUTOCONF=$i
47			AUTOCONFFOUND="1"
48			break
49		fi
50	fi
51done
52
53
54## 
55## do we have it?
56##
57if test "$AUTOCONFFOUND" = "0" -o "$AUTOHEADERFOUND" = "0"; then
58	echo "$0: need autoconf 2.53 or later to build samba from GIT" >&2
59	exit 1
60fi
61
62echo "$0: running script/mkversion.sh"
63./script/mkversion.sh $VERSION_FILE || exit 1
64
65rm -rf autom4te*.cache
66rm -f configure include/config.h*
67
68IPATHS="-Im4 -I../m4 -I../lib/replace -I../source4"
69
70echo "$0: running $AUTOHEADER $IPATHS"
71$AUTOHEADER $IPATHS || exit 1
72
73echo "$0: running $AUTOCONF $IPATHS"
74$AUTOCONF $IPATHS || exit 1
75
76rm -rf autom4te*.cache
77
78echo "Now run ./configure (or ./configure.developer) and then make."
79exit 0
80
81