summaryrefslogtreecommitdiff
path: root/source3/script
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2003-09-09 04:07:32 +0000
committerGerald Carter <jerry@samba.org>2003-09-09 04:07:32 +0000
commit4093bf7ff8c8861cf7b941945ede53a8ec5bb6c8 (patch)
treedd0a9f32d9933e1f75d919b5083e007d7453f9c4 /source3/script
parent3d7cb49747a9a7f5cdec0ee05c6270ec3604202f (diff)
downloadsamba-4093bf7ff8c8861cf7b941945ede53a8ec5bb6c8.tar.gz
samba-4093bf7ff8c8861cf7b941945ede53a8ec5bb6c8.tar.bz2
samba-4093bf7ff8c8861cf7b941945ede53a8ec5bb6c8.zip
sync 3.0 into HEAD for the last time
(This used to be commit c17a7dc9a190156a069da3e861c18fd3f81224ad)
Diffstat (limited to 'source3/script')
-rw-r--r--source3/script/.cvsignore1
-rwxr-xr-xsource3/script/find_missing_doc.pl90
-rwxr-xr-xsource3/script/findsmb.in210
-rw-r--r--source3/script/gap.awk39
-rw-r--r--source3/script/gaptab.awk48
-rw-r--r--source3/script/gen-8bit-gap.awk18
-rwxr-xr-xsource3/script/gen-8bit-gap.sh.in49
-rwxr-xr-xsource3/script/installmodules.sh9
-rwxr-xr-xsource3/script/installswat.sh18
-rwxr-xr-xsource3/script/linkmodules.sh12
-rw-r--r--source3/script/mkproto.awk14
-rwxr-xr-xsource3/script/mkproto.sh2
-rwxr-xr-xsource3/script/mkversion.sh87
13 files changed, 372 insertions, 225 deletions
diff --git a/source3/script/.cvsignore b/source3/script/.cvsignore
index 7a8114ecd7..0464ca2335 100644
--- a/source3/script/.cvsignore
+++ b/source3/script/.cvsignore
@@ -1 +1,2 @@
findsmb
+gen-8bit-gap.sh
diff --git a/source3/script/find_missing_doc.pl b/source3/script/find_missing_doc.pl
deleted file mode 100755
index b27a405e4d..0000000000
--- a/source3/script/find_missing_doc.pl
+++ /dev/null
@@ -1,90 +0,0 @@
-#!/usr/bin/perl
-
-my $doc_file = "/docs/docbook/manpages/smb.conf.5.sgml";
-my $source_file = "/source/param/loadparm.c";
-
-my %link,%doc,%param;
-
-# This one shouldn't be documented at all
-$doc{-valid} = "FOUND";
-
-$topdir = (shift @ARGV) or $topdir = ".";
-
-##################################################
-# Reading links from manpage
-
-open(IN,$topdir.$doc_file);
-
-while(<IN>) {
- if( /<listitem><para><link linkend="([^"]*)"><parameter>([^<]*)<\/parameter><\/link><\/para><\/listitem>/g ){
- $link{$2} = $1;
- $ref{$1} = $2;
- }
-}
-
-close(IN);
-
-##################################################
-# Reading documentation from manpage
-
-open(IN,$topdir.$doc_file) || die("Can't open $topdir$doc_file");
-
-while(<IN>) {
- if( /<term><anchor id="([^"]*)"\/>([^<]*?)([ ]*)\(.\)([ ]*)<\/term>/g ) {
- $key = $1;
- $value = $2;
- $doc{$value} = $key;
-
- # There is a reference to this entry
- if($ref{$key} eq $value){
- $ref{$key} = "FOUND";
- } else {
- if($ref{$key}) {
- print "$key should refer to $value, but refers to " . $ref{$key} . "\n";
- } else {
- print "$key should refer to $value, but has no reference!\n";
- }
- $ref{$key} = $value;
- }
- }
-}
-
-close(IN);
-
-#################################################
-# Reading entries from source code
-
-open(SOURCE,$topdir.$source_file) || die("Can't open $topdir$source_file");
-
-while ($ln = <SOURCE>) {
- last if $ln =~ m/^static\ struct\ parm_struct\ parm_table.*/;
-} #burn through the preceding lines
-
-while ($ln = <SOURCE>) {
- last if $ln =~ m/^\s*\}\;\s*$/;
- #pull in the param names only
- next if $ln =~ m/.*P_SEPARATOR.*/;
- next unless $ln =~ /.*\"(.*)\".*/;
-
- if($doc{lc($1)}) {
- $doc{lc($1)} = "FOUND";
- } else {
- print "$1 is not documented!\n";
- }
-}
-close SOURCE;
-
-##################################################
-# Trying to find missing references
-
-foreach (keys %ref) {
- if($ref{$_} cmp "FOUND") {
- print "$_ references to " . $ref{$_} . ", but " . $ref{$_} . " isn't an anchor!\n";
- }
-}
-
-foreach (keys %doc) {
- if($doc{$_} cmp "FOUND") {
- print "$_ is documented but is not a configuration option!\n";
- }
-}
diff --git a/source3/script/findsmb.in b/source3/script/findsmb.in
index 6276bd3f39..fb06018fe5 100755
--- a/source3/script/findsmb.in
+++ b/source3/script/findsmb.in
@@ -23,29 +23,33 @@
$SAMBABIN = "@prefix@/bin";
for ($i = 0; $i < 2; $i++) { # test for -d and -r options
- $_ = shift;
- if (m/-d|-D/) {
- $DEBUG = 1;
- } elsif (m/-r/) {
- $R_OPTION = "-r";
- }
+ $_ = shift;
+ if (m/-d|-D/) {
+ $DEBUG = 1;
+ } elsif (m/-r/) {
+ $R_OPTION = "-r";
+ }
}
if ($_) { # set broadcast address if it was specified
- $BCAST = "-B $_";
+ $BCAST = "-B $_";
}
-sub ipsort # do numeric sort on last field of IP address
+
+######################################################################
+# do numeric sort on last field of IP address
+sub ipsort
{
- @t1 = split(/\./,$a);
- @t2 = split(/\./,$b);
- @t1[3] <=> @t2[3];
+ @t1 = split(/\./,$a);
+ @t2 = split(/\./,$b);
+ @t1[3] <=> @t2[3];
}
+######################################################################
# look for all machines that respond to a name lookup
-open(NMBLOOKUP,"$SAMBABIN/nmblookup $BCAST '*'|") ||
- die("Can't run nmblookup '*'.\n");
+open(NMBLOOKUP,"$SAMBABIN/nmblookup $BCAST '*' --debuglevel=0|") ||
+ die("Can't run nmblookup '*'.\n");
# get rid of all lines that are not a response IP address,
# strip everything but IP address and sort by last field in address
@@ -59,94 +63,98 @@ print "---------------------------------------------------------------------\n";
foreach $ip (@ipaddrs) # loop through each IP address found
{
- $ip =~ s/\n//; # strip newline from IP address
-
-# find the netbios names registered by each machine
-
- open(NMBLOOKUP,"$SAMBABIN/nmblookup $R_OPTION -A $ip|") ||
- die("Can't get nmb name list.\n");
- @nmblookup = <NMBLOOKUP>;
- close NMBLOOKUP;
-
-# get the first <00> name
-
- @name = grep(/<00>/,@nmblookup);
- $_ = @name[0];
- if ($_) { # we have a netbios name
- if (/GROUP/) { # is it a group name
- ($name, $aliases, $type, $length, @addresses) =
- gethostbyaddr(pack('C4',split('\.',$ip)),2);
- if (! $name) { # could not get name
- $name = "unknown nis name";
+ $ip =~ s/\n//; # strip newline from IP address
+
+ # find the netbios names registered by each machine
+
+ open(NMBLOOKUP,"$SAMBABIN/nmblookup $R_OPTION -A $ip --debuglevel=0|") ||
+ die("Can't get nmb name list.\n");
+ @nmblookup = <NMBLOOKUP>;
+ close NMBLOOKUP;
+
+ # get the first <00> name
+
+ @name = grep(/<00>/,@nmblookup);
+ $_ = @name[0];
+
+ if ($_) { # we have a netbios name
+ if (/GROUP/) { # is it a group name
+ ($name, $aliases, $type, $length, @addresses) =
+ gethostbyaddr(pack('C4',split('\.',$ip)),2);
+ if (! $name) { # could not get name
+ $name = "unknown nis name";
+ }
+ } else {
+ # The Netbios name can contain lot of characters also '<' '>'
+ # and spaces. The follwing cure inside name space but not
+ # names starting or ending with spaces
+ /(.{1,15})\s+<00>\s+/;
+ $name = $1;
+ $name =~ s/^\s+//g;
+ }
+
+ # do an smbclient command on the netbios name.
+
+ if ( "$name" ) {
+ open(SMB,"$SAMBABIN/smbclient -L $name -I $ip -N --debuglevel=1 2>&1 |") ||
+ die("Can't do smbclient command.\n");
+ @smb = <SMB>;
+ close SMB;
+
+ if ($DEBUG) { # if -d flag print results of nmblookup and smbclient
+ print "===============================================================\n";
+ print @nmblookup;
+ print @smb;
+ }
+
+ # look for the OS= string
+
+ @info = grep(/OS=/,@smb);
+ $_ = @info[0];
+ if ($_) { # we found response
+ s/Domain=|OS=|Server=|\n//g; # strip out descriptions to make line shorter
+
+ } else { # no OS= string in response (WIN95 client)
+
+ # for WIN95 clients get workgroup name from nmblookup response
+ @name = grep(/<00> - <GROUP>/,@nmblookup);
+ $_ = @name[0];
+ if ($_) {
+ # Same as before for space and characters
+ /(.{1,15})\s+<00>\s+/;
+ $_ = "[$1]";
+ } else {
+ $_ = "Unknown Workgroup";
+ }
+ }
+ }
+
+ # see if machine registered a local master browser name
+ if (grep(/<1d>/,@nmblookup)) {
+ $master = '+'; # indicate local master browser
+ if (grep(/<1b>/,@nmblookup)) { # how about domain master browser?
+ $master = '*'; # indicate domain master browser
+ }
+ } else {
+ $master = ' '; # not a browse master
+ }
+
+ # line up info in 3 columns
+
+ print "$ip".' 'x(16-length($ip))."$name".' 'x(14-length($name))."$master"."$_\n";
+
+ } else { # no netbios name found
+ # try getting the host name
+ ($name, $aliases, $type, $length, @addresses) =
+ gethostbyaddr(pack('C4',split('\.',$ip)),2);
+ if (! $name) { # could not get name
+ $name = "unknown nis name";
+ }
+ if ($DEBUG) { # if -d flag print results of nmblookup
+ print "===============================================================\n";
+ print @nmblookup;
+ }
+ print "$ip".' 'x(16-length($ip))."$name\n";
}
- } else {
-# The Netbios name can contain lot of characters also '<' '>'
-# and spaces. The follwing cure inside name space but not
-# names starting or ending with spaces
- /(.{1,15})\s+<00>\s+/;
- $name = $1;
- }
-
-# do an smbclient command on the netbios name.
-
- open(SMB,"$SAMBABIN/smbclient -N -L $name -I $ip -U% |") ||
- die("Can't do smbclient command.\n");
- @smb = <SMB>;
- close SMB;
-
- if ($DEBUG) { # if -d flag print results of nmblookup and smbclient
- print "===============================================================\n";
- print @nmblookup;
- print @smb;
- }
-
-# look for the OS= string
-
- @info = grep(/OS=/,@smb);
- $_ = @info[0];
- if ($_) { # we found response
- s/Domain=|OS=|Server=|\n//g; # strip out descriptions to make line shorter
-
- } else { # no OS= string in response (WIN95 client)
-
-# for WIN95 clients get workgroup name from nmblookup response
- @name = grep(/<00> - <GROUP>/,@nmblookup);
- $_ = @name[0];
- if ($_) {
-# Same as before for space and characters
- /(.{1,15})\s+<00>\s+/;
- $_ = "[$1]";
- } else {
- $_ = "Unknown Workgroup";
- }
- }
-
-# see if machine registered a local master browser name
- if (grep(/<1d>/,@nmblookup)) {
- $master = '+'; # indicate local master browser
- if (grep(/<1b>/,@nmblookup)) { # how about domain master browser?
- $master = '*'; # indicate domain master browser
- }
- } else {
- $master = ' '; # not a browse master
- }
-
-# line up info in 3 columns
-
- print "$ip".' 'x(16-length($ip))."$name".' 'x(14-length($name))."$master"."$_\n";
-
- } else { # no netbios name found
-# try getting the host name
- ($name, $aliases, $type, $length, @addresses) =
- gethostbyaddr(pack('C4',split('\.',$ip)),2);
- if (! $name) { # could not get name
- $name = "unknown nis name";
- }
- if ($DEBUG) { # if -d flag print results of nmblookup
- print "===============================================================\n";
- print @nmblookup;
- }
- print "$ip".' 'x(16-length($ip))."$name\n";
- }
}
diff --git a/source3/script/gap.awk b/source3/script/gap.awk
new file mode 100644
index 0000000000..11680d10f9
--- /dev/null
+++ b/source3/script/gap.awk
@@ -0,0 +1,39 @@
+BEGIN { hv["0"] = 0; hv["1"] = 1; hv["2"] = 2; hv["3"] = 3;
+ hv["4"] = 4; hv["5"] = 5; hv["6"] = 6; hv["7"] = 7;
+ hv["8"] = 8; hv["9"] = 9; hv["A"] = 10; hv["B"] = 11;
+ hv["C"] = 12; hv["D"] = 13; hv["E"] = 14; hv["F"] = 15;
+ hv["a"] = 10; hv["b"] = 11; hv["c"] = 12; hv["d"] = 13;
+ hv["e"] = 14; hv["f"] = 15;
+
+ first = 0; last = 0; idx = 0;
+}
+
+function tonum(str)
+{
+ num=0;
+ cnt=1;
+ while (cnt <= length(str)) {
+ num *= 16;
+ num += hv[substr(str,cnt,1)];
+ ++cnt;
+ }
+ return num;
+}
+
+{
+ u = tonum($1);
+ if (u - last > 6)
+ {
+ if (last)
+ {
+ printf (" { 0x%04x, 0x%04x, %5d },\n",
+ first, last, idx);
+ idx -= u - last - 1;
+ }
+ first = u;
+ }
+ last = u;
+}
+
+END { printf (" { 0x%04x, 0x%04x, %5d },\n",
+ first, last, idx); }
diff --git a/source3/script/gaptab.awk b/source3/script/gaptab.awk
new file mode 100644
index 0000000000..f9d1526361
--- /dev/null
+++ b/source3/script/gaptab.awk
@@ -0,0 +1,48 @@
+BEGIN { hv["0"] = 0; hv["1"] = 1; hv["2"] = 2; hv["3"] = 3;
+ hv["4"] = 4; hv["5"] = 5; hv["6"] = 6; hv["7"] = 7;
+ hv["8"] = 8; hv["9"] = 9; hv["A"] = 10; hv["B"] = 11;
+ hv["C"] = 12; hv["D"] = 13; hv["E"] = 14; hv["F"] = 15;
+ hv["a"] = 10; hv["b"] = 11; hv["c"] = 12; hv["d"] = 13;
+ hv["e"] = 14; hv["f"] = 15;
+
+ first = 0; last = 0; idx = 0; f = 0;
+}
+
+function tonum(str)
+{
+ num=0;
+ cnt=1;
+ while (cnt <= length(str)) {
+ num *= 16;
+ num += hv[substr(str,cnt,1)];
+ ++cnt;
+ }
+ return num;
+}
+
+function fmt(val)
+{
+ if (f++ % 8 == 0)
+ { printf ("\n '\\x%02x',", val); }
+ else
+ { printf (" '\\x%02x',", val); }
+}
+
+{
+ u = tonum($1); c = tonum($2);
+
+ if (u - last > 6)
+ {
+ if (last) { idx += last - first + 1; }
+ first = u;
+ }
+ else
+ {
+ for (m = last+1; m < u; m++) { fmt(0); }
+ }
+
+ fmt(c);
+ last = u;
+}
+
+END { print "" }
diff --git a/source3/script/gen-8bit-gap.awk b/source3/script/gen-8bit-gap.awk
new file mode 100644
index 0000000000..59a1a23be0
--- /dev/null
+++ b/source3/script/gen-8bit-gap.awk
@@ -0,0 +1,18 @@
+BEGIN {
+ for (i=0; i<256; i++) {
+ tbl[sprintf("%02x",i)] = "0x0000";
+ }
+}
+
+/^<U([[:xdigit:]][[:xdigit:]][[:xdigit:]][[:xdigit:]])>[[:space:]]*.x([[:xdigit:]][[:xdigit:]])[:space:]*.*$/ {
+ tbl[substr($2,3,2)]=sprintf("0x%s",substr($1,3,4));
+}
+
+END {
+ for(i=0; i<32; i++) {
+ for(j=0; j<8; j++) {
+ printf(" %s,", tbl[sprintf("%02x",i*8+j)]);
+ }
+ printf "\n"
+ }
+} \ No newline at end of file
diff --git a/source3/script/gen-8bit-gap.sh.in b/source3/script/gen-8bit-gap.sh.in
new file mode 100755
index 0000000000..bcf64a4464
--- /dev/null
+++ b/source3/script/gen-8bit-gap.sh.in
@@ -0,0 +1,49 @@
+#!/bin/sh
+if test $# -ne 2 ; then
+ echo "Usage: $0 <charmap file> <CHARSET NAME>"
+ exit 1
+fi
+
+CHARMAP=$1
+CHARSETNAME=$2
+
+echo "/* "
+echo " * Conversion table for $CHARSETNAME charset "
+echo " * "
+echo " * Conversion tables are generated using $CHARMAP table "
+echo " * and source/script/gen-8bit-gap.sh script "
+echo " * "
+echo " * This program is free software; you can redistribute it and/or modify "
+echo " * it under the terms of the GNU General Public License as published by "
+echo " * the Free Software Foundation; either version 2 of the License, or "
+echo " * (at your option) any later version. "
+echo " * "
+echo " * This program is distributed in the hope that it will be useful,"
+echo " * but WITHOUT ANY WARRANTY; without even the implied warranty of "
+echo " * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the "
+echo " * GNU General Public License for more details. "
+echo " * "
+echo " * You should have received a copy of the GNU General Public License "
+echo " * along with this program; if not, write to the Free Software "
+echo " * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. "
+echo " */"
+
+echo '#include "includes.h"'
+echo
+echo "static const uint16 to_ucs2[256] = {"
+cat "$CHARMAP" | @AWK@ -f @srcdir@/script/gen-8bit-gap.awk
+echo "};"
+echo
+echo "static const struct charset_gap_table from_idx[] = {"
+sed -ne 's/^<U\(....\).*/\1/p' \
+ "$CHARMAP" | sort -u | @AWK@ -f @srcdir@/script/gap.awk
+echo " { 0xffff, 0xffff, 0 }"
+echo "};"
+echo
+echo "static const unsigned char from_ucs2[] = {"
+sed -ne 's/^<U\(....\)>[[:space:]]*.x\(..\).*/\1 \2/p' \
+ "$CHARMAP" | sort -u | @AWK@ -f @srcdir@/script/gaptab.awk
+echo "};"
+echo
+echo "SMB_GENERATE_CHARSET_MODULE_8_BIT_GAP($CHARSETNAME)"
+echo
diff --git a/source3/script/installmodules.sh b/source3/script/installmodules.sh
index ec5691992d..c80da76368 100755
--- a/source3/script/installmodules.sh
+++ b/source3/script/installmodules.sh
@@ -24,13 +24,4 @@ for p in $*; do
chmod $INSTALLPERMS $LIBDIR/$p2
done
-
-cat << EOF
-======================================================================
-The modules are installed. You may uninstall the modules using the
-command "make uninstallmodules" or "make uninstall" to uninstall
-binaries, man pages, shell scripts and modules.
-======================================================================
-EOF
-
exit 0
diff --git a/source3/script/installswat.sh b/source3/script/installswat.sh
index d1f8ea191d..bd2f8da234 100755
--- a/source3/script/installswat.sh
+++ b/source3/script/installswat.sh
@@ -71,13 +71,13 @@ done
done
-# Install Using Samba book
+# Install Using Samba book (but only if it is there)
-if [ "x$BOOKDIR" != "x" ]; then
+if [ "x$BOOKDIR" != "x" -a -f $SRCDIR../docs/htmldocs/using_samba/toc.html ]; then
# Create directories
- for d in $BOOKDIR $BOOKDIR/figs $BOOKDIR/gifs; do
+ for d in $BOOKDIR $BOOKDIR/figs ; do
if [ ! -d $d ]; then
mkdir $d
if [ ! -d $d ]; then
@@ -96,19 +96,17 @@ if [ "x$BOOKDIR" != "x" ]; then
chmod 0644 $FNAME
done
- # Figures
-
- for f in $SRCDIR../docs/htmldocs/using_samba/figs/*.gif; do
- FNAME=$BOOKDIR/figs/`basename $f`
+ for f in $SRCDIR../docs/htmldocs/using_samba/*.gif; do
+ FNAME=$BOOKDIR/`basename $f`
echo $FNAME
cp $f $FNAME || echo Cannot install $FNAME. Does $USER have privileges?
chmod 0644 $FNAME
done
- # Gifs
+ # Figures
- for f in $SRCDIR../docs/htmldocs/using_samba/gifs/*.gif; do
- FNAME=$BOOKDIR/gifs/`basename $f`
+ for f in $SRCDIR../docs/htmldocs/using_samba/figs/*.gif; do
+ FNAME=$BOOKDIR/figs/`basename $f`
echo $FNAME
cp $f $FNAME || echo Cannot install $FNAME. Does $USER have privileges?
chmod 0644 $FNAME
diff --git a/source3/script/linkmodules.sh b/source3/script/linkmodules.sh
new file mode 100755
index 0000000000..16a04cc064
--- /dev/null
+++ b/source3/script/linkmodules.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+cd "$1"
+test -f "$2" || exit 0
+
+for I in $3 $4 $5 $6 $7 $8
+do
+ echo "Linking $I to $2"
+ ln -s $2 $I
+done
+
+exit 0
diff --git a/source3/script/mkproto.awk b/source3/script/mkproto.awk
index 6a45a70cc3..b6e911699e 100644
--- a/source3/script/mkproto.awk
+++ b/source3/script/mkproto.awk
@@ -41,20 +41,6 @@ END {
}
}
-# special handling for code merge of TNG to head
-/^#define OLD_NTDOMAIN 1/ {
- printf "#if OLD_NTDOMAIN\n"
-}
-/^#undef OLD_NTDOMAIN/ {
- printf "#endif\n"
-}
-/^#define NEW_NTDOMAIN 1/ {
- printf "#if NEW_NTDOMAIN\n"
-}
-/^#undef NEW_NTDOMAIN/ {
- printf "#endif\n"
-}
-
# we handle the loadparm.c fns separately
/^FN_LOCAL_BOOL/ {
diff --git a/source3/script/mkproto.sh b/source3/script/mkproto.sh
index 2bf96c9b41..62041c7e33 100755
--- a/source3/script/mkproto.sh
+++ b/source3/script/mkproto.sh
@@ -25,7 +25,7 @@ header="$1"
shift
headertmp="$header.$$.tmp~"
-proto_src="`echo $@ | tr ' ' '\n' | sed -e 's/\.o/\.c/g' | sort | uniq | egrep -v 'ubiqx/|wrapped'`"
+proto_src="`echo $@ | tr ' ' '\n' | sed -e 's/\.o/\.c/g' | sort | uniq | egrep -v 'ubiqx/|wrapped|modules/getdate'`"
echo creating $header
diff --git a/source3/script/mkversion.sh b/source3/script/mkversion.sh
new file mode 100755
index 0000000000..ca39297940
--- /dev/null
+++ b/source3/script/mkversion.sh
@@ -0,0 +1,87 @@
+#!/bin/sh
+#
+
+VERSION_FILE=$1
+OUTPUT_FILE=$2
+
+if test -z "$VERSION_FILE";then
+ VERSION_FILE="VERSION"
+fi
+
+if test -z "$OUTPUT_FILE";then
+ OUTPUT_FILE="include/version.h"
+fi
+
+SOURCE_DIR=$3
+
+SAMBA_VERSION_MAJOR=`sed -n 's/^SAMBA_VERSION_MAJOR=//p' $SOURCE_DIR$VERSION_FILE`
+SAMBA_VERSION_MINOR=`sed -n 's/^SAMBA_VERSION_MINOR=//p' $SOURCE_DIR$VERSION_FILE`
+SAMBA_VERSION_RELEASE=`sed -n 's/^SAMBA_VERSION_RELEASE=//p' $SOURCE_DIR$VERSION_FILE`
+
+SAMBA_VERSION_REVISION=`sed -n 's/^SAMBA_VERSION_REVISION=//p' $SOURCE_DIR$VERSION_FILE`
+
+SAMBA_VERSION_PRE_RELEASE=`sed -n 's/^SAMBA_VERSION_PRE_RELEASE=//p' $SOURCE_DIR$VERSION_FILE`
+
+SAMBA_VERSION_RC_RELEASE=`sed -n 's/^SAMBA_VERSION_RC_RELEASE=//p' $SOURCE_DIR$VERSION_FILE`
+
+SAMBA_VERSION_BETA_RELEASE=`sed -n 's/^SAMBA_VERSION_BETA_RELEASE=//p' $SOURCE_DIR$VERSION_FILE`
+
+SAMBA_VERSION_ALPHA_RELEASE=`sed -n 's/^SAMBA_VERSION_ALPHA_RELEASE=//p' $SOURCE_DIR$VERSION_FILE`
+
+SAMBA_VERSION_TEST_RELEASE=`sed -n 's/^SAMBA_VERSION_TEST_RELEASE=//p' $SOURCE_DIR$VERSION_FILE`
+
+SAMBA_VERSION_IS_CVS_SNAPSHOT=`sed -n 's/^SAMBA_VERSION_IS_CVS_SNAPSHOT=//p' $SOURCE_DIR$VERSION_FILE`
+
+SAMBA_VERSION_VENDOR_SUFFIX=`sed -n 's/^SAMBA_VERSION_VENDOR_SUFFIX=//p' $SOURCE_DIR$VERSION_FILE`
+
+echo "/* Autogenerated by script/mkversion.sh */" > $OUTPUT_FILE
+
+echo "#define SAMBA_VERSION_MAJOR ${SAMBA_VERSION_MAJOR}" >> $OUTPUT_FILE
+echo "#define SAMBA_VERSION_MINOR ${SAMBA_VERSION_MINOR}" >> $OUTPUT_FILE
+echo "#define SAMBA_VERSION_RELEASE ${SAMBA_VERSION_RELEASE}" >> $OUTPUT_FILE
+
+
+SAMBA_VERSION_STRING="${SAMBA_VERSION_MAJOR}.${SAMBA_VERSION_MINOR}.${SAMBA_VERSION_RELEASE}"
+
+
+if test -n "${SAMBA_VERSION_REVISION}";then
+ SAMBA_VERSION_STRING="${SAMBA_VERSION_STRING}${SAMBA_VERSION_REVISION}"
+ echo "#define SAMBA_VERSION_REVISION \"${SAMBA_VERSION_REVISION}\"" >> $OUTPUT_FILE
+elif test -n "${SAMBA_VERSION_PRE_RELEASE}";then
+ SAMBA_VERSION_STRING="${SAMBA_VERSION_STRING}pre${SAMBA_VERSION_PRE_RELEASE}"
+ echo "#define SAMBA_VERSION_PRE_RELEASE ${SAMBA_VERSION_PRE_RELEASE}" >> $OUTPUT_FILE
+elif test -n "${SAMBA_VERSION_RC_RELEASE}";then
+ SAMBA_VERSION_STRING="${SAMBA_VERSION_STRING}rc${SAMBA_VERSION_RC_RELEASE}"
+ echo "#define SAMBA_VERSION_RC_RELEASE ${SAMBA_VERSION_RC_RELEASE}" >> $OUTPUT_FILE
+elif test -n "${SAMBA_VERSION_BETA_RELEASE}";then
+ SAMBA_VERSION_STRING="${SAMBA_VERSION_STRING}beta${SAMBA_VERSION_BETA_RELEASE}"
+ echo "#define SAMBA_VERSION_BETA_RELEASE ${SAMBA_VERSION_BETA_RELEASE}" >> $OUTPUT_FILE
+elif test -n "${SAMBA_VERSION_ALPHA_RELEASE}";then
+ SAMBA_VERSION_STRING="${SAMBA_VERSION_STRING}alpha${SAMBA_VERSION_ALPHA_RELEASE}"
+ echo "#define SAMBA_VERSION_ALPHA_RELEASE ${SAMBA_VERSION_ALPHA_RELEASE}" >> $OUTPUT_FILE
+elif test -n "${SAMBA_VERSION_TEST_RELEASE}";then
+ SAMBA_VERSION_STRING="${SAMBA_VERSION_STRING}test${SAMBA_VERSION_TEST_RELEASE}"
+ echo "#define SAMBA_VERSION_TEST_RELEASE ${SAMBA_VERSION_TEST_RELEASE}" >> $OUTPUT_FILE
+fi
+
+
+if test x"${SAMBA_VERSION_IS_CVS_SNAPSHOT}" = x"yes";then
+ SAMBA_VERSION_STRING="CVS ${SAMBA_VERSION_STRING}"
+ echo "#define SAMBA_VERSION_IS_CVS_SNAPSHOT 1" >> $OUTPUT_FILE
+fi
+
+if test -n "${SAMBA_VERSION_VENDOR_SUFFIX}";then
+ echo "#define SAMBA_VERSION_VENDOR_SUFFIX ${SAMBA_VERSION_VENDOR_SUFFIX}" >> $OUTPUT_FILE
+fi
+
+echo "#define SAMBA_VERSION_OFFICIAL_STRING \"${SAMBA_VERSION_STRING}\"" >> $OUTPUT_FILE
+
+echo "#define SAMBA_VERSION_STRING samba_version_string()" >> $OUTPUT_FILE
+
+echo "$0: 'include/version.h' created for Samba(\"${SAMBA_VERSION_STRING}\")"
+
+if test -n "${SAMBA_VERSION_VENDOR_SUFFIX}";then
+ echo "$0: with VENDOR_SUFFIX = ${SAMBA_VERSION_VENDOR_SUFFIX}"
+fi
+
+exit 0