summaryrefslogtreecommitdiff
path: root/source4/script
diff options
context:
space:
mode:
authorbubulle <bubulle@alioth.debian.org>2011-06-07 20:43:08 +0000
committerbubulle <bubulle@alioth.debian.org>2011-06-07 20:43:08 +0000
commite64520a9ed05c9782a6e8ca8015fdef01b92ecc3 (patch)
treefc3a71a0b741cbcc6a5a892f91cc0f2218dfe656 /source4/script
parent6fe9013ae23927a67fa6b6033e2711cef99b3533 (diff)
downloadsamba-e64520a9ed05c9782a6e8ca8015fdef01b92ecc3.tar.gz
Revert upstream branch to 3.5.8....oops
git-svn-id: svn://svn.debian.org/svn/pkg-samba/branches/samba/upstream@3810 fc4039ab-9d04-0410-8cac-899223bdd6b0
Diffstat (limited to 'source4/script')
-rwxr-xr-xsource4/script/configure_check_unused.pl124
-rwxr-xr-xsource4/script/depfilter.py2
-rwxr-xr-xsource4/script/installdat.sh23
-rwxr-xr-xsource4/script/installdirs.sh17
-rwxr-xr-xsource4/script/installheader.pl109
-rwxr-xr-xsource4/script/installlib.sh32
-rwxr-xr-xsource4/script/installman.sh30
-rwxr-xr-xsource4/script/installmisc.sh31
-rwxr-xr-xsource4/script/installpc.sh16
-rwxr-xr-xsource4/script/installswat.sh37
-rwxr-xr-xsource4/script/minimal_includes.pl17
-rwxr-xr-xsource4/script/mkinstalldirs38
-rwxr-xr-xsource4/script/mkproto.pl6
-rwxr-xr-xsource4/script/mkrelease.sh42
-rwxr-xr-xsource4/script/mkversion.sh133
-rwxr-xr-xsource4/script/pkg-config145
-rwxr-xr-xsource4/script/revert.sh18
-rwxr-xr-xsource4/script/uninstalllib.sh35
-rwxr-xr-xsource4/script/uninstallman.sh27
19 files changed, 856 insertions, 26 deletions
diff --git a/source4/script/configure_check_unused.pl b/source4/script/configure_check_unused.pl
new file mode 100755
index 0000000000..52d8deeb27
--- /dev/null
+++ b/source4/script/configure_check_unused.pl
@@ -0,0 +1,124 @@
+#!/usr/bin/perl
+# Script that finds macros in a configure script that are not
+# used in a set of C files.
+# Copyright Jelmer Vernooij <jelmer@samba.org>, GPL
+#
+# Usage: ./$ARGV[0] configure.in [c-files...]
+
+use strict;
+
+sub autoconf_parse($$$$)
+{
+ my $in = shift;
+ my $defines = shift;
+ my $functions = shift;
+ my $headers = shift;
+
+ open(IN, $in) or die("Can't open $in");
+
+ my $ln = 0;
+
+ foreach(<IN>) {
+ $ln++;
+
+ if(/AC_DEFINE\(([^,]+),/) {
+ $defines->{$1} = "$in:$ln";
+ }
+
+ if(/AC_CHECK_FUNCS\(\[*(.[^],)]+)/) {
+ foreach(split / /, $1) {
+ $functions->{$_} = "$in:$ln";
+ }
+ }
+
+ if(/AC_CHECK_FUNC\(([^,)]+)/) {
+ $functions->{$1} = "$in:$ln";
+ }
+
+ if(/AC_CHECK_HEADERS\(\[*([^],)]+)/) {
+ foreach(split / /, $1) {
+ $headers->{$_} = "$in:$ln";
+ }
+ }
+
+ if(/AC_CHECK_HEADER\(([^,)]+)/) {
+ $headers->{$1} = "$in:$ln";
+ }
+
+ if(/sinclude\(([^,]+)\)/) {
+ autoconf_parse($1, $defines, $functions, $headers);
+ }
+ }
+
+ close IN;
+}
+
+# Return the symbols and headers used by a C file
+sub cfile_parse($$$)
+{
+ my $in = shift;
+ my $symbols = shift;
+ my $headers = shift;
+
+ open(FI, $in) or die("Can't open $in");
+ my $ln = 0;
+ my $line;
+ while($line = <FI>) {
+ $ln++;
+ $_ = $line;
+ if (/\#([ \t]*)include ["<]([^">]+)/) {
+ $headers->{$2} = "$in:$ln";
+ }
+
+ $_ = $line;
+ while(/([A-Za-z0-9_]+)/g) {
+ $symbols->{$1} = "$in:$ln";
+ }
+ }
+ close FI;
+}
+
+my %ac_defines = ();
+my %ac_func_checks = ();
+my %ac_headers = ();
+my %symbols = ();
+my %headers = ();
+
+if (scalar(@ARGV) <= 1) {
+ print("Usage: configure_find_unused.pl configure.in [CFILE...]\n");
+ exit 0;
+}
+
+autoconf_parse(shift(@ARGV), \%ac_defines, \%ac_func_checks, \%ac_headers);
+cfile_parse($_, \%symbols, \%headers) foreach(@ARGV);
+
+(keys %ac_defines) or warn("No defines found in configure.in file, parse error?");
+
+foreach (keys %ac_defines) {
+ if (not defined($symbols{$_})) {
+ print "$ac_defines{$_}: Autoconf-defined $_ is unused\n";
+ }
+}
+
+(keys %ac_func_checks) or warn("No function checks found in configure.in file, parse error?");
+
+foreach (keys %ac_func_checks) {
+ my $def = "HAVE_".uc($_);
+ if (not defined($symbols{$_})) {
+ print "$ac_func_checks{$_}: Autoconf-checked function `$_' is unused\n";
+ } elsif (not defined($symbols{$def})) {
+ print "$ac_func_checks{$_}: Autoconf-define `$def' for function `$_' is unused\n";
+ }
+}
+
+(keys %ac_headers) or warn("No headers found in configure.in file, parse error?");
+
+foreach (keys %ac_headers) {
+ my $def = "HAVE_".uc($_);
+ $def =~ s/[\/\.]/_/g;
+ if (not defined($headers{$_})) {
+ print "$ac_headers{$_}: Autoconf-checked header `$_' is unused\n";
+ } elsif (not defined($symbols{$def})) {
+ print "$ac_headers{$_}: Autoconf-define `$def' for header `$_' is unused\n";
+ }
+}
diff --git a/source4/script/depfilter.py b/source4/script/depfilter.py
index 440b560457..74d1d179c7 100755
--- a/source4/script/depfilter.py
+++ b/source4/script/depfilter.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python
#
# Filter out arcs in a dotty graph that are at or below a certain
# node. This is useful for visualising parts of the dependency graph.
diff --git a/source4/script/installdat.sh b/source4/script/installdat.sh
new file mode 100755
index 0000000000..bea8ad891a
--- /dev/null
+++ b/source4/script/installdat.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+#fist version March 2002, Herb Lewis
+
+DATDIR=$1
+SRCDIR=$2/
+
+echo Installing dat files in $DATDIR
+
+for f in $SRCDIR/../codepages/*.dat; do
+ FNAME=$DATDIR/`basename $f`
+ echo $FNAME
+ cp $f $FNAME || echo Cannot install $FNAME. Does $USER have privileges?
+ chmod 0644 $FNAME
+done
+
+cat << EOF
+======================================================================
+The dat files have been installed.
+======================================================================
+EOF
+
+exit 0
+
diff --git a/source4/script/installdirs.sh b/source4/script/installdirs.sh
new file mode 100755
index 0000000000..9557b86d3b
--- /dev/null
+++ b/source4/script/installdirs.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+while ( test -n "$1" ); do
+ if [ ! -d $1 ]; then
+ mkdir -p $1
+ fi
+
+ if [ ! -d $1 ]; then
+ echo Failed to make directory $1
+ exit 1
+ fi
+
+ shift;
+done
+
+
+
diff --git a/source4/script/installheader.pl b/source4/script/installheader.pl
new file mode 100755
index 0000000000..5be3434a5c
--- /dev/null
+++ b/source4/script/installheader.pl
@@ -0,0 +1,109 @@
+#!/usr/bin/perl
+# Copyright (C) 2006 Jelmer Vernooij
+use strict;
+use File::Basename;
+
+my $includedir = shift;
+
+
+sub read_headermap($)
+{
+ my ($fn) = @_;
+ my %map = ();
+ my $ln = 0;
+ open(MAP, "<headermap.txt");
+ while(<MAP>) {
+ $ln++;
+ s/#.*$//g;
+ next if (/^\s*$/);
+ if (! /^(.*): (.*)$/) {
+ print STDERR "headermap.txt:$ln: Malformed line\n";
+ next;
+ }
+ $map{$1} = $2;
+ }
+
+ close(MAP);
+
+ return %map;
+}
+
+my %map = read_headermap("headermap.txt");
+
+sub findmap($)
+{
+ $_ = shift;
+ s/^\.\///g;
+
+ if (! -f $_ && -f "lib/$_") { $_ = "lib/$_"; }
+
+ return $map{$_};
+}
+
+sub rewrite_include($$)
+{
+ my ($pos,$d) = @_;
+
+ my $n = findmap($d);
+ return $n if $n;
+ return $d;
+}
+
+sub install_header($$)
+{
+ my ($src,$dst) = @_;
+
+ my $lineno = 0;
+
+ open(IN, "<$src");
+ open(OUT, ">$dst");
+
+ while (<IN>) {
+ $lineno++;
+ die("Will not install autogenerated header $src") if (/This file was automatically generated by mkproto.pl. DO NOT EDIT/);
+
+ if (/^#include \"(.*)\"/) {
+ print OUT "#include <" . rewrite_include("$src:$lineno", $1) . ">\n";
+ } elsif (/^#if _SAMBA_BUILD_ == 4/) {
+ print OUT "#if 1\n";
+ } else {
+ print OUT $_;
+ }
+ }
+
+ close(OUT);
+ close(IN);
+}
+
+foreach my $p (@ARGV)
+{
+ my $p2 = findmap($p);
+ unless ($p2) {
+ die("Unable to map $p");
+ }
+ print "Installing $p as $includedir/$p2\n";
+
+ my $dirname = dirname($p2);
+
+ if (! -d "$includedir/$dirname") {
+ mkdir("$includedir/$dirname", 0777);
+ }
+
+ if ( -f "$includedir/$p2" ) {
+ unlink("$includedir/$p2.old");
+ rename("$includedir/$p2", "$includedir/$p2.old");
+ }
+
+ install_header($p,"$includedir/$p2");
+}
+
+print <<EOF;
+======================================================================
+The headers are installed. You may restore the old headers (if there
+were any) using the command "make revert". You may uninstall the headers
+using the command "make uninstallheader" or "make uninstall" to uninstall
+binaries, man pages and shell scripts.
+======================================================================
+EOF
+
+exit 0;
diff --git a/source4/script/installlib.sh b/source4/script/installlib.sh
new file mode 100755
index 0000000000..cc9ff0b9ea
--- /dev/null
+++ b/source4/script/installlib.sh
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+LIBDIR=$1
+SHLIBEXT=$2
+
+shift
+shift
+
+for p in $*; do
+ p2=`basename $p`
+ lnname=`echo $p2 | sed -e "s/\.$SHLIBEXT.*/.$SHLIBEXT/"`
+ echo Installing $p as $LIBDIR/$p2
+ if [ -f $LIBDIR/$p2 ]; then
+ rm -f $LIBDIR/$p2.old
+ mv $LIBDIR/$p2 $LIBDIR/$p2.old
+ fi
+ cp $p $LIBDIR/
+ if [ $p2 != $lnname ]; then
+ ln -sf $p2 $LIBDIR/$lnname
+ fi
+done
+
+cat << EOF
+======================================================================
+The shared libraries are installed. You may restore the old libraries (if there
+were any) using the command "make revert". You may uninstall the libraries
+using the command "make uninstalllib" or "make uninstall" to uninstall
+binaries, man pages and shell scripts.
+======================================================================
+EOF
+
+exit 0
diff --git a/source4/script/installman.sh b/source4/script/installman.sh
new file mode 100755
index 0000000000..3350eb87bc
--- /dev/null
+++ b/source4/script/installman.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+MANDIR=$1
+shift 1
+MANPAGES=$*
+
+for I in $MANPAGES
+do
+ SECTION=`echo -n $I | sed "s/.*\(.\)$/\1/"`
+ DIR="$MANDIR/man$SECTION"
+ if [ ! -d "$DIR" ]
+ then
+ mkdir "$DIR"
+ fi
+
+ BASE=`basename $I`
+
+ echo "Installing manpage \"$BASE\" in $DIR"
+ cp $I $DIR
+done
+
+cat << EOF
+======================================================================
+The man pages have been installed. You may uninstall them using the command
+the command "make uninstallman" or make "uninstall" to uninstall binaries,
+man pages and shell scripts.
+======================================================================
+EOF
+
+exit 0
diff --git a/source4/script/installmisc.sh b/source4/script/installmisc.sh
new file mode 100755
index 0000000000..8bf80b2e46
--- /dev/null
+++ b/source4/script/installmisc.sh
@@ -0,0 +1,31 @@
+#!/bin/sh
+# install miscellaneous files
+
+SRCDIR="$1"
+SETUPDIR="$2"
+
+cd $SRCDIR || exit 1
+
+echo "Installing setup templates"
+mkdir -p $SETUPDIR || exit 1
+mkdir -p $SETUPDIR/ad-schema || exit 1
+cp setup/ad-schema/*.txt $SETUPDIR/ad-schema || exit 1
+for p in enableaccount newuser provision setexpiry setpassword pwsettings
+do
+ chmod a+x setup/$p
+ cp setup/$p $SETUPDIR || exit 1
+done
+cp setup/schema-map-* $SETUPDIR || exit 1
+cp setup/DB_CONFIG $SETUPDIR || exit 1
+cp setup/*.inf $SETUPDIR || exit 1
+cp setup/*.ldif $SETUPDIR || exit 1
+cp setup/*.reg $SETUPDIR || exit 1
+cp setup/*.zone $SETUPDIR || exit 1
+cp setup/*.conf $SETUPDIR || exit 1
+cp setup/*.php $SETUPDIR || exit 1
+cp setup/*.txt $SETUPDIR || exit 1
+cp setup/provision.smb.conf.dc $SETUPDIR || exit 1
+cp setup/provision.smb.conf.member $SETUPDIR || exit 1
+cp setup/provision.smb.conf.standalone $SETUPDIR || exit 1
+
+exit 0
diff --git a/source4/script/installpc.sh b/source4/script/installpc.sh
new file mode 100755
index 0000000000..81ca2f8145
--- /dev/null
+++ b/source4/script/installpc.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+# install miscellaneous files
+
+SRCDIR="$1"
+PKGCONFIGDIR="$2"
+shift
+shift
+
+cd $SRCDIR || exit 1
+
+for I in $*
+do
+ cp $I $PKGCONFIGDIR
+done
+
+exit 0
diff --git a/source4/script/installswat.sh b/source4/script/installswat.sh
new file mode 100755
index 0000000000..4304e3e490
--- /dev/null
+++ b/source4/script/installswat.sh
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+SWATDIR=$1
+SRCDIR=$2
+
+echo Installing swat files in $SWATDIR
+
+cd $SRCDIR/../swat || exit 1
+
+mkdir -p $SWATDIR || exit 1
+
+installdir() {
+ for f in $*; do
+ dname=`dirname $f`
+ echo "Installing $f in $dname"
+ test -d $SWATDIR/$dname || mkdir -p $SWATDIR/$dname || exit 1
+ cp $f $SWATDIR/$dname/ || exit 1
+ chmod 0644 $SWATDIR/$f || exit 1
+ done
+}
+
+installdir `find . -name '*.js'`
+installdir `find . -name '*.esp'`
+installdir `find . -name '*.css'`
+installdir `find . -name '*.png'`
+installdir `find . -name '*.ico'`
+installdir `find . -name '*.gif'`
+installdir `find . -name '*.ejs'`
+
+cat << EOF
+======================================================================
+The swat files have been installed.
+======================================================================
+EOF
+
+exit 0
+
diff --git a/source4/script/minimal_includes.pl b/source4/script/minimal_includes.pl
index 4203d00ac0..2bcbd1152a 100755
--- a/source4/script/minimal_includes.pl
+++ b/source4/script/minimal_includes.pl
@@ -11,7 +11,6 @@ use Getopt::Long;
my $opt_help = 0;
my $opt_remove = 0;
my $opt_skip_system = 0;
-my $opt_waf = 0;
#####################################################################
# write a string into a file
@@ -44,11 +43,7 @@ sub test_compile($)
{
my $fname = shift;
my $obj;
- if ($opt_waf) {
- my $ret = `../buildtools/bin/waf $fname 2>&1`;
- return $ret
- }
- if ($fname =~ s/(.*)\..*$/$1.o/) {
+ if ($fname =~ s/(.*)\.c$/$1.o/) {
$obj = "$1.o";
} else {
return "NOT A C FILE";
@@ -72,10 +67,7 @@ sub test_include($$$$)
$lines->[$i] = "";
- my $mname = $fname . ".misaved";
-
- unlink($mname);
- rename($fname, $mname) || die "failed to rename $fname";
+ `/bin/mv -f $fname $fname.misaved` && die "failed to rename $fname";
save_lines($fname, $lines);
my $out = test_compile($fname);
@@ -87,7 +79,6 @@ sub test_include($$$$)
print "$fname: not removing system include $line\n";
} else {
print "$fname: removing $line\n";
- unlink($mname);
return;
}
} else {
@@ -96,7 +87,7 @@ sub test_include($$$$)
}
$lines->[$i] = $line;
- rename($mname, $fname) || die "failed to restore $fname";
+ `/bin/mv -f $fname.misaved $fname` && die "failed to restore $fname";
}
sub process_file($)
@@ -147,7 +138,6 @@ sub ShowHelp()
--help show help
--remove remove includes, don't just list them
--skip-system don't remove system/ includes
- --waf use waf target conventions
";
}
@@ -157,7 +147,6 @@ GetOptions (
'h|help|?' => \$opt_help,
'remove' => \$opt_remove,
'skip-system' => \$opt_skip_system,
- 'waf' => \$opt_waf,
);
if ($opt_help) {
diff --git a/source4/script/mkinstalldirs b/source4/script/mkinstalldirs
new file mode 100755
index 0000000000..f945dbf2bc
--- /dev/null
+++ b/source4/script/mkinstalldirs
@@ -0,0 +1,38 @@
+#! /bin/sh
+# mkinstalldirs --- make directory hierarchy
+# Author: Noah Friedman <friedman@prep.ai.mit.edu>
+# Created: 1993-05-16
+# Public domain
+
+errstatus=0
+
+for file
+do
+ set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
+ shift
+
+ pathcomp=
+ for d
+ do
+ pathcomp="$pathcomp$d"
+ case "$pathcomp" in
+ -* ) pathcomp=./$pathcomp ;;
+ esac
+
+ if test ! -d "$pathcomp"; then
+ echo "mkdir $pathcomp" 1>&2
+
+ mkdir "$pathcomp" || lasterr=$?
+
+ if test ! -d "$pathcomp"; then
+ errstatus=$lasterr
+ fi
+ fi
+
+ pathcomp="$pathcomp/"
+ done
+done
+
+exit $errstatus
+
+# mkinstalldirs ends here
diff --git a/source4/script/mkproto.pl b/source4/script/mkproto.pl
index 4760e63bda..59307881c4 100755
--- a/source4/script/mkproto.pl
+++ b/source4/script/mkproto.pl
@@ -128,7 +128,7 @@ sub handle_loadparm($$)
{
my ($file,$line) = @_;
- if ($line =~ /^FN_(GLOBAL|LOCAL)_(CONST_STRING|STRING|BOOL|bool|CHAR|INTEGER|LIST)\((\w+),.*\)/o) {
+ if ($line =~ /^_PUBLIC_ FN_(GLOBAL|LOCAL)_(CONST_STRING|STRING|BOOL|bool|CHAR|INTEGER|LIST)\((\w+),.*\)/o) {
my $scope = $1;
my $type = $2;
my $name = $3;
@@ -147,7 +147,7 @@ sub handle_loadparm($$)
"LOCAL" => "struct loadparm_service *, struct loadparm_service *"
);
- $file->("$tmap{$type}lpcfg_$name($smap{$scope});\n");
+ $file->("$tmap{$type}$name($smap{$scope});\n");
}
}
@@ -190,7 +190,7 @@ sub process_file($$$)
next if ($line =~ /^\/|[;]/);
- if ($line =~ /^FN_/) {
+ if ($line =~ /^_PUBLIC_ FN_/) {
handle_loadparm($public_file, $line);
handle_loadparm($private_file, $line);
next;
diff --git a/source4/script/mkrelease.sh b/source4/script/mkrelease.sh
index 6ad927b982..69ddaa213e 100755
--- a/source4/script/mkrelease.sh
+++ b/source4/script/mkrelease.sh
@@ -6,15 +6,41 @@ if [ ! -d ".git" -o `dirname $0` != "./source4/script" ]; then
exit 1
fi
-cd source4
-../buildtools/bin/waf dist
-TGZFILE="`echo *.tar.gz`"
-gunzip $TGZFILE
-TARFILE="`echo *.tar`"
+OUTDIR=`mktemp -d samba-XXXXX`
+(git archive --format=tar HEAD | (cd $OUTDIR/ && tar xf -))
+echo SAMBA_VERSION_IS_GIT_SNAPSHOT=no >> $OUTDIR/source4/VERSION
+
+rm -f $OUTDIR/source4/ldap_server/devdocs/rfc????.txt \
+ $OUTDIR/source4/heimdal/lib/wind/rfc????.txt
+
+#Prepare the tarball for a Samba4 release, with some generated files,
+#but without Samba3 stuff (to avoid confusion)
+( cd $OUTDIR/ || exit 1
+ rm -rf README Manifest Read-Manifest-Now Roadmap source3 packaging docs-xml examples swat WHATSNEW.txt MAINTAINERS || exit 1
+ cd source4 || exit 1
+ ./autogen.sh || exit 1
+ ./configure || exit 1
+ make dist || exit 1
+) || exit 1
+
+VERSION_FILE=$OUTDIR/source4/version.h
+if [ ! -f $VERSION_FILE ]; then
+ echo "Cannot find version.h at $VERSION_FILE"
+ exit 1;
+fi
+
+VERSION=`sed -n 's/^SAMBA_VERSION_STRING=//p' $VERSION_FILE`
+echo "Version: $VERSION"
+mv $OUTDIR samba-$VERSION || exit 1
+tar -cf samba-$VERSION.tar samba-$VERSION || (rm -rf samba-$VERSION; exit 1)
+rm -rf samba-$VERSION || exit 1
echo "Now run: "
-echo "gpg --detach-sign --armor $TARFILE"
-echo "gzip $TARFILE"
+echo "gpg --detach-sign --armor samba-$VERSION.tar"
+echo "gzip samba-$VERSION.tar"
echo "And then upload "
-echo "$TARFILE.gz $TARFILE.asc"
+echo "samba-$VERSION.tar.gz samba-$VERSION.tar.asc"
echo "to pub/samba/samba4/ on samba.org"
+
+
+
diff --git a/source4/script/mkversion.sh b/source4/script/mkversion.sh
new file mode 100755
index 0000000000..da912ac092
--- /dev/null
+++ b/source4/script/mkversion.sh
@@ -0,0 +1,133 @@
+#!/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="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_TP_RELEASE=`sed -n 's/^SAMBA_VERSION_TP_RELEASE=//p' $SOURCE_DIR$VERSION_FILE`
+SAMBA_VERSION_ALPHA_RELEASE=`sed -n 's/^SAMBA_VERSION_ALPHA_RELEASE=//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_IS_GIT_SNAPSHOT=`sed -n 's/^SAMBA_VERSION_IS_GIT_SNAPSHOT=//p' $SOURCE_DIR$VERSION_FILE`
+
+SAMBA_VERSION_RELEASE_NICKNAME=`sed -n 's/^SAMBA_VERSION_RELEASE_NICKNAME=//p' $SOURCE_DIR$VERSION_FILE`
+
+SAMBA_VERSION_VENDOR_SUFFIX=`sed -n 's/^SAMBA_VERSION_VENDOR_SUFFIX=//p' $SOURCE_DIR$VERSION_FILE`
+SAMBA_VERSION_VENDOR_PATCH=`sed -n 's/^SAMBA_VERSION_VENDOR_PATCH=//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
+
+
+##
+## start with "3.0.22"
+##
+SAMBA_VERSION_STRING="${SAMBA_VERSION_MAJOR}.${SAMBA_VERSION_MINOR}.${SAMBA_VERSION_RELEASE}"
+
+
+##
+## maybe add "3.0.22a" or "4.0.0tp11" or "4.0.0alpha1" or "3.0.22pre1" or "3.0.22rc1"
+## We do not do pre or rc version on patch/letter releases
+##
+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_TP_RELEASE}";then
+ SAMBA_VERSION_STRING="${SAMBA_VERSION_STRING}tp${SAMBA_VERSION_TP_RELEASE}"
+ echo "#define SAMBA_VERSION_TP_RELEASE ${SAMBA_VERSION_TP_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_PRE_RELEASE}";then
+ ## maybe add "3.0.22pre2"
+ 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
+fi
+
+##
+## GIT commit details
+##
+if test x"${SAMBA_VERSION_IS_GIT_SNAPSHOT}" = x"yes";then
+ _SAVE_LANG=${LANG}
+ LANG="C"
+ HAVEVER="no"
+
+ if test x"${HAVEVER}" != x"yes" -a -d "${SOURCE_DIR}../.git";then
+ HAVEGIT=no
+ GIT_INFO=`git show --pretty=format:"%h%n%ct%n%H%n%cd" --stat HEAD 2>/dev/null`
+ GIT_COMMIT_ABBREV=`printf %s "${GIT_INFO}" | sed -n 1p`
+ GIT_COMMIT_TIME=`printf %s "${GIT_INFO}" | sed -n 2p`
+ GIT_COMMIT_FULLREV=`printf %s "${GIT_INFO}" | sed -n 3p`
+ GIT_COMMIT_DATE=`printf %s "${GIT_INFO}" | sed -n 4p`
+ if test -n "${GIT_COMMIT_ABBREV}";then
+ HAVEGIT=yes
+ HAVEVER=yes
+ fi
+ fi
+
+ if test x"${HAVEGIT}" = x"yes";then
+ SAMBA_VERSION_STRING="${SAMBA_VERSION_STRING}-GIT-${GIT_COMMIT_ABBREV}"
+
+ echo "#define SAMBA_VERSION_GIT_COMMIT_ABBREV \"${GIT_COMMIT_ABBREV}\"" >> $OUTPUT_FILE
+ echo "#define SAMBA_VERSION_GIT_COMMIT_TIME ${GIT_COMMIT_TIME}" >> $OUTPUT_FILE
+ echo "#define SAMBA_VERSION_GIT_COMMIT_FULLREV \"${GIT_COMMIT_FULLREV}\"" >> $OUTPUT_FILE
+ echo "#define SAMBA_VERSION_GIT_COMMIT_DATE \"${GIT_COMMIT_DATE}\"" >> $OUTPUT_FILE
+ else
+ SAMBA_VERSION_STRING="${SAMBA_VERSION_STRING}-GIT-UNKNOWN"
+ fi
+ LANG=${_SAVE_LANG}
+fi
+
+echo "#define SAMBA_VERSION_OFFICIAL_STRING \"${SAMBA_VERSION_STRING}\"" >> $OUTPUT_FILE
+
+##
+## Add the vendor string if present
+##
+if test -n "${SAMBA_VERSION_VENDOR_SUFFIX}";then
+ echo "#define SAMBA_VERSION_VENDOR_SUFFIX ${SAMBA_VERSION_VENDOR_SUFFIX}" >> $OUTPUT_FILE
+ SAMBA_VERSION_STRING="${SAMBA_VERSION_STRING}-${SAMBA_VERSION_VENDOR_SUFFIX}"
+ if test -n "${SAMBA_VERSION_VENDOR_PATCH}";then
+ echo "#define SAMBA_VERSION_VENDOR_PATCH ${SAMBA_VERSION_VENDOR_PATCH}" >> $OUTPUT_FILE
+ SAMBA_VERSION_STRING="${SAMBA_VERSION_STRING}-${SAMBA_VERSION_VENDOR_PATCH}"
+ fi
+fi
+
+echo "/* Version for mkrelease.sh: " >> $OUTPUT_FILE
+echo "SAMBA_VERSION_STRING=$SAMBA_VERSION_STRING" >> $OUTPUT_FILE
+echo "*/" >> $OUTPUT_FILE
+
+##
+## Add a release nickname
+##
+if test -n "${SAMBA_VERSION_RELEASE_NICKNAME}";then
+ echo "#define SAMBA_VERSION_RELEASE_NICKNAME ${SAMBA_VERSION_RELEASE_NICKNAME}" >> $OUTPUT_FILE
+ SAMBA_VERSION_STRING="${SAMBA_VERSION_STRING} (${SAMBA_VERSION_RELEASE_NICKNAME})"
+fi
+
+echo "#define SAMBA_VERSION_STRING \"${SAMBA_VERSION_STRING}\"" >> $OUTPUT_FILE
+
+echo "$0: '$OUTPUT_FILE' created for Samba(\"${SAMBA_VERSION_STRING}\")"
+
+exit 0
diff --git a/source4/script/pkg-config b/source4/script/pkg-config
new file mode 100755
index 0000000000..458cac6be2
--- /dev/null
+++ b/source4/script/pkg-config
@@ -0,0 +1,145 @@
+#!/usr/bin/perl
+# Simple pkg-config implementation in perl
+# jelmer@samba.org, November 2006
+
+use strict;
+use Getopt::Long;
+
+my @dirs = split(/:/, $ENV{PKG_CONFIG_PATH});
+
+my $opt_help = 0;
+my $opt_libs = 0;
+my $opt_cflags = 0;
+my $opt_static = 0;
+
+my $result = GetOptions (
+ 'help|h|?' => \$opt_help,
+ 'static' => \$opt_static,
+ 'libs' => \$opt_libs,
+ 'cflags' => \$opt_cflags
+ );
+
+if (not $result) {
+ exit(1);
+}
+
+if ($opt_help) {
+ print "pkg-config replacement in perl\n";
+ print "Copyright (C) 2006 Jelmer Vernooij <jelmer\@samba.org>\n";
+ print "\n";
+ print "Usage: pkg-config [OPTIONS] PACKAGE...\n";
+ print " --help Print this help message\n";
+ print " --static Print flags for static libraries\n";
+ print " --libs Print linker flags\n";
+ print " --cflags Print C compiler flags\n";
+ print "\n";
+ exit(0);
+}
+
+sub find_path($)
+{
+ my $name = shift;
+ foreach my $dir (@dirs) {
+ if (-f "$dir/$name-uninstalled.pc") {
+ return "$dir/$name-uninstalled.pc";
+ }
+ }
+ foreach my $dir (@dirs) {
+ if (-f "$dir/$name.pc" ) {
+ return "$dir/$name.pc";
+ }
+ }
+ die("No such package `$name'");
+}
+
+sub ReplaceVars($$)
+{
+ my ($expr, $vars) = @_;
+
+ $_ = $expr;
+
+ while (/(.*)\${([^}]+)}(.*)/) {
+ $_ = "$1$vars->{$2}$3";
+ }
+
+ return $_;
+}
+
+sub Parse($)
+{
+ my $name = shift;
+ my $path = find_path($name);
+ my %variables = ();
+ my %fields = ();
+ my $lineno = 0;
+ open(IN, "<$path") or die("Unable to open $path: $!");
+ foreach (<IN>) {
+ $lineno+=1;
+ next if (/^#.*/);
+ if (/^([A-Za-z.]+): (.*)$/) {
+ $fields{$1} = ReplaceVars($2, \%variables);
+ } elsif (/^([A-Za-z_]+)=(.*)$/) {
+ $variables{$1} = ReplaceVars($2, \%variables);
+ } elsif (/^[ \t]*$/) {
+ } else {
+ warn("$path:$lineno: parse error");
+ }
+ }
+ close(IN);
+ return \%fields;
+}
+
+sub Cflags($)
+{
+ my $name = shift;
+ my $fields = Parse($name);
+ my @cflags = split(/ /, $fields->{Cflags});
+ foreach (split(/[, ]/, $fields->{Requires})) {
+ push (@cflags, Cflags($_));
+ }
+ return @cflags;
+}
+
+sub Libs($)
+{
+ my $name = shift;
+ my $fields = Parse($name);
+ my @libs = split(/ /, $fields->{Libs});
+ foreach (split(/[, ]/, $fields->{Requires})) {
+ push (@libs, Libs($_));
+ }
+ if ($opt_static) {
+ foreach (split(/[ ,]/, $fields->{"Requires.private"})) {
+ push (@libs, Libs($_));
+ }
+ }
+ return @libs;
+}
+
+my @out = ();
+
+foreach my $pkg (@ARGV)
+{
+ push (@out, Libs($pkg)) if ($opt_libs);
+ push (@out, Cflags($pkg)) if ($opt_cflags);
+}
+
+sub nub
+{
+ my @list = @_;
+ my @ret = ();
+ my %seen = ();
+ foreach (@list) {
+ next if (defined($seen{$_}));
+ push (@ret, $_);
+ $seen{$_} = 1;
+ }
+ return @ret;
+}
+
+if ($#out >= 0) {
+ @out = nub(@out);
+ print join(' ', @out) . "\n";
+}
+
+exit 0;
diff --git a/source4/script/revert.sh b/source4/script/revert.sh
new file mode 100755
index 0000000000..8df5fd2fbd
--- /dev/null
+++ b/source4/script/revert.sh
@@ -0,0 +1,18 @@
+#!/bin/sh
+BINDIR=$1
+shift
+
+for p in $*; do
+ p2=`basename $p`
+ if [ -f $BINDIR/$p2.old ]; then
+ echo Restoring $BINDIR/$p2.old
+ mv $BINDIR/$p2 $BINDIR/$p2.new
+ mv $BINDIR/$p2.old $BINDIR/$p2
+ rm -f $BINDIR/$p2.new
+ else
+ echo Not restoring $p
+ fi
+done
+
+exit 0
+
diff --git a/source4/script/uninstalllib.sh b/source4/script/uninstalllib.sh
new file mode 100755
index 0000000000..9c45b2c941
--- /dev/null
+++ b/source4/script/uninstalllib.sh
@@ -0,0 +1,35 @@
+#!/bin/sh
+# based on uninstallbin.sh
+# 4 July 96 Dan.Shearer@UniSA.edu.au
+
+LIBDIR=$1
+shift
+
+if [ ! -d $LIBDIR ]; then
+ echo Directory $LIBDIR does not exist!
+ echo Do a "make installbin" or "make install" first.
+ exit 1
+fi
+
+for p in $*; do
+ p2=`basename $p`
+ if [ -f $LIBDIR/$p2 ]; then
+ echo Removing $LIBDIR/$p2
+ rm -f $LIBDIR/$p2
+ if [ -f $LIBDIR/$p2 ]; then
+ echo Cannot remove $LIBDIR/$p2 ... does $USER have privileges?
+ fi
+ fi
+done
+
+
+cat << EOF
+======================================================================
+The shared libraries have been uninstalled. You may restore the libraries using
+the command "make installlib" or "make install" to install binaries,
+man pages, modules and shell scripts. You can restore a previous
+version of the libraries (if there were any) using "make revert".
+======================================================================
+EOF
+
+exit 0
diff --git a/source4/script/uninstallman.sh b/source4/script/uninstallman.sh
new file mode 100755
index 0000000000..edc1c47e4d
--- /dev/null
+++ b/source4/script/uninstallman.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+# 4 July 96 Dan.Shearer@UniSA.edu.au
+# Updated for Samba4 by Jelmer Vernooij
+
+MANDIR=$1
+shift 1
+MANPAGES=$*
+
+for I in $MANPAGES
+do
+ SECTION=`echo -n $I | sed "s/.*\(.\)$/\1/"`
+ FNAME=$MANDIR/man$SECTION/$I
+ if test -f $FNAME; then
+ echo Deleting $FNAME
+ rm -f $FNAME
+ test -f $FNAME && echo Cannot remove $FNAME... does $USER have privileges?
+ fi
+done
+
+cat << EOF
+======================================================================
+The man pages have been uninstalled. You may install them again using
+the command "make installman" or make "install" to install binaries,
+man pages and shell scripts.
+======================================================================
+EOF
+exit 0