blob: 1f81c01767bd337f69d74714d775997bb997225f [file] [log] [blame]
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +00001/* Configure script for libxml, specific for Windows with Scripting Host.
2 *
3 * This script will configure the libxml build process and create necessary files.
4 * Run it with an 'help', or an invalid option and it will tell you what options
5 * it accepts.
6 *
Daniel Veillardbeb70bd2002-12-18 14:53:54 +00007 * March 2002, Igor Zlatkovic <igor@zlatkovic.com>
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +00008 */
9
10/* The source directory, relative to the one where this file resides. */
11var srcDirXml = "..";
12var srcDirUtils = "..";
13/* The directory where we put the binaries after compilation. */
14var binDir = "binaries";
15/* Base name of what we are building. */
16var baseName = "libxml2";
17/* Configure file which contains the version and the output file where
18 we can store our build configuration. */
19var configFile = srcDirXml + "\\configure.in";
Igor Zlatkovicbd1a3062002-11-14 17:43:24 +000020var versionFile = ".\\config.msvc";
Igor Zlatkovic853514f2002-11-22 21:41:09 +000021/* Input and output files regarding the libxml features. */
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +000022var optsFileIn = srcDirXml + "\\include\\libxml\\xmlversion.h.in";
23var optsFile = srcDirXml + "\\include\\libxml\\xmlversion.h";
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +000024/* Version strings for the binary distribution. Will be filled later
25 in the code. */
26var verMajor;
27var verMinor;
28var verMicro;
29/* Libxml features. */
30var withTrio = false;
Igor Zlatkovice38ab532003-05-17 11:30:54 +000031var withThreads = "native";
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +000032var withFtp = true;
33var withHttp = true;
34var withHtml = true;
35var withC14n = true;
36var withCatalog = true;
37var withDocb = true;
38var withXpath = true;
39var withXptr = true;
40var withXinclude = true;
41var withIconv = true;
William M. Brack6d13f332003-08-08 16:40:36 +000042var withIso8859x = false;
Igor Zlatkovic3acadf42002-09-20 16:40:17 +000043var withZlib = false;
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +000044var withDebug = true;
45var withMemDebug = false;
Igor Zlatkovica6f2d902002-04-16 17:57:17 +000046var withSchemas = true;
Igor Zlatkovic8e040972002-09-20 13:39:53 +000047var withRegExps = true;
Igor Zlatkovic853514f2002-11-22 21:41:09 +000048var withPython = false;
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +000049/* Win32 build options. */
Igor Zlatkovicbd1a3062002-11-14 17:43:24 +000050var compiler = "msvc";
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +000051var buildDebug = 0;
52var buildStatic = 0;
53var buildPrefix = ".";
54var buildBinPrefix = "$(PREFIX)\\bin";
55var buildIncPrefix = "$(PREFIX)\\include";
56var buildLibPrefix = "$(PREFIX)\\lib";
57var buildSoPrefix = "$(PREFIX)\\lib";
58var buildInclude = ".";
59var buildLib = ".";
60/* Local stuff */
61var error = 0;
62
63/* Helper function, transforms the option variable into the 'Enabled'
64 or 'Disabled' string. */
65function boolToStr(opt)
66{
67 if (opt == false)
Igor Zlatkovic8f536a82002-10-31 16:01:00 +000068 return "no";
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +000069 else if (opt == true)
Igor Zlatkovic8f536a82002-10-31 16:01:00 +000070 return "yes";
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +000071 error = 1;
Igor Zlatkovic8f536a82002-10-31 16:01:00 +000072 return "*** undefined ***";
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +000073}
74
75/* Helper function, transforms the argument string into a boolean
76 value. */
77function strToBool(opt)
78{
79 if (opt == 0 || opt == "no")
80 return false;
81 else if (opt == 1 || opt == "yes")
82 return true;
83 error = 1;
84 return false;
85}
86
87/* Displays the details about how to use this script. */
88function usage()
89{
90 var txt;
91 txt = "Usage:\n";
92 txt += " cscript " + WScript.ScriptName + " <options>\n";
93 txt += " cscript " + WScript.ScriptName + " help\n\n";
94 txt += "Options can be specified in the form <option>=<value>, where the value is\n";
Igor Zlatkovic8f536a82002-10-31 16:01:00 +000095 txt += "either 'yes' or 'no', if not stated otherwise.\n\n";
Igor Zlatkovicbd1a3062002-11-14 17:43:24 +000096 txt += "\nXML processor options, default value given in parentheses:\n\n";
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +000097 txt += " trio: Enable TRIO string manipulator (" + (withTrio? "yes" : "no") + ")\n";
Igor Zlatkovic8f536a82002-10-31 16:01:00 +000098 txt += " threads: Enable thread safety [no|ctls|native|posix] (" + (withThreads) + ") \n";
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +000099 txt += " ftp: Enable FTP client (" + (withFtp? "yes" : "no") + ")\n";
100 txt += " http: Enable HTTP client (" + (withHttp? "yes" : "no") + ")\n";
101 txt += " html: Enable HTML processor (" + (withHtml? "yes" : "no") + ")\n";
102 txt += " c14n: Enable C14N support (" + (withC14n? "yes" : "no") + ")\n";
103 txt += " catalog: Enable catalog support (" + (withCatalog? "yes" : "no") + ")\n";
104 txt += " docb: Enable DocBook support (" + (withDocb? "yes" : "no") + ")\n";
105 txt += " xpath: Enable XPath support (" + (withXpath? "yes" : "no") + ")\n";
106 txt += " xptr: Enable XPointer support (" + (withXptr? "yes" : "no") + ")\n";
107 txt += " xinclude: Enable XInclude support (" + (withXinclude? "yes" : "no") + ")\n";
Igor Zlatkovic3acadf42002-09-20 16:40:17 +0000108 txt += " iconv: Enable iconv support (" + (withIconv? "yes" : "no") + ")\n";
William M. Brack6d13f332003-08-08 16:40:36 +0000109 txt += " iso8859x: Enable ISO8859X support (" + (withIso8859x? "yes" : "no") + ")\n";
Igor Zlatkovic3acadf42002-09-20 16:40:17 +0000110 txt += " zlib: Enable zlib support (" + (withZlib? "yes" : "no") + ")\n";
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000111 txt += " xml_debug: Enable XML debbugging module (" + (withDebug? "yes" : "no") + ")\n";
112 txt += " mem_debug: Enable memory debugger (" + (withMemDebug? "yes" : "no") + ")\n";
Igor Zlatkovic8e040972002-09-20 13:39:53 +0000113 txt += " regexps: Enable regular expressions (" + (withRegExps? "yes" : "no") + ")\n";
Igor Zlatkovica6f2d902002-04-16 17:57:17 +0000114 txt += " schemas: Enable XML Schema support (" + (withSchemas? "yes" : "no") + ")\n";
Igor Zlatkovic853514f2002-11-22 21:41:09 +0000115 txt += " python: Build Python bindings (" + (withPython? "yes" : "no") + ")\n";
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000116 txt += "\nWin32 build options, default value given in parentheses:\n\n";
Igor Zlatkovic72f92a82003-06-14 16:48:26 +0000117 txt += " compiler: Compiler to be used [msvc|mingw|bcb] (" + compiler + ")\n";
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000118 txt += " debug: Build unoptimised debug executables (" + (buildDebug? "yes" : "no") + ")\n";
119 txt += " static: Link xmllint statically to libxml2 (" + (buildStatic? "yes" : "no") + ")\n";
120 txt += " prefix: Base directory for the installation (" + buildPrefix + ")\n";
121 txt += " bindir: Directory where xmllint and friends should be installed\n";
122 txt += " (" + buildBinPrefix + ")\n";
123 txt += " incdir: Directory where headers should be installed\n";
124 txt += " (" + buildIncPrefix + ")\n";
125 txt += " libdir: Directory where static and import libraries should be\n";
126 txt += " installed (" + buildLibPrefix + ")\n";
127 txt += " sodir: Directory where shared libraries should be installed\n";
128 txt += " (" + buildSoPrefix + ")\n";
129 txt += " include: Additional search path for the compiler, particularily\n";
130 txt += " where iconv headers can be found (" + buildInclude + ")\n";
131 txt += " lib: Additional search path for the linker, particularily\n";
132 txt += " where iconv library can be found (" + buildLib + ")\n";
133 WScript.Echo(txt);
134}
135
136/* Discovers the version we are working with by reading the apropriate
137 configuration file. Despite its name, this also writes the configuration
138 file included by our makefile. */
139function discoverVersion()
140{
141 var fso, cf, vf, ln, s;
142 fso = new ActiveXObject("Scripting.FileSystemObject");
143 cf = fso.OpenTextFile(configFile, 1);
Igor Zlatkovicbd1a3062002-11-14 17:43:24 +0000144 if (compiler == "msvc")
145 versionFile = ".\\config.msvc";
146 else if (compiler == "mingw")
147 versionFile = ".\\config.mingw";
Igor Zlatkovic72f92a82003-06-14 16:48:26 +0000148 else if (compiler == "bcb")
149 versionFile = ".\\config.bcb";
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000150 vf = fso.CreateTextFile(versionFile, true);
151 vf.WriteLine("# " + versionFile);
152 vf.WriteLine("# This file is generated automatically by " + WScript.ScriptName + ".");
153 vf.WriteBlankLines(1);
154 while (cf.AtEndOfStream != true) {
155 ln = cf.ReadLine();
156 s = new String(ln);
157 if (s.search(/^LIBXML_MAJOR_VERSION/) != -1) {
158 vf.WriteLine(s);
159 verMajor = s.substring(s.indexOf("=") + 1, s.length)
160 } else if(s.search(/^LIBXML_MINOR_VERSION/) != -1) {
161 vf.WriteLine(s);
162 verMinor = s.substring(s.indexOf("=") + 1, s.length)
163 } else if(s.search(/^LIBXML_MICRO_VERSION/) != -1) {
164 vf.WriteLine(s);
165 verMicro = s.substring(s.indexOf("=") + 1, s.length)
166 }
167 }
168 cf.Close();
169 vf.WriteLine("XML_SRCDIR=" + srcDirXml);
170 vf.WriteLine("UTILS_SRCDIR=" + srcDirUtils);
171 vf.WriteLine("BINDIR=" + binDir);
172 vf.WriteLine("WITH_TRIO=" + (withTrio? "1" : "0"));
Igor Zlatkovic8f536a82002-10-31 16:01:00 +0000173 vf.WriteLine("WITH_THREADS=" + withThreads);
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000174 vf.WriteLine("WITH_FTP=" + (withFtp? "1" : "0"));
175 vf.WriteLine("WITH_HTTP=" + (withHttp? "1" : "0"));
176 vf.WriteLine("WITH_HTML=" + (withHtml? "1" : "0"));
177 vf.WriteLine("WITH_C14N=" + (withC14n? "1" : "0"));
178 vf.WriteLine("WITH_CATALOG=" + (withCatalog? "1" : "0"));
179 vf.WriteLine("WITH_DOCB=" + (withDocb? "1" : "0"));
180 vf.WriteLine("WITH_XPATH=" + (withXpath? "1" : "0"));
181 vf.WriteLine("WITH_XPTR=" + (withXptr? "1" : "0"));
182 vf.WriteLine("WITH_XINCLUDE=" + (withXinclude? "1" : "0"));
183 vf.WriteLine("WITH_ICONV=" + (withIconv? "1" : "0"));
William M. Brack6d13f332003-08-08 16:40:36 +0000184 vf.WriteLine("WITH_ISO8859X=" + (withIso8859x? "1" : "0"));
Igor Zlatkovic3acadf42002-09-20 16:40:17 +0000185 vf.WriteLine("WITH_ZLIB=" + (withZlib? "1" : "0"));
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000186 vf.WriteLine("WITH_DEBUG=" + (withDebug? "1" : "0"));
187 vf.WriteLine("WITH_MEM_DEBUG=" + (withMemDebug? "1" : "0"));
Igor Zlatkovica6f2d902002-04-16 17:57:17 +0000188 vf.WriteLine("WITH_SCHEMAS=" + (withSchemas? "1" : "0"));
Igor Zlatkovic8e040972002-09-20 13:39:53 +0000189 vf.WriteLine("WITH_REGEXPS=" + (withRegExps? "1" : "0"));
Igor Zlatkovic853514f2002-11-22 21:41:09 +0000190 vf.WriteLine("WITH_PYTHON=" + (withPython? "1" : "0"));
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000191 vf.WriteLine("DEBUG=" + (buildDebug? "1" : "0"));
192 vf.WriteLine("STATIC=" + (buildStatic? "1" : "0"));
193 vf.WriteLine("PREFIX=" + buildPrefix);
194 vf.WriteLine("BINPREFIX=" + buildBinPrefix);
195 vf.WriteLine("INCPREFIX=" + buildIncPrefix);
196 vf.WriteLine("LIBPREFIX=" + buildLibPrefix);
197 vf.WriteLine("SOPREFIX=" + buildSoPrefix);
Igor Zlatkovicbd1a3062002-11-14 17:43:24 +0000198 if (compiler == "msvc") {
199 vf.WriteLine("INCLUDE=$(INCLUDE);" + buildInclude);
200 vf.WriteLine("LIB=$(LIB);" + buildLib);
201 } else if (compiler == "mingw") {
202 vf.WriteLine("INCLUDE+=;" + buildInclude);
203 vf.WriteLine("LIB+=;" + buildLib);
Igor Zlatkovic72f92a82003-06-14 16:48:26 +0000204 } else if (compiler == "bcb") {
205 vf.WriteLine("INCLUDE=" + buildInclude);
206 vf.WriteLine("LIB=" + buildLib);
207 }
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000208 vf.Close();
209}
210
211/* Configures libxml. This one will generate xmlversion.h from xmlversion.h.in
212 taking what the user passed on the command line into account. */
213function configureLibxml()
214{
215 var fso, ofi, of, ln, s;
216 fso = new ActiveXObject("Scripting.FileSystemObject");
217 ofi = fso.OpenTextFile(optsFileIn, 1);
218 of = fso.CreateTextFile(optsFile, true);
219 while (ofi.AtEndOfStream != true) {
220 ln = ofi.ReadLine();
221 s = new String(ln);
222 if (s.search(/\@VERSION\@/) != -1) {
223 of.WriteLine(s.replace(/\@VERSION\@/,
224 verMajor + "." + verMinor + "." + verMicro));
225 } else if (s.search(/\@LIBXML_VERSION_NUMBER\@/) != -1) {
226 of.WriteLine(s.replace(/\@LIBXML_VERSION_NUMBER\@/,
227 verMajor*10000 + verMinor*100 + verMicro*1));
228 } else if (s.search(/\@WITH_TRIO\@/) != -1) {
229 of.WriteLine(s.replace(/\@WITH_TRIO\@/, withTrio? "1" : "0"));
230 } else if (s.search(/\@WITH_THREADS\@/) != -1) {
Igor Zlatkovic8f536a82002-10-31 16:01:00 +0000231 of.WriteLine(s.replace(/\@WITH_THREADS\@/, withThreads == "no"? "0" : "1"));
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000232 } else if (s.search(/\@WITH_FTP\@/) != -1) {
233 of.WriteLine(s.replace(/\@WITH_FTP\@/, withFtp? "1" : "0"));
234 } else if (s.search(/\@WITH_HTTP\@/) != -1) {
235 of.WriteLine(s.replace(/\@WITH_HTTP\@/, withHttp? "1" : "0"));
236 } else if (s.search(/\@WITH_HTML\@/) != -1) {
237 of.WriteLine(s.replace(/\@WITH_HTML\@/, withHtml? "1" : "0"));
238 } else if (s.search(/\@WITH_C14N\@/) != -1) {
239 of.WriteLine(s.replace(/\@WITH_C14N\@/, withC14n? "1" : "0"));
240 } else if (s.search(/\@WITH_CATALOG\@/) != -1) {
241 of.WriteLine(s.replace(/\@WITH_CATALOG\@/, withCatalog? "1" : "0"));
242 } else if (s.search(/\@WITH_DOCB\@/) != -1) {
243 of.WriteLine(s.replace(/\@WITH_DOCB\@/, withDocb? "1" : "0"));
244 } else if (s.search(/\@WITH_XPATH\@/) != -1) {
245 of.WriteLine(s.replace(/\@WITH_XPATH\@/, withXpath? "1" : "0"));
246 } else if (s.search(/\@WITH_XPTR\@/) != -1) {
247 of.WriteLine(s.replace(/\@WITH_XPTR\@/, withXptr? "1" : "0"));
248 } else if (s.search(/\@WITH_XINCLUDE\@/) != -1) {
249 of.WriteLine(s.replace(/\@WITH_XINCLUDE\@/, withXinclude? "1" : "0"));
250 } else if (s.search(/\@WITH_ICONV\@/) != -1) {
251 of.WriteLine(s.replace(/\@WITH_ICONV\@/, withIconv? "1" : "0"));
William M. Brack6d13f332003-08-08 16:40:36 +0000252 } else if (s.search(/\@WITH_ISO8859X\@/) != -1) {
253 of.WriteLine(s.replace(/\@WITH_ISO8859X\@/, withIso8859x? "1" : "0"));
Igor Zlatkovic3acadf42002-09-20 16:40:17 +0000254 } else if (s.search(/\@WITH_ZLIB\@/) != -1) {
255 of.WriteLine(s.replace(/\@WITH_ZLIB\@/, withZlib? "1" : "0"));
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000256 } else if (s.search(/\@WITH_DEBUG\@/) != -1) {
257 of.WriteLine(s.replace(/\@WITH_DEBUG\@/, withDebug? "1" : "0"));
258 } else if (s.search(/\@WITH_MEM_DEBUG\@/) != -1) {
259 of.WriteLine(s.replace(/\@WITH_MEM_DEBUG\@/, withMemDebug? "1" : "0"));
Igor Zlatkovica6f2d902002-04-16 17:57:17 +0000260 } else if (s.search(/\@WITH_SCHEMAS\@/) != -1) {
261 of.WriteLine(s.replace(/\@WITH_SCHEMAS\@/, withSchemas? "1" : "0"));
Igor Zlatkovic8e040972002-09-20 13:39:53 +0000262 } else if (s.search(/\@WITH_REGEXPS\@/) != -1) {
263 of.WriteLine(s.replace(/\@WITH_REGEXPS\@/, withRegExps? "1" : "0"));
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000264 } else
265 of.WriteLine(ln);
266 }
267 ofi.Close();
268 of.Close();
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000269}
Igor Zlatkovic853514f2002-11-22 21:41:09 +0000270/* Configures Python bindings. Otherwise identical to the above */
271function configureLibxmlPy()
272{
273 var pyOptsFileIn = srcDirXml + "\\python\\setup.py.in";
274 var pyOptsFile = srcDirXml + "\\python\\setup.py";
275 var fso, ofi, of, ln, s;
276 fso = new ActiveXObject("Scripting.FileSystemObject");
277 ofi = fso.OpenTextFile(pyOptsFileIn, 1);
278 of = fso.CreateTextFile(pyOptsFile, true);
279 while (ofi.AtEndOfStream != true) {
280 ln = ofi.ReadLine();
281 s = new String(ln);
282 if (s.search(/\@LIBXML_VERSION\@/) != -1) {
283 of.WriteLine(s.replace(/\@LIBXML_VERSION\@/,
284 verMajor + "." + verMinor + "." + verMicro));
285 } else if (s.search(/\@prefix\@/) != -1) {
286 of.WriteLine(s.replace(/\@prefix\@/, buildPrefix));
Daniel Veillard94bb2f12003-04-27 22:14:07 +0000287 } else if (s.search(/\@WITH_THREADS\@/) != -1) {
288 of.WriteLine(s.replace(/\@WITH_THREADS\@/, withThreads == "no"? "0" : "1"));
Igor Zlatkovic853514f2002-11-22 21:41:09 +0000289 } else
290 of.WriteLine(ln);
291 }
292 ofi.Close();
293 of.Close();
294}
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000295
296/* Creates the readme file for the binary distribution of 'bname', for the
297 version 'ver' in the file 'file'. This one is called from the Makefile when
298 generating a binary distribution. The parameters are passed by make. */
299function genReadme(bname, ver, file)
300{
301 var fso, f;
302 fso = new ActiveXObject("Scripting.FileSystemObject");
303 f = fso.CreateTextFile(file, true);
304 f.WriteLine(" " + bname + " " + ver);
305 f.WriteLine(" --------------");
306 f.WriteBlankLines(1);
307 f.WriteLine(" This is " + bname + ", version " + ver + ", binary package for the native Win32/IA32");
308 f.WriteLine("platform.");
309 f.WriteBlankLines(1);
310 f.WriteLine(" The directory named 'include' contains the header files. Place its");
311 f.WriteLine("contents somewhere where it can be found by the compiler.");
312 f.WriteLine(" The directory which answers to the name 'lib' contains the static and");
313 f.WriteLine("dynamic libraries. Place them somewhere where they can be found by the");
314 f.WriteLine("linker. The files whose names end with '_a.lib' are aimed for static");
315 f.WriteLine("linking, the other files are lib/dll pairs.");
316 f.WriteLine(" The directory called 'util' contains various programs which count as a");
317 f.WriteLine("part of " + bname + ".");
318 f.WriteBlankLines(1);
Igor Zlatkovic0ceeb8e2002-09-10 19:07:02 +0000319 f.WriteLine(" If you plan to develop your own programme, in C, which uses " + bname + ", then");
320 f.WriteLine("you should know what to do with the files in the binary package. If you don't,");
321 f.WriteLine("know this, then please, please do some research on how to use a");
322 f.WriteLine("third-party library in a C programme. The topic belongs to the very basics");
323 f.WriteLine("and you will not be able to do much without that knowledge.");
324 f.WriteBlankLines(1);
325 f.WriteLine(" If you wish to use " + bname + " solely through the supplied utilities, such as");
326 f.WriteLine("xmllint or xsltproc, then all you need to do is place the");
327 f.WriteLine("contents of the 'lib' and 'util' directories from the binary package in a");
328 f.WriteLine("directory on your disc which is mentioned in your PATH environment");
329 f.WriteLine("variable. You can use an existing directory which is allready in the");
330 f.WriteLine("path, such as 'C:\WINDOWS', or 'C:\WINNT'. You can also create a new");
331 f.WriteLine("directory for " + bname + " and place the files there, but be sure to modify");
332 f.WriteLine("the PATH environment variable and add that new directory to its list.");
333 f.WriteBlankLines(1);
334 f.WriteLine(" If you use other software which needs " + bname + ", such as Apache");
335 f.WriteLine("Web Server in certain configurations, then please consult the");
336 f.WriteLine("documentation of that software and see if it mentions something about");
337 f.WriteLine("how it uses " + bname + " and how it expects it to be installed. If you find");
338 f.WriteLine("nothing, then the default installation, as described in the previous");
339 f.WriteLine("paragraph, should be suficient.");
340 f.WriteBlankLines(1);
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000341 f.WriteLine(" If there is something you cannot keep for yourself, such as a problem,");
342 f.WriteLine("a cheer of joy, a comment or a suggestion, feel free to contact me using");
343 f.WriteLine("the address below.");
344 f.WriteBlankLines(1);
Daniel Veillardbeb70bd2002-12-18 14:53:54 +0000345 f.WriteLine(" Igor Zlatkovic (igor@zlatkovic.com)");
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000346 f.Close();
347}
348
William M. Brack6d13f332003-08-08 16:40:36 +0000349
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000350/*
351 * main(),
352 * Execution begins here.
353 */
354
355// Parse the command-line arguments.
356for (i = 0; (i < WScript.Arguments.length) && (error == 0); i++) {
357 var arg, opt;
358 arg = WScript.Arguments(i);
359 opt = arg.substring(0, arg.indexOf("="));
360 if (opt.length == 0)
361 opt = arg.substring(0, arg.indexOf(":"));
362 if (opt.length > 0) {
363 if (opt == "trio")
364 withTrio = strToBool(arg.substring(opt.length + 1, arg.length));
365 else if (opt == "threads")
Igor Zlatkovic8f536a82002-10-31 16:01:00 +0000366 withThreads = arg.substring(opt.length + 1, arg.length);
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000367 else if (opt == "ftp")
368 withFtp = strToBool(arg.substring(opt.length + 1, arg.length));
369 else if (opt == "http")
370 withHttp = strToBool(arg.substring(opt.length + 1, arg.length));
371 else if (opt == "html")
372 withHtml = strToBool(arg.substring(opt.length + 1, arg.length));
Igor Zlatkovic9425ce22002-04-10 21:57:11 +0000373 else if (opt == "c14n")
374 withC14n = strToBool(arg.substring(opt.length + 1, arg.length));
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000375 else if (opt == "catalog")
376 withCatalog = strToBool(arg.substring(opt.length + 1, arg.length));
377 else if (opt == "docb")
378 withDocb = strToBool(arg.substring(opt.length + 1, arg.length));
379 else if (opt == "xpath")
380 withXpath = strToBool(arg.substring(opt.length + 1, arg.length));
381 else if (opt == "xptr")
382 withXptr = strToBool(arg.substring(opt.length + 1, arg.length));
383 else if (opt == "xinclude")
384 withXinclude = strToBool(arg.substring(opt.length + 1, arg.length));
385 else if (opt == "iconv")
386 withIconv = strToBool(arg.substring(opt.length + 1, arg.length));
William M. Brack6d13f332003-08-08 16:40:36 +0000387 else if (opt == "iso8859x")
388 withIso8859x = strToBool(arg.substring(opt.length + 1, arg.length));
Igor Zlatkovic3acadf42002-09-20 16:40:17 +0000389 else if (opt == "zlib")
390 withZlib = strToBool(arg.substring(opt.length + 1, arg.length));
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000391 else if (opt == "xml_debug")
392 withDebug = strToBool(arg.substring(opt.length + 1, arg.length));
393 else if (opt == "mem_debug")
394 withMemDebug = strToBool(arg.substring(opt.length + 1, arg.length));
Igor Zlatkovica6f2d902002-04-16 17:57:17 +0000395 else if (opt == "schemas")
396 withSchemas = strToBool(arg.substring(opt.length + 1, arg.length));
Igor Zlatkovic8e040972002-09-20 13:39:53 +0000397 else if (opt == "regexps")
398 withRegExps = strToBool(arg.substring(opt.length + 1, arg.length));
Igor Zlatkovic853514f2002-11-22 21:41:09 +0000399 else if (opt == "python")
400 withPython = strToBool(arg.substring(opt.length + 1, arg.length));
Igor Zlatkovicbd1a3062002-11-14 17:43:24 +0000401 else if (opt == "compiler")
402 compiler = arg.substring(opt.length + 1, arg.length);
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000403 else if (opt == "debug")
404 buildDebug = strToBool(arg.substring(opt.length + 1, arg.length));
405 else if (opt == "static")
406 buildStatic = strToBool(arg.substring(opt.length + 1, arg.length));
407 else if (opt == "prefix")
408 buildPrefix = arg.substring(opt.length + 1, arg.length);
409 else if (opt == "incdir")
410 buildIncPrefix = arg.substring(opt.length + 1, arg.length);
411 else if (opt == "bindir")
412 buildBinPrefix = arg.substring(opt.length + 1, arg.length);
413 else if (opt == "libdir")
414 buildLibPrefix = arg.substring(opt.length + 1, arg.length);
415 else if (opt == "sodir")
416 buildSoPrefix = arg.substring(opt.length + 1, arg.length);
417 else if (opt == "incdir")
418 buildIncPrefix = arg.substring(opt.length + 1, arg.length);
419 else if (opt == "include")
420 buildInclude = arg.substring(opt.length + 1, arg.length);
421 else if (opt == "lib")
422 buildLib = arg.substring(opt.length + 1, arg.length);
423 else
424 error = 1;
425 } else if (i == 0) {
426 if (arg == "genreadme") {
427 // This command comes from the Makefile and will not be checked
428 // for errors, because Makefile will always supply right the parameters.
429 genReadme(WScript.Arguments(1), WScript.Arguments(2), WScript.Arguments(3));
430 WScript.Quit(0);
431 } else if (arg == "help") {
432 usage();
433 WScript.Quit(0);
434 }
William M. Brack6d13f332003-08-08 16:40:36 +0000435
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000436 } else
437 error = 1;
438}
439
William M. Brack6d13f332003-08-08 16:40:36 +0000440
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000441// If we fail here, it is because the user supplied an unrecognised argument.
442if (error != 0) {
443 usage();
444 WScript.Quit(error);
445}
446
William M. Brack6d13f332003-08-08 16:40:36 +0000447
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000448// Discover the version.
449discoverVersion();
450if (error != 0) {
451 WScript.Echo("Version discovery failed, aborting.");
452 WScript.Quit(error);
453}
William M. Brack6d13f332003-08-08 16:40:36 +0000454
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000455WScript.Echo(baseName + " version: " + verMajor + "." + verMinor + "." + verMicro);
456
457// Configure libxml.
458configureLibxml();
459if (error != 0) {
460 WScript.Echo("Configuration failed, aborting.");
461 WScript.Quit(error);
462}
William M. Brack6d13f332003-08-08 16:40:36 +0000463
Igor Zlatkovic853514f2002-11-22 21:41:09 +0000464if (withPython == true) {
465 configureLibxmlPy();
466 if (error != 0) {
467 WScript.Echo("Configuration failed, aborting.");
468 WScript.Quit(error);
469 }
William M. Brack6d13f332003-08-08 16:40:36 +0000470
Igor Zlatkovic853514f2002-11-22 21:41:09 +0000471}
472
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000473// Create the makefile.
474var fso = new ActiveXObject("Scripting.FileSystemObject");
Igor Zlatkovicbd1a3062002-11-14 17:43:24 +0000475var makefile = ".\\Makefile.msvc";
476if (compiler == "mingw")
477 makefile = ".\\Makefile.mingw";
Igor Zlatkovice8b5b0f2003-06-16 07:12:50 +0000478else if (compiler == "bcb")
479 makefile = ".\\Makefile.bcb";
Igor Zlatkovicbd1a3062002-11-14 17:43:24 +0000480fso.CopyFile(makefile, ".\\Makefile", true);
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000481WScript.Echo("Created Makefile.");
482
483// Display the final configuration.
484var txtOut = "\nXML processor configuration\n";
485txtOut += "---------------------------\n";
486txtOut += " Trio: " + boolToStr(withTrio) + "\n";
Igor Zlatkovic8f536a82002-10-31 16:01:00 +0000487txtOut += " Thread safety: " + withThreads + "\n";
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000488txtOut += " FTP client: " + boolToStr(withFtp) + "\n";
489txtOut += " HTTP client: " + boolToStr(withHttp) + "\n";
490txtOut += " HTML processor: " + boolToStr(withHtml) + "\n";
491txtOut += " C14N support: " + boolToStr(withC14n) + "\n";
492txtOut += " Catalog support: " + boolToStr(withCatalog) + "\n";
493txtOut += " DocBook support: " + boolToStr(withDocb) + "\n";
494txtOut += " XPath support: " + boolToStr(withXpath) + "\n";
495txtOut += " XPointer support: " + boolToStr(withXptr) + "\n";
496txtOut += " XInclude support: " + boolToStr(withXinclude) + "\n";
Igor Zlatkovic3acadf42002-09-20 16:40:17 +0000497txtOut += " iconv support: " + boolToStr(withIconv) + "\n";
William M. Brack6d13f332003-08-08 16:40:36 +0000498txtOut += " iso8859x support: " + boolToStr(withIso8859x) + "\n";
Igor Zlatkovic3acadf42002-09-20 16:40:17 +0000499txtOut += " zlib support: " + boolToStr(withZlib) + "\n";
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000500txtOut += " Debugging module: " + boolToStr(withDebug) + "\n";
501txtOut += " Memory debugging: " + boolToStr(withMemDebug) + "\n";
Igor Zlatkovic8e040972002-09-20 13:39:53 +0000502txtOut += " Regexp support: " + boolToStr(withRegExps) + "\n";
Igor Zlatkovica6f2d902002-04-16 17:57:17 +0000503txtOut += "XML Schema support: " + boolToStr(withSchemas) + "\n";
Igor Zlatkovic853514f2002-11-22 21:41:09 +0000504txtOut += " Python bindings: " + boolToStr(withPython) + "\n";
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000505txtOut += "\n";
506txtOut += "Win32 build configuration\n";
507txtOut += "-------------------------\n";
Igor Zlatkovicbd1a3062002-11-14 17:43:24 +0000508txtOut += " Compiler: " + compiler + "\n";
Igor Zlatkovicac97f6e2002-03-24 21:00:26 +0000509txtOut += " Debug symbols: " + boolToStr(buildDebug) + "\n";
510txtOut += " Static xmllint: " + boolToStr(buildStatic) + "\n";
511txtOut += " Install prefix: " + buildPrefix + "\n";
512txtOut += " Put tools in: " + buildBinPrefix + "\n";
513txtOut += " Put headers in: " + buildIncPrefix + "\n";
514txtOut += "Put static libs in: " + buildLibPrefix + "\n";
515txtOut += "Put shared libs in: " + buildSoPrefix + "\n";
516txtOut += " Include path: " + buildInclude + "\n";
517txtOut += " Lib path: " + buildLib + "\n";
518WScript.Echo(txtOut);
519
William M. Brack6d13f332003-08-08 16:40:36 +0000520//
521