r18129: moved the system includes into libreplace - this gives much more
authorAndrew Tridgell <tridge@samba.org>
Wed, 6 Sep 2006 04:44:32 +0000 (04:44 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 19:17:36 +0000 (14:17 -0500)
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)

35 files changed:
source/configure.ac
source/lib/ldb/include/includes.h
source/lib/replace/libreplace.m4
source/lib/replace/replace.c
source/lib/replace/replace.h
source/lib/replace/system/README [moved from source/include/system/README with 100% similarity]
source/lib/replace/system/capability.h [moved from source/include/system/capability.h with 94% similarity]
source/lib/replace/system/config.m4 [moved from source/include/system/config.m4 with 100% similarity]
source/lib/replace/system/dir.h [moved from source/include/system/dir.h with 97% similarity]
source/lib/replace/system/filesys.h [moved from source/include/system/filesys.h with 98% similarity]
source/lib/replace/system/glob.h [moved from source/include/system/glob.h with 94% similarity]
source/lib/replace/system/iconv.h [moved from source/include/system/iconv.h with 95% similarity]
source/lib/replace/system/kerberos.h [moved from source/include/system/kerberos.h with 99% similarity]
source/lib/replace/system/locale.h [moved from source/include/system/locale.h with 93% similarity]
source/lib/replace/system/network.h [moved from source/include/system/network.h with 97% similarity]
source/lib/replace/system/passwd.h [moved from source/include/system/passwd.h with 97% similarity]
source/lib/replace/system/printing.h [moved from source/include/system/printing.h with 94% similarity]
source/lib/replace/system/readline.h [moved from source/include/system/readline.h with 95% similarity]
source/lib/replace/system/select.h [moved from source/include/system/select.h with 94% similarity]
source/lib/replace/system/shmem.h [moved from source/include/system/shmem.h with 95% similarity]
source/lib/replace/system/syslog.h [moved from source/include/system/syslog.h with 96% similarity]
source/lib/replace/system/terminal.h [moved from source/include/system/terminal.h with 95% similarity]
source/lib/replace/system/time.h [moved from source/include/system/time.h with 95% similarity]
source/lib/replace/system/wait.h [moved from source/include/system/wait.h with 94% similarity]
source/lib/replace/test/testsuite.c
source/lib/talloc/talloc.c
source/lib/talloc/testsuite.c
source/lib/tdb/Makefile.in
source/lib/tdb/autogen.sh
source/lib/tdb/common/tdb_private.h
source/lib/tdb/configure.ac
source/lib/tdb/tools/tdbbackup.c
source/lib/tdb/tools/tdbdump.c
source/lib/tdb/tools/tdbtest.c
source/lib/tdb/tools/tdbtorture.c

index 795e6e0..67a56aa 100644 (file)
@@ -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)
index f761d35..800ffdf 100644 (file)
@@ -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"
index ce36ee3..1465756 100644 (file)
@@ -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)
index b9c106d..733cb75 100644 (file)
 
 #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) {}
index 566be22..38b4e08 100644 (file)
 #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"
 #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
similarity index 94%
rename from source/include/system/capability.h
rename to source/lib/replace/system/capability.h
index 5a5bc93..6ed8ae8 100644 (file)
@@ -1,3 +1,5 @@
+#ifndef _system_capability_h
+#define _system_capability_h
 /* 
    Unix SMB/CIFS implementation.
 
@@ -36,3 +38,4 @@
 
 #endif
 
+#endif
similarity index 97%
rename from source/include/system/dir.h
rename to source/lib/replace/system/dir.h
index 14b36c0..64e413c 100644 (file)
@@ -1,3 +1,5 @@
+#ifndef _system_dir_h
+#define _system_dir_h
 /* 
    Unix SMB/CIFS implementation.
 
@@ -59,3 +61,4 @@
                        )
 #endif
 
+#endif
similarity index 98%
rename from source/include/system/filesys.h
rename to source/lib/replace/system/filesys.h
index e81eec1..1e48f7a 100644 (file)
@@ -1,3 +1,5 @@
+#ifndef _system_filesys_h
+#define _system_filesys_h
 /* 
    Unix SMB/CIFS implementation.
 
 #define SEEK_SET 0
 #endif
 
+#endif
similarity index 94%
rename from source/include/system/glob.h
rename to source/lib/replace/system/glob.h
index 9de3168..0e51f39 100644 (file)
@@ -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
similarity index 95%
rename from source/include/system/iconv.h
rename to source/lib/replace/system/iconv.h
index d5cbe84..75ee1d8 100644 (file)
@@ -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
similarity index 99%
rename from source/include/system/kerberos.h
rename to source/lib/replace/system/kerberos.h
index 5037cbc..b24196f 100644 (file)
@@ -1,3 +1,6 @@
+#ifndef _system_kerberos_h
+#define _system_kerberos_h
+
 /* 
    Unix SMB/CIFS implementation.
 
 #include "heimdal/lib/gssapi/gssapi.h"
 #include "heimdal/lib/com_err/com_err.h"
 #endif
+
+#endif
similarity index 93%
rename from source/include/system/locale.h
rename to source/lib/replace/system/locale.h
index e4be4a1..82b179d 100644 (file)
@@ -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
similarity index 97%
rename from source/include/system/network.h
rename to source/lib/replace/system/network.h
index b2c3158..9b73466 100644 (file)
@@ -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
similarity index 97%
rename from source/include/system/passwd.h
rename to source/lib/replace/system/passwd.h
index 219ec30..6f8d729 100644 (file)
@@ -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
similarity index 94%
rename from source/include/system/printing.h
rename to source/lib/replace/system/printing.h
index 9eb93a7..489ccb1 100644 (file)
@@ -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
similarity index 95%
rename from source/include/system/readline.h
rename to source/lib/replace/system/readline.h
index c3e5653..4a64ef1 100644 (file)
@@ -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
similarity index 94%
rename from source/include/system/select.h
rename to source/lib/replace/system/select.h
index c059549..0d1eabb 100644 (file)
@@ -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
similarity index 95%
rename from source/include/system/shmem.h
rename to source/lib/replace/system/shmem.h
index e197cd1..9c04583 100644 (file)
@@ -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
similarity index 96%
rename from source/include/system/syslog.h
rename to source/lib/replace/system/syslog.h
index 7182e2e..e123830 100644 (file)
@@ -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
similarity index 95%
rename from source/include/system/terminal.h
rename to source/lib/replace/system/terminal.h
index b727f8e..94d6b5c 100644 (file)
@@ -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
similarity index 95%
rename from source/include/system/time.h
rename to source/lib/replace/system/time.h
index 7d27a56..e7c88f1 100644 (file)
@@ -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
-
similarity index 94%
rename from source/include/system/wait.h
rename to source/lib/replace/system/wait.h
index dc129ac..be8c203 100644 (file)
@@ -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
index af50edc..9dddc01 100644 (file)
    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"
 
index f92d76b..d2f7a5d 100644 (file)
 
 #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 */
 
index 766cf03..1fa2c7b 100644 (file)
 #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
index 1e5884a..64a6dc0 100644 (file)
@@ -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)
index d46a427..bf84eee 100755 (executable)
@@ -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
 
index e77b2f2..cef2ae8 100644 (file)
    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
index 0943bbe..09cc353 100644 (file)
@@ -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)
index 872ca99..45beb5e 100644 (file)
 
  */
 
-#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
index 74ba64f..9111b73 100644 (file)
    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;
index edf12ec..c7a0978 100644 (file)
@@ -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>
 
index 9b0a603..14a2b48 100644 (file)
@@ -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