Skip to content

Commit e6f3f75

Browse files
tomkaragounisnwellnhof
authored andcommitted
Update configure.js to support relax ng options and look for version in new location
1 parent aa8c56b commit e6f3f75

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

win32/configure.js

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ var srcDirUtils = "..";
1414
var baseName = "libxml2";
1515
/* Configure file which contains the version and the output file where
1616
we can store our build configuration. */
17-
var configFile = srcDirXml + "\\configure.ac";
17+
var libxmlVersionFile = srcDirXml + "\\VERSION";
1818
var versionFile = ".\\config.msvc";
1919
/* Input and output files regarding the libxml features. */
2020
var optsFileIn = srcDirXml + "\\include\\libxml\\xmlversion.h.in";
@@ -45,6 +45,7 @@ var withDebug = true;
4545
var withSchemas = true;
4646
var withSchematron = true;
4747
var withRegExps = true;
48+
var withRelaxNg = true;
4849
var withModules = true;
4950
var withTree = true;
5051
var withReader = true;
@@ -124,6 +125,7 @@ function usage()
124125
txt += " lzma: Enable lzma support (" + (withLzma? "yes" : "no") + ")\n";
125126
txt += " xml_debug: Enable XML debbugging module (" + (withDebug? "yes" : "no") + ")\n";
126127
txt += " regexps: Enable regular expressions (" + (withRegExps? "yes" : "no") + ")\n";
128+
txt += " relaxng: Enable RELAX NG support (" + (withRelaxNg ? "yes" : "no") + ")\n";
127129
txt += " modules: Enable module support (" + (withModules? "yes" : "no") + ")\n";
128130
txt += " tree: Enable tree api (" + (withTree? "yes" : "no") + ")\n";
129131
txt += " reader: Enable xmlReader api (" + (withReader? "yes" : "no") + ")\n";
@@ -170,7 +172,7 @@ function discoverVersion()
170172
var fso, cf, vf, ln, s, iDot, iSlash;
171173
fso = new ActiveXObject("Scripting.FileSystemObject");
172174
verCvs = "";
173-
cf = fso.OpenTextFile(configFile, 1);
175+
cf = fso.OpenTextFile(libxmlVersionFile, 1);
174176
if (compiler == "msvc")
175177
versionFile = ".\\config.msvc";
176178
else if (compiler == "mingw")
@@ -184,19 +186,13 @@ function discoverVersion()
184186
while (cf.AtEndOfStream != true) {
185187
ln = cf.ReadLine();
186188
s = new String(ln);
187-
if (m = s.match(/^m4_define\(\[MAJOR_VERSION\], (\w+)\)/)) {
188-
vf.WriteLine("LIBXML_MAJOR_VERSION=" + m[1]);
189-
verMajor = m[1];
190-
} else if(m = s.match(/^m4_define\(\[MINOR_VERSION\], (\w+)\)/)) {
191-
vf.WriteLine("LIBXML_MINOR_VERSION=" + m[1]);
192-
verMinor = m[1];
193-
} else if(m = s.match(/^m4_define\(\[MICRO_VERSION\], (\w+)\)/)) {
194-
vf.WriteLine("LIBXML_MICRO_VERSION=" + m[1]);
195-
verMicro = m[1];
196-
} else if(s.search(/^LIBXML_MICRO_VERSION_SUFFIX=/) != -1) {
197-
vf.WriteLine(s);
198-
verMicroSuffix = s.substring(s.indexOf("=") + 1, s.length);
199-
}
189+
versionSplit = s.split(".");
190+
verMajor = versionSplit[0];
191+
vf.WriteLine("LIBXML_MAJOR_VERSION=" + verMajor);
192+
verMinor = versionSplit[1];
193+
vf.WriteLine("LIBXML_MINOR_VERSION=" + verMinor);
194+
verMicro = versionSplit[2];
195+
vf.WriteLine("LIBXML_MICRO_VERSION=" + verMicro);
200196
}
201197
cf.Close();
202198
vf.WriteLine("XML_SRCDIR=" + srcDirXml);
@@ -218,6 +214,7 @@ function discoverVersion()
218214
vf.WriteLine("WITH_SCHEMAS=" + (withSchemas? "1" : "0"));
219215
vf.WriteLine("WITH_SCHEMATRON=" + (withSchematron? "1" : "0"));
220216
vf.WriteLine("WITH_REGEXPS=" + (withRegExps? "1" : "0"));
217+
vf.WriteLine("WITH_RELAXNG=" + (withRelaxNg ? "1" : "0"));
221218
vf.WriteLine("WITH_MODULES=" + (withModules? "1" : "0"));
222219
vf.WriteLine("WITH_TREE=" + (withTree? "1" : "0"));
223220
vf.WriteLine("WITH_READER=" + (withReader? "1" : "0"));
@@ -320,6 +317,8 @@ function configureLibxml()
320317
of.WriteLine(s.replace(/\@WITH_SCHEMATRON\@/, withSchematron? "1" : "0"));
321318
} else if (s.search(/\@WITH_REGEXPS\@/) != -1) {
322319
of.WriteLine(s.replace(/\@WITH_REGEXPS\@/, withRegExps? "1" : "0"));
320+
} else if (s.search(/\@WITH_RELAXNG\@/) != -1) {
321+
of.WriteLine(s.replace(/\@WITH_RELAXNG\@/, withRelaxNg? "1" : "0"));
323322
} else if (s.search(/\@WITH_MODULES\@/) != -1) {
324323
of.WriteLine(s.replace(/\@WITH_MODULES\@/, withModules? "1" : "0"));
325324
} else if (s.search(/\@MODULE_EXTENSION\@/) != -1) {
@@ -465,6 +464,8 @@ for (i = 0; (i < WScript.Arguments.length) && (error == 0); i++) {
465464
withSchematron = strToBool(arg.substring(opt.length + 1, arg.length));
466465
else if (opt == "regexps")
467466
withRegExps = strToBool(arg.substring(opt.length + 1, arg.length));
467+
else if (opt == "relaxng")
468+
withRelaxNg = strToBool(arg.substring(opt.length + 1, arg.length));
468469
else if (opt == "modules")
469470
withModules = strToBool(arg.substring(opt.length + 1, arg.length));
470471
else if (opt == "tree")
@@ -634,6 +635,7 @@ txtOut += " zlib support: " + boolToStr(withZlib) + "\n";
634635
txtOut += " lzma support: " + boolToStr(withLzma) + "\n";
635636
txtOut += " Debugging module: " + boolToStr(withDebug) + "\n";
636637
txtOut += " Regexp support: " + boolToStr(withRegExps) + "\n";
638+
txtOut += " Relax NG support: " + boolToStr(withRelaxNg) + "\n";
637639
txtOut += " Module support: " + boolToStr(withModules) + "\n";
638640
txtOut += " Tree support: " + boolToStr(withTree) + "\n";
639641
txtOut += " Reader support: " + boolToStr(withReader) + "\n";

0 commit comments

Comments
 (0)