s3:smbd/aio do not mark file modified during reads
[kai/samba.git] / source3 / autogen.sh
1 #!/bin/sh
2
3 # Run this script to build samba from GIT.
4
5
6 _exit() {
7         echo $@ >&2
8         cd ${OLD_DIR}
9         exit 1
10 }
11
12 OLD_DIR=$(pwd)
13 BASE_DIR=$(dirname $0)
14 SCRIPT_NAME=$(basename $0)
15
16 cd ${BASE_DIR} || exit 1
17
18
19 while true; do
20     case $1 in
21         --version-file)
22             VERSION_FILE=$2
23             shift 2
24             ;;
25         *)
26             break
27             ;;
28     esac
29 done
30
31 ## insert all possible names (only works with 
32 ## autoconf 2.x)
33 TESTAUTOHEADER="autoheader autoheader-2.53 autoheader2.50 autoheader259 autoheader253"
34 TESTAUTOCONF="autoconf autoconf-2.53 autoconf2.50 autoconf259 autoconf253"
35
36 AUTOHEADERFOUND="0"
37 AUTOCONFFOUND="0"
38
39
40 ##
41 ## Look for autoheader 
42 ##
43 for i in $TESTAUTOHEADER; 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                         AUTOHEADER=$i
47                         AUTOHEADERFOUND="1"
48                         break
49                 fi
50         fi
51 done
52
53 ## 
54 ## Look for autoconf
55 ##
56
57 for i in $TESTAUTOCONF; do
58         if which $i > /dev/null 2>&1; then
59                 if test `$i --version | head -n 1 | cut -d.  -f 2 | sed "s/[^0-9]//g"` -ge 53; then
60                         AUTOCONF=$i
61                         AUTOCONFFOUND="1"
62                         break
63                 fi
64         fi
65 done
66
67
68 ## 
69 ## do we have it?
70 ##
71 if test "$AUTOCONFFOUND" = "0" -o "$AUTOHEADERFOUND" = "0"; then
72         _exit "$0: need autoconf 2.53 or later to build samba from GIT"
73 fi
74
75 echo "$0: running script/mkversion.sh"
76 ./script/mkversion.sh $VERSION_FILE || exit 1
77
78 rm -rf autom4te*.cache
79 rm -f configure include/config.h*
80
81 IPATHS="-Im4 -I../m4 -I../lib/replace"
82
83 echo "$0: running $AUTOHEADER $IPATHS"
84 $AUTOHEADER $IPATHS || _exit "ERROR running autoheader"
85
86 echo "$0: running $AUTOCONF $IPATHS"
87 $AUTOCONF $IPATHS || _exit "ERROR running autoconf"
88
89 rm -rf autom4te*.cache
90
91 ( cd ../examples/VFS || exit 1
92   echo "$0: running $AUTOHEADER in ../examples/VFS/"
93   $AUTOHEADER || exit 1
94   echo "$0: running $AUTOCONF in ../examples/VFS/"
95   $AUTOCONF || exit 1
96   rm -rf autom4te*.cache
97 ) || _exit "ERROR running autoheader/autoconf in examples/VFS"
98
99
100 if gcc -E tests/preproc-dummy.c -o /dev/null ;
101 then
102     PIDL_OUTPUTDIR="autoconf/librpc/gen_ndr" CPP="gcc -E" PIDL=../pidl/pidl \
103         srcdir=. ../librpc/build_idl.sh ../librpc/idl/*.idl
104     PIDL_OUTPUTDIR="autoconf/librpc/gen_ndr" CPP="gcc -E" PIDL=../pidl/pidl \
105         srcdir=. script/build_idl.sh librpc/idl/*.idl
106 else
107    echo "Warning: Could not compile idl files in autogen, "
108    echo "some autconf tests might not work properly"
109 fi
110
111 perl ../script/mkparamdefs.pl ../lib/param/param_functions.c --file autoconf/lib/param/param_local.h --generate-scope=LOCAL
112 perl ../script/mkparamdefs.pl ../lib/param/loadparm.c ../lib/param/param_functions.c --file autoconf/lib/param/param_global.h --generate-scope=GLOBAL
113 perl ../script/mkparamdefs.pl param/loadparm.c ../lib/param/param_functions.c --file autoconf/source3/param/param_global.h --generate-scope=GLOBAL
114 perl ../source4/script/mkproto.pl ../lib/param/loadparm.c ../lib/param/param_functions.c --public autoconf/lib/param/param_proto.h --private autoconf/lib/param/param_proto.h
115 perl ../script/mks3param.pl ../lib/param/loadparm.c ../lib/param/param_functions.c --file autoconf/lib/param/s3_param.h
116
117 echo "Now run ./configure (or ./configure.developer) and then make."
118
119 cd ${OLD_DIR}
120 exit 0
121