summaryrefslogtreecommitdiff
path: root/source4/lib/replace
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2005-09-24 14:58:18 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:38:51 -0500
commit70b52b02a77c695d32aa57daaeb5689cd6857eba (patch)
tree4f7bb8f3f645e64b8983e7fd3f439d5c629c975f /source4/lib/replace
parent2a9b65cd17b271ff88fca6bda0bddc6230c2b319 (diff)
downloadsamba-70b52b02a77c695d32aa57daaeb5689cd6857eba.tar.gz
samba-70b52b02a77c695d32aa57daaeb5689cd6857eba.tar.bz2
samba-70b52b02a77c695d32aa57daaeb5689cd6857eba.zip
r10476: Move some more types to libreplace. Fix missing strndup errors
for heimdal (This used to be commit e09ffdfb1dba289b79ac7e5a638bf5322d45ddc0)
Diffstat (limited to 'source4/lib/replace')
-rw-r--r--source4/lib/replace/README4
-rw-r--r--source4/lib/replace/SConscript25
-rw-r--r--source4/lib/replace/config.m417
-rw-r--r--source4/lib/replace/replace.h12
4 files changed, 43 insertions, 15 deletions
diff --git a/source4/lib/replace/README b/source4/lib/replace/README
index eb3360b74a..45c8bccf13 100644
--- a/source4/lib/replace/README
+++ b/source4/lib/replace/README
@@ -51,6 +51,10 @@ pwrite
Types:
socklen_t
+u_int{8,16,32}_t
+uint_t
+uint{8,16,32,64}_t
+int{8,16,32,64}_t
Prerequisites:
memset (for bzero)
diff --git a/source4/lib/replace/SConscript b/source4/lib/replace/SConscript
index a2b3a30e10..60652b0b15 100644
--- a/source4/lib/replace/SConscript
+++ b/source4/lib/replace/SConscript
@@ -4,7 +4,7 @@ Import('hostenv defines')
if hostenv['configure']:
conf = Configure(hostenv)
for f in ['memset','syslog','setnetgrent','getnetgrent','endnetgrent', \
- 'mktemp']:
+ 'mktemp', 'memcpy']:
if not conf.CheckFunc(f,'c'):
print "Required function `%s' not found" % f
exit(1)
@@ -26,6 +26,29 @@ if hostenv['configure']:
if not conf.CheckType('socklen_t'):
defines['socklen_t'] = 'int'
+ needed_types = {
+ 'uint_t': 'unsigned int',
+ 'int8_t': 'signed char',
+ 'uint8_t': 'unsigned char',
+ 'u_int8_t': 'unsigned char',
+ 'int16_t': 'short',
+ 'uint16_t': 'unsigned short',
+ 'u_int16_t': 'unsigned short',
+ 'int32_t': 'long',
+ 'uint32_t': 'unsigned long',
+ 'u_int32_t': 'unsigned long',
+ 'int64_t': 'long long',
+ 'uint64_t': 'unsigned long long',
+ }
+
+ type_headers = """
+#include <stdint.h>
+#include <sys/types.h>
+"""
+ for t in needed_types:
+ if not conf.CheckType(t,type_headers):
+ defines[t] = needed_types[t]
+
conf.Finish()
hostenv.StaticLibrary('repdir', ['repdir/repdir.c'])
diff --git a/source4/lib/replace/config.m4 b/source4/lib/replace/config.m4
index 26a2cae56d..2b8d4ca3d1 100644
--- a/source4/lib/replace/config.m4
+++ b/source4/lib/replace/config.m4
@@ -1,3 +1,16 @@
+AC_CHECK_TYPE(uint_t, unsigned int)
+AC_CHECK_TYPE(int8_t, signed char)
+AC_CHECK_TYPE(uint8_t, unsigned char)
+AC_CHECK_TYPE(int16_t, short)
+AC_CHECK_TYPE(uint16_t, unsigned short)
+AC_CHECK_TYPE(int32_t, long)
+AC_CHECK_TYPE(uint32_t, unsigned long)
+AC_CHECK_TYPE(int64_t, long long)
+AC_CHECK_TYPE(uint64_t, unsigned long long)
+AC_CHECK_TYPE(u_int32_t, unsigned long)
+AC_CHECK_TYPE(u_int16_t, unsigned short)
+AC_CHECK_TYPE(u_int8_t, unsigned char)
+
AC_CACHE_CHECK([for broken inet_ntoa],samba_cv_REPLACE_INET_NTOA,[
AC_TRY_RUN([
#include <stdio.h>
@@ -99,5 +112,5 @@ AC_CHECK_HEADERS(dlfcn.h)
AC_CHECK_FUNCS(dlopen dlsym dlerror dlclose)
LIBS="$SAVE_LIBS"
-AC_CHECK_FUNCS([syslog memset setnetgrent getnetgrent endnetgrent],,
- [AC_MSG_ERROR([Need syslog and memset])])
+AC_CHECK_FUNCS([syslog memset setnetgrent getnetgrent endnetgrent memcpy],,
+ [AC_MSG_ERROR([Required function not found])])
diff --git a/source4/lib/replace/replace.h b/source4/lib/replace/replace.h
index 28a6392eb3..3ad348517d 100644
--- a/source4/lib/replace/replace.h
+++ b/source4/lib/replace/replace.h
@@ -132,18 +132,6 @@ int asprintf(char **,const char *, ...) PRINTF_ATTRIBUTE(2,3);
typedef int (*comparison_fn_t)(const void *, const void *);
#endif
-#ifndef HAVE_U_INT32_T
-typedef unsigned u_int32_t;
-#endif
-
-#ifndef HAVE_U_INT16_T
-typedef unsigned short u_int16_t;
-#endif
-
-#ifndef HAVE_U_INT8_T
-typedef unsigned char u_int8_t;
-#endif
-
#ifdef HAVE_DLFCN_H
#include <dlfcn.h>
#endif