From 1867a6033ca22da715017df005a5ad61c66e1597 Mon Sep 17 00:00:00 2001
From: Andrew Tridgell <tridge@samba.org>
Date: Mon, 7 Feb 2011 13:13:44 +1100
Subject: s4-charset: use dyn_CODEPAGEDIR for location of
 upcase.dat/lowcase.dat

this matches samba3 behaviour

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
---
 codepages/wscript_build       |  2 +-
 lib/util/charset/codepoints.c | 16 ++++------------
 source4/dynconfig/wscript     |  1 +
 source4/smbd/server.c         |  1 +
 4 files changed, 7 insertions(+), 13 deletions(-)

diff --git a/codepages/wscript_build b/codepages/wscript_build
index 695070fe0d0..12255296e46 100644
--- a/codepages/wscript_build
+++ b/codepages/wscript_build
@@ -1,3 +1,3 @@
 #!/usr/bin/env python
 
-bld.INSTALL_WILDCARD('${DATADIR}', '*.dat')
+bld.INSTALL_WILDCARD('${CODEPAGEDIR}', '*.dat')
diff --git a/lib/util/charset/codepoints.c b/lib/util/charset/codepoints.c
index 8be20512af4..bc39f1b1a47 100644
--- a/lib/util/charset/codepoints.c
+++ b/lib/util/charset/codepoints.c
@@ -44,22 +44,14 @@ void load_case_tables(void)
 	if (!mem_ctx) {
 		smb_panic("No memory for case_tables");
 	}
-	upcase_table = map_file(talloc_asprintf(mem_ctx, "%s/upcase.dat", dyn_DATADIR), 0x20000);
-	lowcase_table = map_file(talloc_asprintf(mem_ctx, "%s/lowcase.dat", dyn_DATADIR), 0x20000);
+	upcase_table = map_file(talloc_asprintf(mem_ctx, "%s/upcase.dat", dyn_CODEPAGEDIR), 0x20000);
+	lowcase_table = map_file(talloc_asprintf(mem_ctx, "%s/lowcase.dat", dyn_CODEPAGEDIR), 0x20000);
 	talloc_free(mem_ctx);
 	if (upcase_table == NULL) {
-		/* try also under codepages for testing purposes */
-		upcase_table = map_file("../codepages/upcase.dat", 0x20000);
-		if (upcase_table == NULL) {
-			upcase_table = (void *)-1;
-		}
+		upcase_table = (void *)-1;
 	}
 	if (lowcase_table == NULL) {
-		/* try also under codepages for testing purposes */
-		lowcase_table = map_file("../codepages/lowcase.dat", 0x20000);
-		if (lowcase_table == NULL) {
-			lowcase_table = (void *)-1;
-		}
+		lowcase_table = (void *)-1;
 	}
 }
 
diff --git a/source4/dynconfig/wscript b/source4/dynconfig/wscript
index 08621d40f14..6cebf7ee7fd 100644
--- a/source4/dynconfig/wscript
+++ b/source4/dynconfig/wscript
@@ -126,6 +126,7 @@ def dynconfig_cflags(bld, list=None):
     override = { 'MODULESDIR'    : 'bin/modules',
                  'PYTHONDIR'     : 'bin/python',
                  'PYTHONARCHDIR' : 'bin/python',
+                 'CODEPAGEDIR'   : os.path.join(bld.env.srcdir, 'codepages'),
                  'SCRIPTSBINDIR' : os.path.join(bld.env.srcdir, 'source4/scripting/bin'),
                  'SETUPDIR'      : os.path.join(bld.env.srcdir, 'source4/setup') }
     for f in dyn_cflags.keys():
diff --git a/source4/smbd/server.c b/source4/smbd/server.c
index 0a4e38d398a..0f2f1bb1bb7 100644
--- a/source4/smbd/server.c
+++ b/source4/smbd/server.c
@@ -260,6 +260,7 @@ static void show_build(void)
 		CONFIG_OPTION(PIDDIR),
 		CONFIG_OPTION(PRIVATE_DIR),
 		CONFIG_OPTION(SWATDIR),
+		CONFIG_OPTION(CODEPAGEDIR),
 		CONFIG_OPTION(SETUPDIR),
 		CONFIG_OPTION(WINBINDD_SOCKET_DIR),
 		CONFIG_OPTION(WINBINDD_PRIVILEGED_SOCKET_DIR),
-- 
cgit