summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2006-09-06 04:44:32 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:17:36 -0500
commita983b06d37c3b87a02444d9a9862777b88629344 (patch)
tree531e396a45b073f476fd091e068c2d6f175a618b
parent3e11f4c06131542565149496d659f0050411a68f (diff)
downloadsamba-a983b06d37c3b87a02444d9a9862777b88629344.tar.gz
samba-a983b06d37c3b87a02444d9a9862777b88629344.tar.bz2
samba-a983b06d37c3b87a02444d9a9862777b88629344.zip
r18129: moved the system includes into libreplace - this gives much more
isolation of our portability environment from the main code, and also simplifies the includes system (no separate #ifdef _SAMBA_BUILD for tdb. ldb etc now) (This used to be commit 77d1a468e06290aba789e2f3affc769fc5159a21)
-rw-r--r--source4/configure.ac1
-rw-r--r--source4/lib/ldb/include/includes.h33
-rw-r--r--source4/lib/replace/libreplace.m41
-rw-r--r--source4/lib/replace/replace.c18
-rw-r--r--source4/lib/replace/replace.h16
-rw-r--r--source4/lib/replace/system/README (renamed from source4/include/system/README)0
-rw-r--r--source4/lib/replace/system/capability.h (renamed from source4/include/system/capability.h)3
-rw-r--r--source4/lib/replace/system/config.m4 (renamed from source4/include/system/config.m4)0
-rw-r--r--source4/lib/replace/system/dir.h (renamed from source4/include/system/dir.h)3
-rw-r--r--source4/lib/replace/system/filesys.h (renamed from source4/include/system/filesys.h)3
-rw-r--r--source4/lib/replace/system/glob.h (renamed from source4/include/system/glob.h)4
-rw-r--r--source4/lib/replace/system/iconv.h (renamed from source4/include/system/iconv.h)3
-rw-r--r--source4/lib/replace/system/kerberos.h (renamed from source4/include/system/kerberos.h)5
-rw-r--r--source4/lib/replace/system/locale.h (renamed from source4/include/system/locale.h)5
-rw-r--r--source4/lib/replace/system/network.h (renamed from source4/include/system/network.h)3
-rw-r--r--source4/lib/replace/system/passwd.h (renamed from source4/include/system/passwd.h)4
-rw-r--r--source4/lib/replace/system/printing.h (renamed from source4/include/system/printing.h)4
-rw-r--r--source4/lib/replace/system/readline.h (renamed from source4/include/system/readline.h)4
-rw-r--r--source4/lib/replace/system/select.h (renamed from source4/include/system/select.h)4
-rw-r--r--source4/lib/replace/system/shmem.h (renamed from source4/include/system/shmem.h)3
-rw-r--r--source4/lib/replace/system/syslog.h (renamed from source4/include/system/syslog.h)3
-rw-r--r--source4/lib/replace/system/terminal.h (renamed from source4/include/system/terminal.h)3
-rw-r--r--source4/lib/replace/system/time.h (renamed from source4/include/system/time.h)5
-rw-r--r--source4/lib/replace/system/wait.h (renamed from source4/include/system/wait.h)3
-rw-r--r--source4/lib/replace/test/testsuite.c45
-rw-r--r--source4/lib/talloc/talloc.c17
-rw-r--r--source4/lib/talloc/testsuite.c14
-rw-r--r--source4/lib/tdb/Makefile.in8
-rwxr-xr-xsource4/lib/tdb/autogen.sh5
-rw-r--r--source4/lib/tdb/common/tdb_private.h35
-rw-r--r--source4/lib/tdb/configure.ac1
-rw-r--r--source4/lib/tdb/tools/tdbbackup.c28
-rw-r--r--source4/lib/tdb/tools/tdbdump.c22
-rw-r--r--source4/lib/tdb/tools/tdbtest.c19
-rw-r--r--source4/lib/tdb/tools/tdbtorture.c23
35 files changed, 121 insertions, 227 deletions
diff --git a/source4/configure.ac b/source4/configure.ac
index 795e6e0451..67a56aacd7 100644
--- a/source4/configure.ac
+++ b/source4/configure.ac
@@ -16,7 +16,6 @@ SMB_EXT_LIB(DL, $LIBDL)
m4_include(lib/replace/win32/config.m4)
m4_include(lib/replace/repdir/config.m4)
m4_include(lib/smbreadline/readline.m4)
-m4_include(include/system/config.m4)
m4_include(build/m4/rewrite.m4)
m4_include(heimdal_build/config.m4)
m4_include(lib/util/fault.m4)
diff --git a/source4/lib/ldb/include/includes.h b/source4/lib/ldb/include/includes.h
index f761d358c9..800ffdf568 100644
--- a/source4/lib/ldb/include/includes.h
+++ b/source4/lib/ldb/include/includes.h
@@ -9,39 +9,14 @@
#define HAVE_ILDAP 1
#endif
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
-#include "replace.h"
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <ctype.h>
-#include <fcntl.h>
-#include <stdarg.h>
-#include <signal.h>
-#include <unistd.h>
-#include <fnmatch.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <time.h>
-#ifdef HAVE_STDINT_H
-#include <stdint.h>
-#endif
-#ifdef HAVE_INTTYPES_H
-#include <inttypes.h>
-#endif
-#ifdef HAVE_DLFCN_H
-#include <dlfcn.h>
-#endif
-
#define discard_const(ptr) ((void *)((intptr_t)(ptr)))
#define discard_const_p(type, ptr) ((type *)discard_const(ptr))
+#include "replace.h"
+#include "system/filesys.h"
+#include "system/network.h"
+#include "system/time.h"
#include "talloc.h"
-
#include "ldb.h"
#include "ldb_errors.h"
#include "ldb_private.h"
diff --git a/source4/lib/replace/libreplace.m4 b/source4/lib/replace/libreplace.m4
index ce36ee39b4..1465756261 100644
--- a/source4/lib/replace/libreplace.m4
+++ b/source4/lib/replace/libreplace.m4
@@ -168,6 +168,7 @@ AC_CHECK_FUNCS([syslog memset setnetgrent getnetgrent endnetgrent memcpy],,
m4_include(getpass.m4)
m4_include(cc_features.m4)
+m4_include(system/config.m4)
LIBREPLACE_C99_STRUCT_INIT(c99_struct_initialization=yes,
c99_struct_initialization=no)
diff --git a/source4/lib/replace/replace.c b/source4/lib/replace/replace.c
index b9c106d582..733cb758bd 100644
--- a/source4/lib/replace/replace.c
+++ b/source4/lib/replace/replace.c
@@ -24,20 +24,10 @@
#include "replace.h"
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <fcntl.h>
-
-#if HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-
-#if HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#endif
+#include "system/filesys.h"
+#include "system/time.h"
+#include "system/passwd.h"
+#include "system/syslog.h"
void replace_dummy(void);
void replace_dummy(void) {}
diff --git a/source4/lib/replace/replace.h b/source4/lib/replace/replace.h
index 566be225be..38b4e08704 100644
--- a/source4/lib/replace/replace.h
+++ b/source4/lib/replace/replace.h
@@ -29,8 +29,11 @@
#define _replace_h
#include "config.h"
+
+#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
+#include <errno.h>
#if defined(_MSC_VER) || defined(__MINGW32__)
#include "lib/replace/win32/replace.h"
@@ -50,6 +53,15 @@
#include <inttypes.h>
#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#endif
+
+
#ifndef HAVE_STRERROR
extern char *sys_errlist[];
#define strerror(i) sys_errlist[i]
@@ -70,7 +82,7 @@ void *rep_memmove(void *dest,const void *src,int size);
#endif
#if !defined(HAVE_MKTIME) || !defined(HAVE_TIMEGM)
-#include <sys/time.h>
+#include "system/time.h"
#endif
#ifndef HAVE_MKTIME
@@ -286,6 +298,4 @@ typedef int bool;
#define __STRING(x) #x
#endif
-
-
#endif
diff --git a/source4/include/system/README b/source4/lib/replace/system/README
index 69a2b80b56..69a2b80b56 100644
--- a/source4/include/system/README
+++ b/source4/lib/replace/system/README
diff --git a/source4/include/system/capability.h b/source4/lib/replace/system/capability.h
index 5a5bc93aa3..6ed8ae8de0 100644
--- a/source4/include/system/capability.h
+++ b/source4/lib/replace/system/capability.h
@@ -1,3 +1,5 @@
+#ifndef _system_capability_h
+#define _system_capability_h
/*
Unix SMB/CIFS implementation.
@@ -36,3 +38,4 @@
#endif
+#endif
diff --git a/source4/include/system/config.m4 b/source4/lib/replace/system/config.m4
index 4d66317a5e..4d66317a5e 100644
--- a/source4/include/system/config.m4
+++ b/source4/lib/replace/system/config.m4
diff --git a/source4/include/system/dir.h b/source4/lib/replace/system/dir.h
index 14b36c0da0..64e413c907 100644
--- a/source4/include/system/dir.h
+++ b/source4/lib/replace/system/dir.h
@@ -1,3 +1,5 @@
+#ifndef _system_dir_h
+#define _system_dir_h
/*
Unix SMB/CIFS implementation.
@@ -59,3 +61,4 @@
)
#endif
+#endif
diff --git a/source4/include/system/filesys.h b/source4/lib/replace/system/filesys.h
index e81eec13e9..1e48f7ab40 100644
--- a/source4/include/system/filesys.h
+++ b/source4/lib/replace/system/filesys.h
@@ -1,3 +1,5 @@
+#ifndef _system_filesys_h
+#define _system_filesys_h
/*
Unix SMB/CIFS implementation.
@@ -165,3 +167,4 @@
#define SEEK_SET 0
#endif
+#endif
diff --git a/source4/include/system/glob.h b/source4/lib/replace/system/glob.h
index 9de3168032..0e51f397c6 100644
--- a/source4/include/system/glob.h
+++ b/source4/lib/replace/system/glob.h
@@ -1,3 +1,5 @@
+#ifndef _system_glob_h
+#define _system_glob_h
/*
Unix SMB/CIFS implementation.
@@ -27,3 +29,5 @@
#ifdef HAVE_FNMATCH_H
#include <fnmatch.h>
#endif
+
+#endif
diff --git a/source4/include/system/iconv.h b/source4/lib/replace/system/iconv.h
index d5cbe84d8f..75ee1d83ba 100644
--- a/source4/include/system/iconv.h
+++ b/source4/lib/replace/system/iconv.h
@@ -1,3 +1,5 @@
+#ifndef _system_iconv_h
+#define _system_iconv_h
/*
Unix SMB/CIFS implementation.
@@ -35,3 +37,4 @@
#define EILSEQ EIO
#endif
+#endif
diff --git a/source4/include/system/kerberos.h b/source4/lib/replace/system/kerberos.h
index 5037cbc542..b24196fc25 100644
--- a/source4/include/system/kerberos.h
+++ b/source4/lib/replace/system/kerberos.h
@@ -1,3 +1,6 @@
+#ifndef _system_kerberos_h
+#define _system_kerberos_h
+
/*
Unix SMB/CIFS implementation.
@@ -126,3 +129,5 @@
#include "heimdal/lib/gssapi/gssapi.h"
#include "heimdal/lib/com_err/com_err.h"
#endif
+
+#endif
diff --git a/source4/include/system/locale.h b/source4/lib/replace/system/locale.h
index e4be4a128b..82b179dc5b 100644
--- a/source4/include/system/locale.h
+++ b/source4/lib/replace/system/locale.h
@@ -1,3 +1,6 @@
+#ifndef _system_locale_h
+#define _system_locale_h
+
/*
Unix SMB/CIFS implementation.
@@ -27,3 +30,5 @@
#ifdef HAVE_LOCALE_H
#include <locale.h>
#endif
+
+#endif
diff --git a/source4/include/system/network.h b/source4/lib/replace/system/network.h
index b2c31583dc..9b73466924 100644
--- a/source4/include/system/network.h
+++ b/source4/lib/replace/system/network.h
@@ -1,3 +1,5 @@
+#ifndef _system_network_h
+#define _system_network_h
/*
Unix SMB/CIFS implementation.
@@ -98,3 +100,4 @@ char *rep_inet_ntoa(struct in_addr ip);
#define INADDR_NONE 0xffffffff
#endif
+#endif
diff --git a/source4/include/system/passwd.h b/source4/lib/replace/system/passwd.h
index 219ec306ae..6f8d729a7c 100644
--- a/source4/include/system/passwd.h
+++ b/source4/lib/replace/system/passwd.h
@@ -1,3 +1,6 @@
+#ifndef _system_passwd_h
+#define _system_passwd_h
+
/*
Unix SMB/CIFS implementation.
@@ -90,3 +93,4 @@
int initgroups(char *name,gid_t id);
#endif
+#endif
diff --git a/source4/include/system/printing.h b/source4/lib/replace/system/printing.h
index 9eb93a776e..489ccb1da8 100644
--- a/source4/include/system/printing.h
+++ b/source4/lib/replace/system/printing.h
@@ -1,3 +1,6 @@
+#ifndef _system_printing_h
+#define _system_printing_h
+
/*
Unix SMB/CIFS implementation.
@@ -40,3 +43,4 @@
#define PRINTCAP_NAME "/etc/printcap"
#endif
+#endif
diff --git a/source4/include/system/readline.h b/source4/lib/replace/system/readline.h
index c3e565399d..4a64ef1376 100644
--- a/source4/include/system/readline.h
+++ b/source4/lib/replace/system/readline.h
@@ -1,3 +1,5 @@
+#ifndef _system_readline_h
+#define _system_readline_h
/*
Unix SMB/CIFS implementation.
@@ -42,3 +44,5 @@
/* This type is missing from libreadline<4.0 (approximately) */
# define RL_COMPLETION_CAST
#endif /* HAVE_NEW_LIBREADLINE */
+
+#endif
diff --git a/source4/include/system/select.h b/source4/lib/replace/system/select.h
index c0595492cd..0d1eabbc35 100644
--- a/source4/include/system/select.h
+++ b/source4/lib/replace/system/select.h
@@ -1,3 +1,5 @@
+#ifndef _system_select_h
+#define _system_select_h
/*
Unix SMB/CIFS implementation.
@@ -36,3 +38,5 @@
#if WITH_EPOLL
#include <sys/epoll.h>
#endif
+
+#endif
diff --git a/source4/include/system/shmem.h b/source4/lib/replace/system/shmem.h
index e197cd146f..9c0458363a 100644
--- a/source4/include/system/shmem.h
+++ b/source4/lib/replace/system/shmem.h
@@ -1,3 +1,5 @@
+#ifndef _system_shmem_h
+#define _system_shmem_h
/*
Unix SMB/CIFS implementation.
@@ -46,3 +48,4 @@
#define MAP_FILE 0
#endif
+#endif
diff --git a/source4/include/system/syslog.h b/source4/lib/replace/system/syslog.h
index 7182e2e2d6..e123830a70 100644
--- a/source4/include/system/syslog.h
+++ b/source4/lib/replace/system/syslog.h
@@ -1,3 +1,5 @@
+#ifndef _system_syslog_h
+#define _system_syslog_h
/*
Unix SMB/CIFS implementation.
@@ -61,3 +63,4 @@
#define LOG_DEBUG 7 /* debug-level messages */
#endif
+#endif
diff --git a/source4/include/system/terminal.h b/source4/lib/replace/system/terminal.h
index b727f8e7fa..94d6b5cc98 100644
--- a/source4/include/system/terminal.h
+++ b/source4/lib/replace/system/terminal.h
@@ -1,3 +1,5 @@
+#ifndef _system_terminal_h
+#define _system_terminal_h
/*
Unix SMB/CIFS implementation.
@@ -37,3 +39,4 @@
#include <sys/termio.h>
#endif
+#endif
diff --git a/source4/include/system/time.h b/source4/lib/replace/system/time.h
index 7d27a56c9e..e7c88f133d 100644
--- a/source4/include/system/time.h
+++ b/source4/lib/replace/system/time.h
@@ -1,3 +1,5 @@
+#ifndef _system_time_h
+#define _system_time_h
/*
Unix SMB/CIFS implementation.
@@ -35,7 +37,4 @@
#include <utime.h>
#endif
-#ifndef HAVE_TIMEGM
-time_t timegm(struct tm *tm);
#endif
-
diff --git a/source4/include/system/wait.h b/source4/lib/replace/system/wait.h
index dc129ac108..be8c203f73 100644
--- a/source4/include/system/wait.h
+++ b/source4/lib/replace/system/wait.h
@@ -1,3 +1,5 @@
+#ifndef _system_wait_h
+#define _system_wait_h
/*
Unix SMB/CIFS implementation.
@@ -32,3 +34,4 @@
#define SIGNAL_CAST (RETSIGTYPE (*)(int))
#endif
+#endif
diff --git a/source4/lib/replace/test/testsuite.c b/source4/lib/replace/test/testsuite.c
index af50edc2a3..9dddc017be 100644
--- a/source4/lib/replace/test/testsuite.c
+++ b/source4/lib/replace/test/testsuite.c
@@ -24,31 +24,28 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "../replace.h"
-#include <stdio.h>
+#include "replace.h"
-#if HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-
-#if HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-#include <sys/stat.h>
-#endif
-
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#if HAVE_STRING_H
-#include <string.h>
-#endif
-
-#include <fcntl.h>
-#include <errno.h>
+/*
+ we include all the system/*.h include files here so that libreplace tests
+ them in the build farm
+*/
+#include "system/capability.h"
+#include "system/dir.h"
+#include "system/filesys.h"
+#include "system/glob.h"
+#include "system/iconv.h"
+#include "system/locale.h"
+#include "system/network.h"
+#include "system/passwd.h"
+#include "system/printing.h"
+#include "system/readline.h"
+#include "system/select.h"
+#include "system/shmem.h"
+#include "system/syslog.h"
+#include "system/terminal.h"
+#include "system/time.h"
+#include "system/wait.h"
#define TESTFILE "testfile.dat"
diff --git a/source4/lib/talloc/talloc.c b/source4/lib/talloc/talloc.c
index f92d76bb3d..d2f7a5d828 100644
--- a/source4/lib/talloc/talloc.c
+++ b/source4/lib/talloc/talloc.c
@@ -49,23 +49,6 @@
#ifndef _TALLOC_SAMBA3
#include "replace.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#ifdef HAVE_STDINT_H
-#include <stdint.h>
-#endif
-
-#if defined(HAVE_STDARG_H)
-#include <stdarg.h>
-#elif defined (HAVE_VARARGS_H)
-#include <varargs.h>
-#else
-#error "no var arg header"
-#endif
-
#include "talloc.h"
#endif /* not _TALLOC_SAMBA3 */
diff --git a/source4/lib/talloc/testsuite.c b/source4/lib/talloc/testsuite.c
index 766cf039c0..1fa2c7bfe4 100644
--- a/source4/lib/talloc/testsuite.c
+++ b/source4/lib/talloc/testsuite.c
@@ -28,18 +28,8 @@
#include "version.h"
#endif /* _SAMBA_BUILD_ */
-#include "config.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#ifdef HAVE_STDARG_H
-#include <stdarg.h>
-#endif
-
-#include <sys/time.h>
-#include <time.h>
-
+#include "replace.h"
+#include "system/time.h"
#include "talloc.h"
#ifndef False
diff --git a/source4/lib/tdb/Makefile.in b/source4/lib/tdb/Makefile.in
index 1e5884a968..64a6dc0891 100644
--- a/source4/lib/tdb/Makefile.in
+++ b/source4/lib/tdb/Makefile.in
@@ -9,13 +9,13 @@ exec_prefix = @exec_prefix@
bindir = @bindir@
includedir = @includedir@
libdir = @libdir@
-VPATH = @srcdir@
+VPATH = @srcdir@:@libreplacedir@
srcdir = @srcdir@
builddir = @builddir@
-CFLAGS = -I$(srcdir)/include -Iinclude @CFLAGS@
+CFLAGS = -I$(srcdir)/include -Iinclude -I@libreplacedir@ @CFLAGS@
PROGS = bin/tdbtool bin/tdbtorture
-TDB_OBJ = @TDBOBJ@
+TDB_OBJ = @TDBOBJ@ @LIBREPLACEOBJ@
DIRS = lib bin common tools examples
@@ -24,7 +24,7 @@ all: dirs $(PROGS)
.c.o:
@echo Compiling $*.c
@mkdir -p `dirname $@`
- $(CC) $(CFLAGS) -c $< -o $@
+ @$(CC) $(CFLAGS) -c $< -o $@
dirs:
@mkdir -p $(DIRS)
diff --git a/source4/lib/tdb/autogen.sh b/source4/lib/tdb/autogen.sh
index d46a4279f3..bf84eeee19 100755
--- a/source4/lib/tdb/autogen.sh
+++ b/source4/lib/tdb/autogen.sh
@@ -3,8 +3,9 @@
rm -rf autom4te.cache
rm -f configure config.h.in
-autoheader || exit 1
-autoconf || exit 1
+IPATHS="-I libreplace -I lib/replace -I ../libreplace -I ../replace"
+autoconf $IPATHS || exit 1
+autoheader $IPATHS || exit 1
rm -rf autom4te.cache
diff --git a/source4/lib/tdb/common/tdb_private.h b/source4/lib/tdb/common/tdb_private.h
index e77b2f2098..cef2ae8a91 100644
--- a/source4/lib/tdb/common/tdb_private.h
+++ b/source4/lib/tdb/common/tdb_private.h
@@ -24,35 +24,12 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifndef _SAMBA_BUILD_
-#include "config.h"
-#include <stdlib.h>
-#include <stdio.h>
-#ifdef HAVE_STDINT_H
-#include <stdint.h>
-#endif
-#include <fcntl.h>
-#include <unistd.h>
-#include <string.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <sys/mman.h>
-#include <sys/stat.h>
-#ifdef HAVE_SYS_SELECT_H
-#include <sys/select.h>
-#endif
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-#include "tdb.h"
-
-#else
-#include "includes.h"
-#include "lib/tdb/include/tdb.h"
+#include "replace.h"
+#include "system/filesys.h"
#include "system/time.h"
#include "system/shmem.h"
-#include "system/filesys.h"
-#endif
+#include "system/select.h"
+#include "tdb.h"
#ifndef u32
#define u32 unsigned
@@ -101,10 +78,6 @@ typedef u32 tdb_off_t;
#define ACTIVE_LOCK 4
#define TRANSACTION_LOCK 8
-#ifndef MAP_FILE
-#define MAP_FILE 0
-#endif
-
#ifndef MAP_FAILED
#define MAP_FAILED ((void *)-1)
#endif
diff --git a/source4/lib/tdb/configure.ac b/source4/lib/tdb/configure.ac
index 0943bbeeb8..09cc353e39 100644
--- a/source4/lib/tdb/configure.ac
+++ b/source4/lib/tdb/configure.ac
@@ -11,5 +11,6 @@ AC_CHECK_SIZEOF(off_t,cross)
AC_CHECK_SIZEOF(size_t,cross)
AC_CHECK_SIZEOF(ssize_t,cross)
AC_FUNC_MMAP
+m4_include(libreplace.m4)
m4_include(libtdb.m4)
AC_OUTPUT(Makefile tdb.pc)
diff --git a/source4/lib/tdb/tools/tdbbackup.c b/source4/lib/tdb/tools/tdbbackup.c
index 872ca99f0d..45beb5e292 100644
--- a/source4/lib/tdb/tools/tdbbackup.c
+++ b/source4/lib/tdb/tools/tdbbackup.c
@@ -41,33 +41,9 @@
*/
-#ifndef _SAMBA_BUILD_
-#if HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <errno.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <string.h>
-#include <fcntl.h>
-#include <time.h>
-#include <sys/mman.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <ctype.h>
-#include <signal.h>
-
-#else
-
-#include "includes.h"
-#include "system/filesys.h"
-
-#endif
-
+#include "replace.h"
#include "tdb.h"
+#include "system/filesys.h"
/*
see if one file is newer than another
diff --git a/source4/lib/tdb/tools/tdbdump.c b/source4/lib/tdb/tools/tdbdump.c
index 74ba64fdd9..9111b739ab 100644
--- a/source4/lib/tdb/tools/tdbdump.c
+++ b/source4/lib/tdb/tools/tdbdump.c
@@ -18,31 +18,11 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#ifndef _SAMBA_BUILD_
-#include <errno.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <string.h>
-#include <fcntl.h>
-#include <time.h>
-#include <sys/mman.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <ctype.h>
-#include <signal.h>
+#include "replace.h"
#include "tdb.h"
-
-#else
-
-#include "includes.h"
-#include "lib/tdb/include/tdb.h"
#include "system/locale.h"
#include "system/filesys.h"
-#endif
-
static void print_data(TDB_DATA d)
{
unsigned char *p = (unsigned char *)d.dptr;
diff --git a/source4/lib/tdb/tools/tdbtest.c b/source4/lib/tdb/tools/tdbtest.c
index edf12ecfdd..c7a09789fe 100644
--- a/source4/lib/tdb/tools/tdbtest.c
+++ b/source4/lib/tdb/tools/tdbtest.c
@@ -1,26 +1,9 @@
/* a test program for tdb - the trivial database */
-#ifndef _SAMBA_BUILD_
-#include <stdlib.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <string.h>
-#include <fcntl.h>
-#include <stdarg.h>
-#include <sys/mman.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <signal.h>
+#include "replace.h"
#include "tdb.h"
-#else
-
-#include "includes.h"
#include "system/filesys.h"
#include "system/time.h"
-#include "lib/tdb/include/tdb.h"
-
-#endif
#include <gdbm.h>
diff --git a/source4/lib/tdb/tools/tdbtorture.c b/source4/lib/tdb/tools/tdbtorture.c
index 9b0a60348c..14a2b48cdc 100644
--- a/source4/lib/tdb/tools/tdbtorture.c
+++ b/source4/lib/tdb/tools/tdbtorture.c
@@ -2,33 +2,12 @@
writers - that stresses the locking code.
*/
-#ifndef _SAMBA_BUILD_
-#define _GNU_SOURCE
-#include <stdlib.h>
-#include <time.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <string.h>
-#include <fcntl.h>
-#include <signal.h>
-#include <stdarg.h>
-#include <sys/mman.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <sys/wait.h>
+#include "replace.h"
#include "tdb.h"
-
-#else
-
-#include "includes.h"
-#include "lib/tdb/include/tdb.h"
#include "system/time.h"
#include "system/wait.h"
#include "system/filesys.h"
-#endif
-
#ifdef HAVE_GETOPT_H
#include <getopt.h>
#endif