r26186: Generate SWIG files as part of autogen.sh
[jelmer/samba4-debian.git] / source / autogen.sh
1 #!/bin/sh
2
3 # Run this script to build samba from SVN.
4
5 ## insert all possible names (only works with 
6 ## autoconf 2.x
7 TESTAUTOHEADER="autoheader autoheader-2.53 autoheader2.50 autoheader259 autoheader253"
8 TESTAUTOCONF="autoconf autoconf-2.53 autoconf2.50 autoconf259 autoconf253"
9
10 AUTOHEADERFOUND="0"
11 AUTOCONFFOUND="0"
12
13
14 ##
15 ## Look for autoheader 
16 ##
17 for i in $TESTAUTOHEADER; do
18         if which $i > /dev/null 2>&1; then
19                 if test `$i --version | head -n 1 | cut -d.  -f 2 | sed "s/[^0-9]//g"` -ge 53; then
20                         AUTOHEADER=$i
21                         AUTOHEADERFOUND="1"
22                         break
23                 fi
24         fi
25 done
26
27 ## 
28 ## Look for autoconf
29 ##
30
31 for i in $TESTAUTOCONF; do
32         if which $i > /dev/null 2>&1; then
33                 if test `$i --version | head -n 1 | cut -d.  -f 2 | sed "s/[^0-9]//g"` -ge 53; then
34                         AUTOCONF=$i
35                         AUTOCONFFOUND="1"
36                         break
37                 fi
38         fi
39 done
40
41
42 ## 
43 ## do we have it?
44 ##
45 if test "$AUTOCONFFOUND" = "0" -o "$AUTOHEADERFOUND" = "0"; then
46         echo "$0: need autoconf 2.53 or later to build samba from SVN" >&2
47         exit 1
48 fi
49
50 echo "$0: running script/mkversion.sh"
51 ./script/mkversion.sh || exit 1
52
53 rm -rf autom4te*.cache
54 rm -f configure include/config_tmp.h*
55
56 IPATHS="-I. -Ilib/replace"
57
58 echo "$0: running $AUTOHEADER $IPATHS"
59 $AUTOHEADER $IPATHS || exit 1
60
61 echo "$0: running $AUTOCONF $IPATHS"
62 $AUTOCONF $IPATHS || exit 1
63
64 rm -rf autom4te*.cache
65
66 # Run swig if it is available
67 SWIG=swig
68 SWIG_FILES="./scripting/python/misc.i ./auth/auth.i ./auth/credentials/credentials.i ./lib/talloc/talloc.i ./lib/ldb/ldb.i ./lib/registry/registry.i ./lib/tdb/tdb.i ./libcli/swig/libcli_smb.i ./libcli/swig/libcli_nbt.i ./librpc/rpc/dcerpc.i"
69 if which $SWIG >/dev/null 2>&1; then
70         for I in $SWIG_FILES
71         do
72                 echo "$0: running $SWIG for $I"
73                 swig -python -keyword $I
74         done
75 fi
76
77 echo "Now run ./configure and then make."
78 exit 0