lib/util: Use charset_compat.h if SAMBA_UTIL_CORE_ONLY
authorMartin Schwenke <martin@meltin.net>
Mon, 22 Sep 2014 10:26:24 +0000 (20:26 +1000)
committerJeremy Allison <jra@samba.org>
Fri, 3 Oct 2014 22:11:21 +0000 (00:11 +0200)
When doing a CTDB standalone build we don't want to use dynconfig,
since this introduces a lot of unwanted complexity.  To avoid this,
either:

* charset needs to be nobbled to avoid loading the case tables, since
  this depends on dynconfig; or

* charset needs to be avoid completely, so some functions need to be
  replaced with their ASCII counterparts.

The 2nd options seems more honest and less error-prone.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Jeremy Allison <jra@samba.org>
lib/util/charset_compat.h [new file with mode: 0644]
lib/util/samba_util.h
lib/util/substitute.c
lib/util/wscript_build

diff --git a/lib/util/charset_compat.h b/lib/util/charset_compat.h
new file mode 100644 (file)
index 0000000..cb3b625
--- /dev/null
@@ -0,0 +1,9 @@
+#ifndef _SAMBA_CHARSET_COMPAT_H_
+#define _SAMBA_CHARSET_COMPAT_H_
+
+#include <string.h>
+
+#define strchr_m(h, n) strchr(h, n)
+#define strstr_m(h, n) strstr(h, n)
+
+#endif /* _SAMBA_CHARSET_COMPAT_H_ */
index 2578af80f694d8ac327d61b052a83fdfc8a178a5..41b3fc8ecda8610b1bb1e412eb2c6c7ef99d1102 100644 (file)
 #ifndef _SAMBA_UTIL_H_
 #define _SAMBA_UTIL_H_
 
+#ifndef SAMBA_UTIL_CORE_ONLY
 #include "lib/util/charset/charset.h"
+#else
+#include "charset_compat.h"
+#endif
+
 #include "lib/util/attr.h"
 
 /* for TALLOC_CTX */
index 70cc441a3210d7b40fc6f0dd6ddeda43a7571345..49adeaf178a145e40bd9b6f247e74e7dafb2740d 100644 (file)
 
 #include "replace.h"
 #include "debug.h"
+#ifndef SAMBA_UTIL_CORE_ONLY
 #include "charset/charset.h"
+#else
+#include "charset_compat.h"
+#endif
 #include "substitute.h"
 
 /**
index d3865d8c033607b71960dcfbb202a4affc3cf9d2..cd23231f3cc23688507b89bbe463766f49fc5ad8 100755 (executable)
@@ -41,6 +41,8 @@ bld.SAMBA_SUBSYSTEM('samba-util-core',
 
 if not bld.env.SAMBA_UTIL_CORE_ONLY:
 
+    bld.env.public_headers_skip.append('charset_compat.h')
+
     bld.SAMBA_LIBRARY('samba-util',
                   source='''talloc_stack.c smb_threads.c
                     rbtree.c rfc1738.c become_daemon.c system.c select.c getpass.c