]> granicus.if.org Git - php/commitdiff
Add new (optional!) win32 build infrastructure.
authorWez Furlong <wez@php.net>
Tue, 2 Dec 2003 23:17:04 +0000 (23:17 +0000)
committerWez Furlong <wez@php.net>
Tue, 2 Dec 2003 23:17:04 +0000 (23:17 +0000)
Will follow up to internals@ shortly.

29 files changed:
buildconf.bat [new file with mode: 0644]
ext/bcmath/config.w32 [new file with mode: 0644]
ext/calendar/config.w32 [new file with mode: 0644]
ext/com_dotnet/config.w32 [new file with mode: 0644]
ext/ctype/config.w32 [new file with mode: 0644]
ext/dom/config.w32 [new file with mode: 0644]
ext/ftp/config.w32 [new file with mode: 0644]
ext/libxml/config.w32 [new file with mode: 0644]
ext/mbstring/config.w32 [new file with mode: 0644]
ext/odbc/config.w32 [new file with mode: 0644]
ext/pcre/config.w32 [new file with mode: 0644]
ext/session/config.w32 [new file with mode: 0644]
ext/simplexml/config.w32 [new file with mode: 0644]
ext/sqlite/config.w32 [new file with mode: 0644]
ext/standard/config.w32 [new file with mode: 0644]
ext/tokenizer/config.w32 [new file with mode: 0644]
ext/wddx/config.w32 [new file with mode: 0644]
ext/xml/config.w32 [new file with mode: 0644]
ext/zlib/config.w32 [new file with mode: 0644]
sapi/apache/config.w32 [new file with mode: 0644]
sapi/cgi/config.w32 [new file with mode: 0644]
sapi/cli/config.w32 [new file with mode: 0644]
sapi/isapi/config.w32 [new file with mode: 0644]
win32/build/Makefile [new file with mode: 0644]
win32/build/buildconf.js [new file with mode: 0644]
win32/build/config.w32 [new file with mode: 0644]
win32/build/config.w32.h.in [new file with mode: 0644]
win32/build/configure.tail [new file with mode: 0644]
win32/build/confutils.js [new file with mode: 0644]

diff --git a/buildconf.bat b/buildconf.bat
new file mode 100644 (file)
index 0000000..a217326
--- /dev/null
@@ -0,0 +1,2 @@
+@echo off
+cscript /nologo win32\build\buildconf.js
diff --git a/ext/bcmath/config.w32 b/ext/bcmath/config.w32
new file mode 100644 (file)
index 0000000..32cead8
--- /dev/null
@@ -0,0 +1,14 @@
+// $Id$
+// vim:ft=javascript
+
+ARG_ENABLE("bcmath", "bc style precision math functions", "yes");
+
+if (PHP_BCMATH == "yes") {
+       EXTENSION("bcmath", "bcmath.c", null, "-Iext/bcmath/libbcmath/src");
+       ADD_SOURCES("ext/bcmath/libbcmath/src", "add.c div.c init.c neg.c \
+               outofmem.c raisemod.c rt.c sub.c compare.c divmod.c int2num.c \
+               num2long.c output.c recmul.c sqrt.c zero.c debug.c doaddsub.c \
+               nearzero.c num2str.c raise.c rmzero.c str2num.c", "bcmath");
+
+       AC_DEFINE('WITH_BCMATH', 1, 'Have BCMATH library');
+}
diff --git a/ext/calendar/config.w32 b/ext/calendar/config.w32
new file mode 100644 (file)
index 0000000..bd9faba
--- /dev/null
@@ -0,0 +1,10 @@
+// $Id$
+// vim:ft=javascript
+
+ARG_ENABLE("calendar", "calendar conversion support", "yes");
+
+if (PHP_CALENDAR == "yes") {
+       EXTENSION("calendar", "calendar.c dow.c french.c gregor.c jewish.c \
+               julian.c easter.c cal_unix.c");
+       AC_DEFINE('HAVE_CALENDAR', 1, 'Have calendar');
+}
diff --git a/ext/com_dotnet/config.w32 b/ext/com_dotnet/config.w32
new file mode 100644 (file)
index 0000000..1ab9026
--- /dev/null
@@ -0,0 +1,13 @@
+// $Id$
+// vim:ft=javascript
+
+ARG_ENABLE("com_dotnet", "COM and .Net support", "yes");
+
+if (PHP_COM_DOTNET == "yes") {
+       EXTENSION("com_dotnet", "com_com.c com_dotnet.c com_extension.c \
+               com_handlers.c com_iterator.c com_misc.c com_olechar.c \
+               com_typeinfo.c com_variant.c");
+       AC_DEFINE('HAVE_COM_DOTNET', 1, 'Have COM_DOTNET support');
+       // TODO: do a header check for this
+       AC_DEFINE('HAVE_MSCOREE_H', 0, 'Have .net headers');
+}
diff --git a/ext/ctype/config.w32 b/ext/ctype/config.w32
new file mode 100644 (file)
index 0000000..1ade89c
--- /dev/null
@@ -0,0 +1,9 @@
+// $Id$
+// vim:ft=javascript
+
+ARG_ENABLE("ctype", "ctype", "yes");
+
+if (PHP_CTYPE == "yes") {
+       EXTENSION("ctype", "ctype.c");
+       AC_DEFINE('HAVE_CTYPE', 1, 'Have ctype');
+}
diff --git a/ext/dom/config.w32 b/ext/dom/config.w32
new file mode 100644 (file)
index 0000000..e38f823
--- /dev/null
@@ -0,0 +1,18 @@
+// $Id$
+// vim:ft=javascript
+
+ARG_WITH("dom", "DOM support", "yes");
+
+if (PHP_DOM == "yes" && PHP_LIBXML == "yes") {
+       EXTENSION("dom", "php_dom.c attr.c document.c domerrorhandler.c \
+               domstringlist.c domexception.c namelist.c processinginstruction.c \
+               cdatasection.c documentfragment.c domimplementation.c element.c \
+               node.c string_extend.c characterdata.c documenttype.c \
+               domimplementationlist.c entity.c nodelist.c text.c comment.c \
+               domconfiguration.c domimplementationsource.c entityreference.c \
+               notation.c xpath.c dom_iterators.c typeinfo.c domerror.c \
+               domlocator.c namednodemap.c userdatahandler.c");
+       AC_DEFINE("HAVE_DOM", 1, "DOM support");
+}
+
+
diff --git a/ext/ftp/config.w32 b/ext/ftp/config.w32
new file mode 100644 (file)
index 0000000..c91e350
--- /dev/null
@@ -0,0 +1,9 @@
+// $Id$
+// vim:ft=javascript
+
+ARG_ENABLE("ftp", "ftp support", "yes");
+
+if (PHP_FTP == "yes") {
+       EXTENSION("ftp", "php_ftp.c ftp.c");
+       AC_DEFINE('HAVE_FTP', 1, 'Have FTP support');
+}
diff --git a/ext/libxml/config.w32 b/ext/libxml/config.w32
new file mode 100644 (file)
index 0000000..d1cd69c
--- /dev/null
@@ -0,0 +1,12 @@
+// $Id$
+// vim:ft=javascript
+
+ARG_WITH("libxml", "LibXML support", "yes");
+
+if (PHP_LIBXML == "yes") {
+       EXTENSION("libxml", "libxml.c", false /* never shared */);
+       AC_DEFINE("HAVE_LIBXML", 1, "LibXML support");
+       ADD_FLAG("LIBS_LIBXML", "libxml2.lib iconv.lib");
+}
+
+
diff --git a/ext/mbstring/config.w32 b/ext/mbstring/config.w32
new file mode 100644 (file)
index 0000000..262581a
--- /dev/null
@@ -0,0 +1,55 @@
+// $Id$
+// vim:ft=javascript
+
+ARG_ENABLE("mbstring", "multibyte string functions", "no");
+ARG_ENABLE("mbregex", "multibyte regex support", "no");
+
+if (PHP_MBSTRING == "yes") {
+
+       FSO.CopyFile("ext\\mbstring\\libmbfl\\config.h.vc6",
+               "ext\\mbstring\\libmbfl\\config.h", true);
+       FSO.CopyFile("ext\\mbstring\\oniguruma\\win32\\config.h",
+               "ext\\mbstring\\oniguruma\\config.h", true);
+       
+       EXTENSION("mbstring", "mbstring.c php_unicode.c mb_gpc.c", null,
+               "-Iext/mbstring/libmbfl -Iext/mbstring/libmbfl/mbfl \
+               /D NOT_RUBY=1 /D LIBMBFL_EXPORTS=1 /D HAVE_STDARG_PROTOTYPES=1 \
+               /D HAVE_CONFIG_H /D HAVE_STDLIB_H /D HAVE_STRICMP /D MBFL_DLL_EXPORT=1");
+       
+       ADD_SOURCES("ext/mbstring/libmbfl/filters", "html_entities.c \
+               mbfilter_7bit.c mbfilter_ascii.c mbfilter_base64.c mbfilter_big5.c \
+               mbfilter_byte2.c mbfilter_byte4.c mbfilter_cp1251.c mbfilter_cp1252.c \
+               mbfilter_cp866.c mbfilter_cp932.c mbfilter_cp936.c mbfilter_euc_cn.c \
+               mbfilter_euc_jp.c mbfilter_euc_jp_win.c mbfilter_euc_kr.c \
+               mbfilter_euc_tw.c mbfilter_htmlent.c mbfilter_hz.c mbfilter_iso2022_kr.c \
+               mbfilter_iso8859_1.c mbfilter_iso8859_10.c mbfilter_iso8859_13.c \
+               mbfilter_iso8859_14.c mbfilter_iso8859_15.c mbfilter_iso8859_2.c \
+               mbfilter_iso8859_3.c mbfilter_iso8859_4.c mbfilter_iso8859_5.c \
+               mbfilter_iso8859_6.c mbfilter_iso8859_7.c mbfilter_iso8859_8.c \
+               mbfilter_iso8859_9.c mbfilter_jis.c mbfilter_koi8r.c mbfilter_qprint.c \
+               mbfilter_sjis.c mbfilter_ucs2.c mbfilter_ucs4.c mbfilter_uhc.c \
+               mbfilter_utf16.c mbfilter_utf32.c mbfilter_utf7.c mbfilter_utf7imap.c \
+               mbfilter_utf8.c mbfilter_uuencode.c", "mbstring");
+
+       ADD_SOURCES("ext/mbstring/libmbfl/mbfl", "mbfilter.c mbfilter_8bit.c \
+               mbfilter_pass.c mbfilter_wchar.c mbfl_convert.c mbfl_encoding.c \
+               mbfl_filter_output.c mbfl_ident.c mbfl_language.c mbfl_memory_device.c \
+               mbfl_string.c mbfl_allocators.c", "mbstring");
+
+       ADD_SOURCES("ext/mbstring/libmbfl/nls", "nls_de.c nls_en.c nls_ja.c nls_kr.c \
+               nls_neutral.c nls_ru.c nls_uni.c nls_zh.c", "mbstring");
+
+       AC_DEFINE('HAVE_MBSTRING', 1, 'Have mbstring support');
+       AC_DEFINE('HAVE_MBSTR_CN', 1, 'CN');
+       AC_DEFINE('HAVE_MBSTR_JA', 1, 'CN');
+       AC_DEFINE('HAVE_MBSTR_KR', 1, 'CN');
+       AC_DEFINE('HAVE_MBSTR_RU', 1, 'CN');
+       AC_DEFINE('HAVE_MBSTR_TW', 1, 'CN');
+       AC_DEFINE('HAVE_STDARG_PROTOTYPES', 1, 'have stdarg.h');
+
+       if (PHP_MBREGEX == "yes") {
+               ADD_SOURCES("ext/mbstring/oniguruma", "regcomp.c regerror.c \
+                       regexec.c reggnu.c regparse.c regposerr.c", "mbstring");
+               ADD_SOURCES("ext/mbstring", "php_mbregex.c", "mbstring");
+       }
+}
diff --git a/ext/odbc/config.w32 b/ext/odbc/config.w32
new file mode 100644 (file)
index 0000000..2ff2a06
--- /dev/null
@@ -0,0 +1,12 @@
+// $Id$
+// vim:ft=javascript
+
+ARG_ENABLE("odbc", "ODBC support", "yes");
+
+if (PHP_ODBC == "yes") {
+       EXTENSION("odbc", "php_odbc.c");
+       AC_DEFINE("HAVE_UODBC", 1, "ODBC support");
+       ADD_FLAG('LIBS_ODBC', 'odbc32.lib odbccp32.lib');
+}
+
+
diff --git a/ext/pcre/config.w32 b/ext/pcre/config.w32
new file mode 100644 (file)
index 0000000..88ac189
--- /dev/null
@@ -0,0 +1,13 @@
+// $Id$
+// vim:ft=javascript
+
+ARG_WITH("pcre-regex", "Perl Compatible Regular Expressions", "yes");
+
+if (PHP_PCRE_REGEX == "yes") {
+       EXTENSION("pcre", "php_pcre.c", PHP_PCRE_REGEX_SHARED,
+               "-DSUPPORT_UTF8 -DLINK_SIZE=2 -DPOSIX_MALLOC_THRESHOLD=10 -Iext/pcre/pcrelib");
+       ADD_SOURCES("ext/pcre/pcrelib", "maketables.c get.c study.c pcre.c", "pcre");
+
+       AC_DEFINE('HAVE_BUNDLED_PCRE', 1, 'Using bundled PCRE library');
+       AC_DEFINE('HAVE_PCRE', 1, 'Have PCRE library');
+}
diff --git a/ext/session/config.w32 b/ext/session/config.w32
new file mode 100644 (file)
index 0000000..fd568f3
--- /dev/null
@@ -0,0 +1,11 @@
+// $Id$
+// vim:ft=javascript
+
+ARG_ENABLE("session", "session support", "yes");
+
+if (PHP_SESSION == "yes") {
+       EXTENSION("session", "session.c mod_files.c mod_mm.c mod_user.c", false /* never shared */);
+       AC_DEFINE("HAVE_PHP_SESSION", 1, "Session support");
+}
+
+
diff --git a/ext/simplexml/config.w32 b/ext/simplexml/config.w32
new file mode 100644 (file)
index 0000000..35a29c0
--- /dev/null
@@ -0,0 +1,11 @@
+// $Id$
+// vim:ft=javascript
+
+ARG_WITH("simplexml", "Simple XML support", "yes");
+
+if (PHP_SIMPLEXML == "yes" && PHP_LIBXML == "yes") {
+       EXTENSION("simplexml", "simplexml.c");
+       AC_DEFINE("HAVE_SIMPLEXML", 1, "Simple XML support");
+}
+
+
diff --git a/ext/sqlite/config.w32 b/ext/sqlite/config.w32
new file mode 100644 (file)
index 0000000..140b8d3
--- /dev/null
@@ -0,0 +1,26 @@
+// $Id$
+// vim:ft=javascript
+
+ARG_WITH("sqlite", "SQLite support", "yes");
+
+if (PHP_SQLITE == "yes") {
+       FSO.CopyFile("ext\\sqlite\\libsqlite\\src\\sqlite.w32.h",
+               "ext\\sqlite\\libsqlite\\src\\sqlite.h");
+       
+       FSO.CopyFile("ext\\sqlite\\libsqlite\\src\\sqlite_config.w32.h",
+               "ext\\sqlite\\libsqlite\\src\\config.h");
+       
+       EXTENSION("sqlite", "sqlite.c sess_sqlite.c", null,
+               "/D PHP_SQLITE_EXPORTS /Iext/sqlite/libsqlite/src");
+       
+       ADD_SOURCES("ext/sqlite/libsqlite/src", "opcodes.c parse.c encode.c \
+               auth.c btree.c build.c delete.c expr.c func.c hash.c insert.c \
+               main.c os.c pager.c printf.c random.c select.c table.c tokenize.c \
+               update.c util.c vdbe.c attach.c btree_rb.c pragma.c vacuum.c \
+               copy.c where.c trigger.c", "sqlite");
+
+       AC_DEFINE("HAVE_SQLITE", 1, "SQLite support");
+       ADD_DEF_FILE("ext\\sqlite\\php_sqlite.def");
+}
+
+
diff --git a/ext/standard/config.w32 b/ext/standard/config.w32
new file mode 100644 (file)
index 0000000..21b062a
--- /dev/null
@@ -0,0 +1,23 @@
+// vim:ft=javascript
+// $Id$
+
+ARG_WITH("config-file-scan-dir", "Dir to check for additional php ini files", "");
+AC_DEFINE("PHP_CONFIG_FILE_SCAN_DIR", PHP_CONFIG_FILE_SCAN_DIR);
+
+ARG_WITH("config-file-path", "Where to find php.ini",
+       '(getenv("SystemRoot"))?getenv("SystemRoot"):""');
+
+AC_DEFINE("PHP_CONFIG_FILE_PATH", PHP_CONFIG_FILE_PATH, null, false);
+
+EXTENSION("standard", "array.c base64.c basic_functions.c browscap.c \
+       crc32.c crypt.c cyr_convert.c datetime.c dir.c dl.c dns.c exec.c \
+       file.c filestat.c formatted_print.c fsock.c head.c html.c image.c \
+       info.c iptc.c lcg.c link.c mail.c math.c md5.c metaphone.c microtime.c \
+       pack.c pageinfo.c parsedate.c quot_print.c rand.c reg.c soundex.c \
+       string.c scanf.c syslog.c type.c uniqid.c url.c url_scanner.c var.c \
+       versioning.c assert.c strnatcmp.c levenshtein.c incomplete_class.c \
+       url_scanner_ex.c ftp_fopen_wrapper.c http_fopen_wrapper.c \
+       php_fopen_wrapper.c credits.c css.c var_unserializer.c ftok.c sha1.c \
+       user_filters.c uuencode.c filters.c proc_open.c sunfuncs.c \
+       streamsfuncs.c http.c", false /* never shared */);
+
diff --git a/ext/tokenizer/config.w32 b/ext/tokenizer/config.w32
new file mode 100644 (file)
index 0000000..404b399
--- /dev/null
@@ -0,0 +1,11 @@
+// $Id$
+// vim:ft=javascript
+
+ARG_ENABLE("tokenizer", "tokenizer support", "yes");
+
+if (PHP_TOKENIZER == "yes") {
+       EXTENSION("tokenizer", "tokenizer.c");
+       AC_DEFINE("HAVE_TOKENIZER", 1, "Tokenizer support");
+}
+
+
diff --git a/ext/wddx/config.w32 b/ext/wddx/config.w32
new file mode 100644 (file)
index 0000000..2a70196
--- /dev/null
@@ -0,0 +1,11 @@
+// $Id$
+// vim:ft=javascript
+
+ARG_WITH("wddx", "WDDX support", "yes");
+
+if (PHP_WDDX == "yes" && PHP_LIBXML == "yes") {
+       EXTENSION("wddx", "wddx.c");
+       AC_DEFINE("HAVE_WDDX", 1, "WDDX support");
+}
+
+
diff --git a/ext/xml/config.w32 b/ext/xml/config.w32
new file mode 100644 (file)
index 0000000..29bb561
--- /dev/null
@@ -0,0 +1,11 @@
+// $Id$
+// vim:ft=javascript
+
+ARG_WITH("xml", "XML support", "yes");
+
+if (PHP_XML == "yes" && PHP_LIBXML == "yes") {
+       EXTENSION("xml", "xml.c compat.c");
+       AC_DEFINE("HAVE_XML", 1, "XML support");
+}
+
+
diff --git a/ext/zlib/config.w32 b/ext/zlib/config.w32
new file mode 100644 (file)
index 0000000..99790cd
--- /dev/null
@@ -0,0 +1,12 @@
+// $Id$
+// vim:ft=javascript
+
+ARG_ENABLE("zlib", "ZLIB support", "yes");
+
+if (PHP_ZLIB == "yes") {
+       EXTENSION("zlib", "zlib.c zlib_fopen_wrapper.c", null, "/D ZLIB_EXPORTS");
+       AC_DEFINE("HAVE_ZLIB", 1, "Tokenizer support");
+       ADD_FLAG("LIBS_ZLIB", "zlib.lib");
+}
+
+
diff --git a/sapi/apache/config.w32 b/sapi/apache/config.w32
new file mode 100644 (file)
index 0000000..9842e43
--- /dev/null
@@ -0,0 +1,39 @@
+// vim:ft=javascript
+// $Id$
+
+ARG_ENABLE('apache', 'Build Apache 1.3.x version of PHP', 'yes');
+
+ARG_WITH('apache-includes', 'Where to find Apache 1.3 headers', null);
+ARG_WITH('apache-libs', 'Where to find Apache 1.3 libraries', null);
+
+if (PHP_APACHE_INCLUDES == null) {
+       if (FSO.FileExists('C:\\Program Files\\Apache Group\\Apache\\include\\httpd.h')) {
+               PHP_APACHE_INCLUDES = "C:\\Program Files\\Apache Group\\Apache\\include";
+       } else if (FSO.FileExists(PHP_PHP_BUILD + "\\apache\\src\\include\\httpd.h")) {
+               PHP_APACHE_INCLUDES = PHP_PHP_BUILD + "\\apache\\src\\include";
+       }
+}
+
+if (!FSO.FileExists(PHP_APACHE_INCLUDES + "\\httpd.h")) {
+       ERROR("Could not find apache headers");
+}
+
+if (PHP_APACHE_LIBS == null) {
+       if (FSO.FileExists('C:\\Program Files\\Apache Group\\Apache\\libexec\\ApacheCore.lib')) {
+               PHP_APACHE_LIBS = "C:\\Program Files\\Apache Group\\Apache\\libexec";
+       } else if (FSO.FileExists(PHP_PHP_BUILD + "\\apache\\src\\corer\\ApacheCore.lib")) {
+               PHP_APACHE_LIBS = PHP_PHP_BUILD + "\\apache\\src\\corer";
+       }
+}
+
+if (!FSO.FileExists(PHP_APACHE_LIBS + "\\ApacheCore.lib")) {
+       ERROR("Could not find apache libraries");
+}
+
+
+if (PHP_APACHE == "yes") {
+       SAPI('apache', 'mod_php5.c sapi_apache.c php_apache.c',
+               'php' + PHP_VERSION + 'apache.dll',
+               '/D APACHEPHP4_EXPORTS /D APACHE_READDIR_H /I "' + PHP_APACHE_INCLUDES + '"');
+       ADD_FLAG('LIBS_APACHE', '/libpath:"' + PHP_APACHE_LIBS + '" ApacheCore.lib');
+}
diff --git a/sapi/cgi/config.w32 b/sapi/cgi/config.w32
new file mode 100644 (file)
index 0000000..d425372
--- /dev/null
@@ -0,0 +1,25 @@
+// vim:ft=javascript
+// $Id$
+
+ARG_ENABLE('cgi', 'Build CGI version of PHP', 'yes');
+ARG_ENABLE('fastcgi', 'Build FastCGI support into CGI binary', 'yes');
+ARG_ENABLE('path-info-check',
+       'If this is disabled, paths such as /info.php/test?a=b will fail to work', 'yes');
+
+ARG_ENABLE("force-cgi-redirect", "Enable the security check for internal \
+server redirects.  You should use this if you are running the CGI \
+version with Apache.", "yes");
+
+AC_DEFINE("FORCE_CGI_REDIRECT", PHP_FORCE_CGI_REDIRECT == "yes" ? 1 : 0, "CGI redirect mode");
+AC_DEFINE("ENABLE_PATHINFO_CHECK", PHP_PATH_INFO_CHECK == "yes" ? 1 : 0, "Pathinfo check");
+
+if (PHP_CGI == "yes") {
+       AC_DEFINE('PHP_FASTCGI', PHP_FASTCGI == "yes" ? 1 : 0);
+       if (PHP_FASTCGI == "yes") {
+               SAPI('cgi', 'cgi_main.c getopt.c', 'php-cgi.exe', '-Isapi/cgi/libfcgi/include /D FCGI_STATIC');
+               ADD_SOURCES('sapi/cgi/libfcgi', 'fcgi_stdio.c fcgiapp.c os_win32.c', 'cgi');
+               ADD_FLAG('LIBS_CGI', 'ws2_32.lib kernel32.lib advapi32.lib');
+       } else {
+               SAPI('cgi', 'cgi_main.c getopt.c', 'php-cgi.exe');
+       }
+}
diff --git a/sapi/cli/config.w32 b/sapi/cli/config.w32
new file mode 100644 (file)
index 0000000..9f30ad6
--- /dev/null
@@ -0,0 +1,9 @@
+// vim:ft=javascript
+// $Id$
+
+ARG_ENABLE('cli', 'Build CLI version of PHP', 'yes');
+
+if (PHP_CLI == "yes") {
+       SAPI('cli', 'getopt.c php_cli.c', 'php.exe');
+}
+
diff --git a/sapi/isapi/config.w32 b/sapi/isapi/config.w32
new file mode 100644 (file)
index 0000000..c1a9765
--- /dev/null
@@ -0,0 +1,9 @@
+// vim:ft=javascript
+// $Id$
+
+ARG_ENABLE('isapi', 'Build ISAPI version of PHP', 'yes');
+
+if (PHP_ISAPI == "yes") {
+       SAPI('isapi', 'php4isapi.c', 'php' + PHP_VERSION + 'isapi.dll', '/D PHP4ISAPI_EXPORTS');
+       ADD_FLAG('LDFLAGS_ISAPI', '/DEF:sapi\\isapi\\php4isapi.def');
+}
diff --git a/win32/build/Makefile b/win32/build/Makefile
new file mode 100644 (file)
index 0000000..666c108
--- /dev/null
@@ -0,0 +1,63 @@
+#  +----------------------------------------------------------------------+
+#  | PHP Version 5                                                        |
+#  +----------------------------------------------------------------------+
+#  | Copyright (c) 1997-2002 The PHP Group                                |
+#  +----------------------------------------------------------------------+
+#  | This source file is subject to version 3.0 of the PHP license,       |
+#  | that is bundled with this package in the file LICENSE, and is        |
+#  | available through the world-wide-web at the following url:           |
+#  | http://www.php.net/license/3_0.txt.                                  |
+#  | If you did not receive a copy of the PHP license and are unable to   |
+#  | obtain it through the world-wide-web, please send a note to          |
+#  | license@php.net so we can mail you a copy immediately.               |
+#  +----------------------------------------------------------------------+
+#  | Author: Wez Furlong <wez@thebrainroom.com>                           |
+#  +----------------------------------------------------------------------+
+#
+# $Id$
+# This is the makefile template for the win32 build
+
+CC="$(CL)"
+LD="$(LINK)"
+
+all: $(BUILD_DIR) generated_files $(EXT_TARGETS) $(SAPI_TARGETS)
+
+generated_files: Zend\zend_ini_parser.c \
+       Zend\zend_language_parser.c Zend\zend_ini_scanner.c \
+       Zend\zend_language_scanner.c \
+       $(PHPDEF)
+
+win32\phpts.def: $(PHP_DLL_DEF_SOURCES)
+       type $(PHP_DLL_DEF_SOURCES) > win32\phpts.def
+
+Zend\zend_ini_parser.c Zend\zend_ini_parser.h: Zend\zend_ini_parser.y
+       bison --output=Zend/zend_ini_parser.\ -v -d -p ini_ Zend/zend_ini_parser.y
+
+Zend\zend_language_parser.c Zend\zend_language_parser.h: Zend\zend_language_parser.y
+       bison --output=Zend/zend_language_parser.c -v -d -p zend Zend/zend_language_parser.y
+
+Zend\zend_ini_scanner.c: Zend\flex.skl Zend\zend_ini_scanner.l
+       flex -B -i -SZend/flex.skl -Pini_ -oZend/zend_ini_scanner.c Zend/zend_ini_scanner.l
+
+Zend\zend_language_scanner.c: Zend\flex.skl Zend\zend_language_scanner.l
+       flex -i -SZend/flex.skl -Pzend -oZend/zend_language_scanner.c Zend/zend_language_scanner.l
+
+$(BUILD_DIR)\$(PHPDLL): $(PHPDEF) $(PHP_GLOBAL_OBJS) $(STATIC_EXT_OBJS)
+       $(LD) /out:$(BUILD_DIR)\$(PHPDLL) $(PHP_LDFLAGS) $(LDFLAGS) $(PHP_GLOBAL_OBJS) $(STATIC_EXT_OBJS) $(STATIC_EXT_LIBS) $(LIBS)
+       
+$(BUILD_DIR)\$(PHPLIB): $(BUILD_DIR)\$(PHPDLL)
+       
+$(BUILD_DIR):
+       mkdir $(BUILD_DIR)
+       for %D in ($(BUILD_DIRS_SUB)) do mkdir %D
+
+clean:
+       for %D in ($(BUILD_DIRS_SUB)) do del /F /Q %D\*.*
+       del /F /Q $(BUILD_DIR)\*.*
+
+test:
+       %COMSPEC% /c <<test_suite_uses_lame_env_vars.bat
+set TEST_PHP_EXECUTABLE=$(BUILD_DIR)\\php.exe
+$(BUILD_DIR)\\php.exe -d open_basedir= -d safe_mode=0 -d output_buffering=0 run-tests.php $(TESTS)
+<<NOKEEP
+       
diff --git a/win32/build/buildconf.js b/win32/build/buildconf.js
new file mode 100644 (file)
index 0000000..38b33ba
--- /dev/null
@@ -0,0 +1,81 @@
+// $Id: buildconf.js,v 1.1 2003-12-02 23:17:04 wez Exp $
+/*
+  +----------------------------------------------------------------------+
+  | PHP Version 5                                                        |
+  +----------------------------------------------------------------------+
+  | Copyright (c) 1997-2003 The PHP Group                                |
+  +----------------------------------------------------------------------+
+  | This source file is subject to version 3.0 of the PHP license,       |
+  | that is bundled with this package in the file LICENSE, and is        |
+  | available through the world-wide-web at the following url:           |
+  | http://www.php.net/license/3_0.txt.                                  |
+  | If you did not receive a copy of the PHP license and are unable to   |
+  | obtain it through the world-wide-web, please send a note to          |
+  | license@php.net so we can mail you a copy immediately.               |
+  +----------------------------------------------------------------------+
+  | Author: Wez Furlong <wez@thebrainroom.com>                           |
+  +----------------------------------------------------------------------+
+*/
+
+/* $Id: buildconf.js,v 1.1 2003-12-02 23:17:04 wez Exp $ */
+// This generates a configure script for win32 build
+
+WScript.StdOut.WriteLine("Rebuilding configure.js");
+var FSO = WScript.CreateObject("Scripting.FileSystemObject");
+var C = FSO.CreateTextFile("configure.js", true);
+
+var modules = "";
+
+function file_get_contents(filename)
+{
+       var F = FSO.OpenTextFile(filename, 1);
+       var t = F.ReadAll();
+       F.Close();
+       return t;
+}
+
+function find_config_w32(dirname)
+{
+       var f = FSO.GetFolder(dirname);
+       var     fc = new Enumerator(f.SubFolders);
+       var c;
+       for (; !fc.atEnd(); fc.moveNext())
+       {
+               c = FSO.BuildPath(fc.item(), "config.w32");
+               if (FSO.FileExists(c)) {
+                       //WScript.StdOut.WriteLine(c);
+                       modules += file_get_contents(c);
+               }
+       }
+}
+
+// Write the head of the configure script
+C.WriteLine("/* This file automatically generated from win32/build/confutils.js */");
+C.Write(file_get_contents("win32/build/confutils.js"));
+
+// Pull in code from sapi and extensions
+modules = file_get_contents("win32/build/config.w32");
+find_config_w32("sapi");
+find_config_w32("ext");
+
+// Look for ARG_ENABLE or ARG_WITH calls
+re = new RegExp("(ARG_(ENABLE|WITH)\([^;]+\);)", "gm");
+calls = modules.match(re);
+for (i = 0; i < calls.length; i++) {
+       item = calls[i];
+       C.WriteLine(item);
+}
+
+C.WriteBlankLines(1);
+C.WriteLine("conf_process_args();");
+C.WriteBlankLines(1);
+
+// Comment out the calls from their original positions
+modules = modules.replace(re, "/* $1 */");
+C.Write(modules);
+
+C.WriteBlankLines(1);
+C.Write(file_get_contents("win32/build/configure.tail"));
+
+WScript.StdOut.WriteLine("Now run 'cscript /nologo configure.js --help'");
+
diff --git a/win32/build/config.w32 b/win32/build/config.w32
new file mode 100644 (file)
index 0000000..7a36040
--- /dev/null
@@ -0,0 +1,133 @@
+// vim:ft=javascript
+// $Id$
+// "Master" config file; think of it as a configure.in
+// equivalent.
+
+PATH_PROG('cl');
+PATH_PROG('link');
+PATH_PROG('nmake');
+PATH_PROG('make');
+
+// one-shot build optimizes build by asking compiler to build
+// several objects at once, reducing overhead of starting new
+// compiler processes.
+ARG_ENABLE('one-shot', 'optimize for fast one-shot build', 'no');
+
+ARG_ENABLE('debug', 'Compile with debugging symbols', "no");
+ARG_ENABLE('zts', 'Thread safety', 'yes');
+
+// Configures the hard-coded installation dir
+ARG_ENABLE('prefix', 'where PHP will be installed', 'C:\\php5');
+
+DEFINE("BASE_INCLUDES", "/I . /I main /I regex /I Zend /I TSRM \
+/I $(PHP_BUILD)\\include");
+
+// CFLAGS for building the PHP dll
+DEFINE("CFLAGS_PHP", "/D _USRDLL /D PHP4DLLTS_EXPORTS /D PHP_EXPORTS \
+/D LIBZEND_EXPORTS /D TSRM_EXPORTS /D SAPI_EXPORTS /D _WIN32_WINNT=0x400");
+
+// General CFLAGS for building objects
+DEFINE("CFLAGS", "/nologo /YX /FD $(BASE_INCLUDES) /D _WINDOWS \
+/D ZEND_WIN32=1 /D PHP_WIN32=1 /D WIN32 /D _MBCS");
+
+// General link flags
+DEFINE("LDFLAGS", "/nologo /libpath:$(PHP_BUILD)\\lib");
+
+// General DLL link flags
+DEFINE("DLL_LDFLAGS", "/dll");
+
+// PHP DLL link flags
+DEFINE("PHP_LDFLAGS", "$(DLL_LDFLAGS)");
+
+// General libs
+DEFINE("LIBS", "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib \
+advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib \
+ws2_32.lib urlmon.lib resolv.lib");
+
+// Set some debug/release specific options
+if (PHP_DEBUG == "yes") {
+       ADD_FLAG("CFLAGS", "/LDd /MDd /Gm /ZI /Od /GZ /D _DEBUG /D ZEND_DEBUG=1");
+       ADD_FLAG("LDFLAGS", "/debug");
+       // Avoid problems when linking to release libraries that use the release
+       // version of the libc
+       ADD_FLAG("PHP_LDFLAGS", "/nodefaultlib:msvcrt");
+} else {
+       // Equivalent to Release_TSInline build -> best optimization
+       ADD_FLAG("CFLAGS", "/LD /MD /W3 /O2 /D NDebug /D NDEBUG \
+/D ZEND_WIN32_FORCE_INLINE /GB /GF /GS /D ZEND_DEBUG=0");
+}
+
+if (PHP_ZTS == "yes") {
+       ADD_FLAG("CFLAGS", "/D ZTS=1");
+}
+       
+// we want msvcrt in the PHP DLL
+ADD_FLAG("PHP_LDFLAGS", "/nodefaultlib:libcmt");
+
+// set up the build dir and DLL name
+if (PHP_DEBUG == "yes" && PHP_ZTS == "yes") {
+       DEFINE("BUILD_DIR", "Debug_TS");
+       DEFINE("PHPDLL", "php5ts_debug.dll");
+       DEFINE("PHPLIB", "php5ts_debug.lib");
+} else if (PHP_DEBUG == "yes" && PHP_ZTS == "no") {
+       DEFINE("BUILD_DIR", "Debug");
+       DEFINE("PHPDLL", "php5_debug.dll");
+       DEFINE("PHPLIB", "php5_debug.lib");
+} else if (PHP_DEBUG == "no" && PHP_ZTS == "yes") {
+       DEFINE("BUILD_DIR", "Release_TS");
+       DEFINE("PHPDLL", "php5ts.dll");
+       DEFINE("PHPLIB", "php5ts.lib");
+} else if (PHP_DEBUG == "no" && PHP_ZTS == "no") {
+       DEFINE("BUILD_DIR", "Release");
+       DEFINE("PHPDLL", "php5.dll");
+       DEFINE("PHPLIB", "php5.lib");
+}
+
+// Find the php_build dir - it contains headers and libraries
+// that we need
+ARG_WITH('php-build', 'where the php_build dir can be found', 'no');
+
+if (PHP_PHP_BUILD == "no") {
+       if (FSO.FolderExists("..\\php_build")) {
+               PHP_PHP_BUILD = "..\\php_build";
+       }
+}
+
+if (!FSO.FolderExists(PHP_PHP_BUILD)) {
+       ERROR("Could not find the php_build dir; please specify it\r\n\
+using the --with-php-build option to configure");
+}
+
+DEFINE("PHP_BUILD", PHP_PHP_BUILD);
+
+STDOUT.WriteBlankLines(1);
+STDOUT.WriteLine("Build dir: " + get_define('BUILD_DIR'));
+STDOUT.WriteLine("PHP Core:  " + get_define('PHPDLL') + " and " + get_define('PHPLIB'));
+
+ADD_SOURCES("TSRM", "TSRM.c tsrm_strtok_r.c tsrm_virtual_cwd.c tsrm_win32.c");
+ADD_SOURCES("Zend", "zend_language_parser.c zend_language_scanner.c \
+       zend_ini_parser.c zend_ini_scanner.c zend_alloc.c zend_compile.c \
+       zend_constants.c zend_dynamic_array.c zend_execute_API.c zend_highlight.c \
+       zend_llist.c zend_opcode.c zend_operators.c zend_ptr_stack.c \
+       zend_stack.c zend_variables.c zend.c zend_API.c zend_extensions.c \
+       zend_hash.c zend_list.c zend_indent.c zend_builtin_functions.c \
+       zend_sprintf.c zend_ini.c zend_qsort.c zend_multibyte.c zend_ts_hash.c \
+       zend_stream.c zend_iterators.c zend_interfaces.c zend_objects.c \
+       zend_object_handlers.c zend_objects_API.c \
+       zend_mm.c zend_default_classes.c zend_reflection_api.c zend_execute.c");
+
+ADD_SOURCES("main", "main.c snprintf.c spprintf.c safe_mode.c fopen_wrappers.c \
+       php_scandir.c php_ini.c SAPI.c rfc1867.c php_content_types.c strlcpy.c \
+       strlcat.c mergesort.c reentrancy.c php_variables.c php_ticks.c network.c \
+       php_open_temporary_file.c php_logos.c output.c internal_functions.c");
+
+ADD_SOURCES("main/streams", "streams.c cast.c memory.c filter.c plain_wrapper.c \
+       userspace.c transports.c xp_socket.c mmap.c");
+
+ADD_SOURCES("win32", "crypt_win32.c flock.c glob.c md5crypt.c pwd.c readdir.c \
+       registry.c select.c sendmail.c time.c wfile.c winutil.c wsyslog.c");
+
+ADD_SOURCES("regex", "regcomp.c regerror.c regexec.c regfree.c");
+
+STDOUT.WriteBlankLines(1);
+
diff --git a/win32/build/config.w32.h.in b/win32/build/config.w32.h.in
new file mode 100644 (file)
index 0000000..02607f1
--- /dev/null
@@ -0,0 +1,140 @@
+/*
+       Build Configuration Template for Win32.
+       $Id$
+*/
+
+/* Default PHP / PEAR directories */
+#define CONFIGURATION_FILE_PATH "php.ini"
+#define PEAR_INSTALLDIR "@PREFIX@\\pear"
+#define PHP_BINDIR "@PREFIX@"
+#define PHP_DATADIR "@PREFIX@"
+#define PHP_EXTENSION_DIR "@PREFIX@"
+#define PHP_INCLUDE_PATH       ".;@PREFIX@\\pear"
+#define PHP_LIBDIR "@PREFIX@"
+#define PHP_LOCALSTATEDIR "@PREFIX@"
+#define PHP_PREFIX "@PREFIX@"
+#define PHP_SYSCONFDIR "@PREFIX@"
+
+/* Enable / Disable crypt() function (default: enabled) */
+#define HAVE_CRYPT 1
+#define PHP_STD_DES_CRYPT 1
+#define PHP_EXT_DES_CRYPT 0
+#define PHP_MD5_CRYPT 1
+#define PHP_BLOWFISH_CRYPT 0
+
+/* PHP Runtime Configuration */
+#define PHP_URL_FOPEN 1
+#define PHP_SAFE_MODE 0
+#define MAGIC_QUOTES 0
+#define USE_CONFIG_FILE 1
+#define DEFAULT_SHORT_OPEN_TAG "1"
+#define ENABLE_PATHINFO_CHECK 1
+
+/* Platform-Specific Configuration. Should not be changed. */
+#define PHP_SIGCHILD 0
+#define HAVE_LIBBIND 1
+#define HAVE_GETSERVBYNAME 1
+#define HAVE_GETSERVBYPORT 1
+#define HAVE_GETPROTOBYNAME 1
+#define HAVE_GETPROTOBYNUMBER 1
+#define STDIN_FILENO 0
+#define STDOUT_FILENO 1
+#define STDERR_FILENO 2
+#define HAVE_ERRMSG_H 0
+#undef HAVE_ADABAS
+#undef HAVE_SOLID
+#undef HAVE_LINK
+#undef HAVE_SYMLINK
+
+/* its in win32/time.c */
+#define HAVE_USLEEP 1
+
+#define HAVE_GETCWD 1
+#define HAVE_POSIX_READDIR_R 1
+#define NEED_ISBLANK 1
+#define DISCARD_PATH 0
+#undef HAVE_SETITIMER
+#undef HAVE_IODBC
+#define HAVE_LIBDL 1
+#define HAVE_SENDMAIL 1
+#define HAVE_GETTIMEOFDAY 1
+#define HAVE_PUTENV 1
+#define HAVE_LIMITS_H 1
+#define HAVE_TZSET 1
+#define HAVE_TZNAME 1
+#undef HAVE_FLOCK
+#define HAVE_ALLOCA 1
+#undef HAVE_SYS_TIME_H
+#define HAVE_SIGNAL_H 1
+#undef HAVE_ST_BLKSIZE
+#undef HAVE_ST_BLOCKS
+#define HAVE_ST_RDEV 1
+#define HAVE_UTIME_NULL 1
+#define HAVE_VPRINTF 1
+#define STDC_HEADERS 1
+#define REGEX 1
+#define HSREGEX 1
+#define HAVE_GCVT 1
+#define HAVE_GETLOGIN 1
+#define HAVE_GETTIMEOFDAY 1
+#define HAVE_MEMCPY 1
+#define HAVE_MEMMOVE 1
+#define HAVE_PUTENV 1
+#define HAVE_REGCOMP 1
+#define HAVE_SETLOCALE 1
+#define HAVE_LOCALECONV 1
+#define HAVE_LOCALE_H 1
+#ifndef HAVE_LIBBIND
+# define HAVE_SETVBUF 1
+#endif
+#define HAVE_SHUTDOWN 1
+#define HAVE_SNPRINTF 1
+#define HAVE_VSNPRINTF 1
+#define HAVE_STRCASECMP 1
+#define HAVE_STRDUP 1
+#define HAVE_STRERROR 1
+#define HAVE_STRSTR 1
+#define HAVE_TEMPNAM 1
+#define HAVE_UTIME 1
+#undef HAVE_DIRENT_H
+#define HAVE_ASSERT_H 1
+#define HAVE_FCNTL_H 1
+#define HAVE_GRP_H 0
+#define HAVE_PWD_H 1
+#define HAVE_STRING_H 1
+#undef HAVE_SYS_FILE_H
+#undef HAVE_SYS_SOCKET_H
+#undef HAVE_SYS_WAIT_H
+#define HAVE_SYSLOG_H 1
+#undef HAVE_UNISTD_H
+#define HAVE_LIBDL 1
+#define HAVE_LIBM 1
+#define HAVE_CUSERID 0
+#undef HAVE_RINT
+#define HAVE_STRFTIME 1
+/* int and long are stll 32bit in 64bit compiles */
+#define SIZEOF_INT 4
+#define SIZEOF_LONG 4
+/* MSVC.6/NET don't allow 'long long' or know 'intmax_t' */
+#define SIZEOF_LONG_LONG_INT 0
+#define SIZEOF_LONG_LONG 0
+#define SIZEOF_INTMAX_T 0
+#define ssize_t SSIZE_T
+#ifdef _WIN64
+# define SIZEOF_SIZE_T 8
+# define SIZEOF_PTRDIFF_T 8
+#else
+# define SIZEOF_SIZE_T 4
+# define SIZEOF_PTRDIFF_T 4
+#endif
+#define HAVE_GLOB
+#define PHP_SHLIB_SUFFIX "dll"
+#define HAVE_SQLDATASOURCES
+
+/* Win32 supports strcoll */
+#define HAVE_STRCOLL 1
+
+/* Win32 support proc_open */
+#define PHP_CAN_SUPPORT_PROC_OPEN 1
+
+#define HAVE_MBLEN
diff --git a/win32/build/configure.tail b/win32/build/configure.tail
new file mode 100644 (file)
index 0000000..e74287d
--- /dev/null
@@ -0,0 +1,6 @@
+// vim:ft=javascript
+// $Id$
+// tail end of configure
+
+generate_files();
+
diff --git a/win32/build/confutils.js b/win32/build/confutils.js
new file mode 100644 (file)
index 0000000..9bfa463
--- /dev/null
@@ -0,0 +1,651 @@
+// Utils for configure script
+/*
+  +----------------------------------------------------------------------+
+  | PHP Version 5                                                        |
+  +----------------------------------------------------------------------+
+  | Copyright (c) 1997-2003 The PHP Group                                |
+  +----------------------------------------------------------------------+
+  | This source file is subject to version 3.0 of the PHP license,       |
+  | that is bundled with this package in the file LICENSE, and is        |
+  | available through the world-wide-web at the following url:           |
+  | http://www.php.net/license/3_0.txt.                                  |
+  | If you did not receive a copy of the PHP license and are unable to   |
+  | obtain it through the world-wide-web, please send a note to          |
+  | license@php.net so we can mail you a copy immediately.               |
+  +----------------------------------------------------------------------+
+  | Author: Wez Furlong <wez@thebrainroom.com>                           |
+  +----------------------------------------------------------------------+
+*/
+
+// $Id: confutils.js,v 1.1 2003-12-02 23:17:04 wez Exp $
+
+var STDOUT = WScript.StdOut;
+var STDERR = WScript.StdErr;
+var WshShell = WScript.CreateObject("WScript.Shell");
+var FSO = WScript.CreateObject("Scripting.FileSystemObject");
+var MFO = null;
+
+var PHP_VERSION = 5;
+
+configure_args = new Array();
+configure_subst = WScript.CreateObject("Scripting.Dictionary");
+
+configure_hdr = WScript.CreateObject("Scripting.Dictionary");
+build_dirs = new Array();
+
+extension_include_code = "";
+extension_module_ptrs = "";
+
+function ConfigureArg(type, optname, helptext, defval)
+{
+       var opptype = type == "enable" ? "disable" : "without";
+
+       if (defval == "yes") {
+               this.arg = "--" + opptype + "-" + optname;
+               this.imparg = "--" + type + "-" + optname;
+       } else {
+               this.arg = "--" + type + "-" + optname;
+               this.imparg = "--" + opptype + "-" + optname;
+       }
+       
+       this.optname = optname;
+       this.helptext = helptext;
+       this.defval = defval;
+       this.symval = optname.toUpperCase().replace(new RegExp("-", "g"), "_");
+       this.seen = false;
+       this.argval = defval;
+}
+
+function ARG_WITH(optname, helptext, defval)
+{
+       configure_args[configure_args.length] = new ConfigureArg("with", optname, helptext, defval);
+}
+
+function ARG_ENABLE(optname, helptext, defval)
+{
+       configure_args[configure_args.length] = new ConfigureArg("enable", optname, helptext, defval);
+}
+
+function analyze_arg(argval)
+{
+       var ret = new Array();
+       var shared = false;
+
+       if (argval == "shared") {
+               shared = true;
+               argval = "yes";
+       } else if (argval == null) {
+               /* nothing */
+       } else if (argval.match(new RegExp("^shared,(.*)"))) {
+               shared = true;
+               argval = $1;
+       }
+
+       ret[0] = shared;
+       ret[1] = argval;
+       return ret;
+}
+
+function word_wrap_and_indent(indent, text, line_suffix, indent_char)
+{
+       var words = text.split(new RegExp("\\s+", "g"));
+       var i = 0;
+       var ret_text = "";
+       var this_line = "";
+       var t;
+       var space = "";
+       var lines = 0;
+
+       if (line_suffix == null) {
+               line_suffix = "";
+       }
+
+       if (indent_char == null) {
+               indent_char = " ";
+       }
+
+       for (i = 0; i < indent; i++) {
+               space += indent_char;
+       }
+       
+       for (i = 0; i < words.length; i++) {
+               if (this_line.length) {
+                       t = this_line + " " + words[i];
+               } else {
+                       t = words[i];
+               }
+
+               if (t.length + indent > 78) {
+                       if (lines++) {
+                               ret_text += space;
+                       }
+                       ret_text += this_line + line_suffix + "\r\n";
+                       this_line = "";
+               }
+
+               if (this_line.length) {
+                       this_line += " " + words[i];
+               } else {
+                       this_line = words[i];
+               }
+       }
+
+       if (this_line.length) {
+               if (lines)
+                       ret_text += space;
+               ret_text += this_line;
+       }
+
+       return ret_text;
+}
+
+function conf_process_args()
+{
+       var i, j;
+       var configure_help_mode = false;
+       var analyzed = false;
+       var nice = "cscript /nologo configure.js ";
+       
+       args = WScript.Arguments;
+       for (i = 0; i < args.length; i++) {
+               arg = args(i);
+               nice += ' "' + arg + '"';
+               if (arg == "--help") {
+                       configure_help_mode = true;
+                       break;
+               }
+               // If it is --foo=bar, split on the equals sign
+               arg = arg.split("=", 2);
+               argname = arg[0];
+               if (arg.length > 1) {
+                       argval = arg[1];
+               } else {
+                       argval = null;
+               }
+
+               // Find the arg
+               found = false;
+               for (j = 0; j < configure_args.length; j++) {
+                       if (argname == configure_args[j].imparg || argname == configure_args[j].arg) {
+                               found = true;
+
+                               arg = configure_args[j];
+                               arg.seen = true;
+
+                               analyzed = analyze_arg(argval);
+                               shared = analyzed[0];
+                               argval = analyzed[1];
+
+                               if (argname == arg.imparg) {
+                                       /* we matched the implicit, or default arg */
+                                       if (argval == null) {
+                                               argval = arg.defval;
+                                       }
+                               } else {
+                                       /* we matched the non-default arg */
+                                       if (argval == null) {
+                                               argval = arg.defval == "no" ? "yes" : "no";
+                                       }
+                               }
+                               
+                               arg.argval = argval;
+                               eval("PHP_" + arg.symval + " = argval;");
+                               eval("PHP_" + arg.symval + "_SHARED = shared;");
+                               break;
+                       }
+               }
+               if (!found) {
+                       STDERR.WriteLine("Unknown option " + argname + "; please try configure.js --help for a list of valid options");
+                       WScript.Quit(2);
+               }
+       }
+
+       if (configure_help_mode) {
+               // Measure width to pretty-print the output
+               max_width = 0;
+               for (i = 0; i < configure_args.length; i++) {
+                       arg = configure_args[i];
+                       if (arg.arg.length > max_width)
+                               max_width = arg.arg.length;
+               }
+
+               for (i = 0; i < configure_args.length; i++) {
+                       arg = configure_args[i];
+
+                       n = max_width - arg.arg.length;
+                       pad = "   ";
+                       for (j = 0; j < n; j++) {
+                               pad += " ";
+                       }
+                       STDOUT.WriteLine("  " + arg.arg + pad + word_wrap_and_indent(max_width + 5, arg.helptext));
+               }
+               WScript.Quit(1);
+       }
+
+       // Now set any defaults we might have missed out earlier
+       for (i = 0; i < configure_args.length; i++) {
+               arg = configure_args[i];
+               if (arg.seen)
+                       continue;
+               analyzed = analyze_arg(arg.defval);
+               shared = analyzed[0];
+               argval = analyzed[1];
+               eval("PHP_" + arg.symval + " = argval;");
+               eval("PHP_" + arg.symval + "_SHARED = shared;");
+       }
+
+       MFO = FSO.CreateTextFile("Makefile.objects", true);
+
+       STDOUT.WriteLine("Saving configure options to config.nice.bat");
+       var nicefile = FSO.CreateTextFile("config.nice.bat", true);
+       nicefile.WriteLine(nice);
+       nicefile.Close();
+
+       AC_DEFINE('CONFIGURE_COMMAND', nice);
+}
+
+function DEFINE(name, value)
+{
+       if (configure_subst.Exists(name)) {
+               configure_subst.Remove(name);
+       }
+       configure_subst.Add(name, value);
+}
+
+function PATH_PROG(progname, def, additional_paths)
+{
+       var i;
+       var found = false;
+       var p = def;
+       var exe;
+
+       exe = progname + ".exe";
+       STDOUT.Write("Checking for " + progname + " ... ");
+
+       if (additional_paths != null) {
+               for (i = 0; i < additional_paths.length; i++) {
+                       p = FSO.BuildPath(additional_paths[i], exe);
+                       if (FSO.FileExists(p)) {
+                               found = true;
+                               break;
+                       }
+               }
+       }
+
+       if (!found) {
+               path = WshShell.Environment("Process").Item("PATH");
+               path = path.split(";");
+               for (i = 0; i < path.length; i++) {
+                       p = FSO.BuildPath(path[i], exe);
+                       if (FSO.FileExists(p)) {
+                               // If we find it in the PATH, don't bother
+                               // making it fully qualified
+                               found = true;
+                               p = exe;
+                               break;
+                       }
+               }
+       }
+       if (!found) {
+               p = def;
+       }
+       if (p == null) {
+               STDOUT.WriteLine(" <not found>");
+       } else {
+               STDOUT.WriteLine(p);
+       }
+       DEFINE(progname.toUpperCase(), p);
+       return p;
+}
+
+function SAPI(sapiname, file_list, makefiletarget, cflags)
+{
+       var SAPI = sapiname.toUpperCase();
+       var ldflags;
+
+       STDOUT.WriteLine("Enabling sapi/" + sapiname);
+
+       MFO.WriteBlankLines(1);
+       MFO.WriteLine("# objects for SAPI " + sapiname);
+       MFO.WriteBlankLines(1);
+
+       if (cflags) {
+               ADD_FLAG('CFLAGS_' + SAPI, cflags);
+       }
+
+       ADD_SOURCES("sapi/" + sapiname, file_list, sapiname);
+       MFO.WriteBlankLines(1);
+       MFO.WriteLine("# SAPI " + sapiname);
+       MFO.WriteBlankLines(1);
+       MFO.WriteLine(makefiletarget + ": $(BUILD_DIR)\\" + makefiletarget);
+       MFO.WriteLine("\t@echo SAPI " + sapiname + " build complete");
+       MFO.WriteLine("$(BUILD_DIR)\\" + makefiletarget + ": $(" + SAPI + "_GLOBAL_OBJS) $(BUILD_DIR)\\$(PHPLIB)");
+
+       if (makefiletarget.match(new RegExp("\\.dll$"))) {
+               ldflags = "/dll $(LDFLAGS)";
+       } else {
+               ldflags = "$(LDFLAGS)";
+       }
+       
+       MFO.WriteLine("\t$(LD) /nologo /out:$(BUILD_DIR)\\" + makefiletarget + " " + ldflags + " $(" + SAPI + "_GLOBAL_OBJS) $(BUILD_DIR)\\$(PHPLIB) $(LDFLAGS_" + SAPI + ") $(LIBS_" + SAPI + ")");
+
+       ADD_FLAG("SAPI_TARGETS", makefiletarget);
+       MFO.WriteBlankLines(1);
+}
+
+function file_get_contents(filename)
+{
+       var f, c;
+       f = FSO.OpenTextFile(filename, 1);
+       c = f.ReadAll();
+       f.Close();
+       return c;
+}
+
+function EXTENSION(extname, file_list, shared, cflags)
+{
+       var objs = null;
+       var EXT = extname.toUpperCase();
+       var dllname = false;
+
+       if (shared == null) {
+               eval("shared = PHP_" + EXT + "_SHARED;");
+       }
+       if (cflags == null) {
+               cflags = "";
+       }
+
+       if (shared) {
+               STDOUT.WriteLine("Enabling ext/" + extname + " [shared]");
+               cflags = "/D COMPILE_DL_" + EXT + " /D " + EXT + "_EXPORTS=1 " + cflags;
+               ADD_FLAG("CFLAGS_PHP", "/D COMPILE_DL_" + EXT);
+       } else {
+               STDOUT.WriteLine("Enabling ext/" + extname);
+       }
+
+       MFO.WriteBlankLines(1);
+       MFO.WriteLine("# objects for EXT " + extname);
+       MFO.WriteBlankLines(1);
+
+
+       ADD_SOURCES("ext/" + extname, file_list, extname);
+       
+       MFO.WriteBlankLines(1);
+
+       if (shared) {
+               dllname = "php_" + extname + ".dll";
+               MFO.WriteLine("$(BUILD_DIR)\\" + dllname + ": $(" + EXT + "_GLOBAL_OBJS) $(BUILD_DIR)\\$(PHPLIB)");
+               MFO.WriteLine("\t$(LD) /out:$(BUILD_DIR)\\" + dllname + " $(DLL_LDFLAGS) $(LDFLAGS) $(" + EXT + "_LDFLAGS) $(" + EXT + "_GLOBAL_OBJS) $(BUILD_DIR)\\$(PHPLIB) $(LIBS_" + EXT + ") $(LIBS)");
+               MFO.WriteBlankLines(1);
+
+               ADD_FLAG("EXT_TARGETS", dllname);
+               MFO.WriteLine(dllname + ": $(BUILD_DIR)\\" + dllname);
+               MFO.WriteLine("\t@echo EXT " + extname + " build complete");
+               MFO.WriteBlankLines(1);
+       } else {
+               ADD_FLAG("STATIC_EXT_OBJS", "$(" + EXT + "_GLOBAL_OBJS)");
+               ADD_FLAG("STATIC_EXT_LIBS", "$(LIBS_" + EXT + ")");
+               ADD_FLAG("CFLAGS_" + EXT, "$(CFLAGS_PHP)");
+
+               /* find the header that declars the module pointer,
+                * so we can include it in internal_functions.c */
+               var ext_dir = FSO.GetFolder("ext/" + extname);
+               var fc = new Enumerator(ext_dir.Files);
+               var re = /\.h$/;
+               var s, c;
+               for (; !fc.atEnd(); fc.moveNext()) {
+                       s = fc.item() + "";
+                       if (s.match(re)) {
+                               c = file_get_contents(s);
+                               if (c.match("phpext_")) {
+                                       extension_include_code += '#include "ext/' + extname + '/' + FSO.GetFileName(s) + '"\r\n';
+                               }
+                       }
+               }
+       
+               extension_module_ptrs += '\tphpext_' + extname + '_ptr,\r\n';
+
+               cflags = "$(CFLAGS_PHP) " + cflags;
+       }
+       ADD_FLAG("CFLAGS_" + EXT, cflags);
+}
+
+function ADD_SOURCES(dir, file_list, target)
+{
+       var i;
+       var tv;
+       var src, obj, sym, flags;
+
+       if (target == null) {
+               target = "php";
+       }
+
+       sym = target.toUpperCase() + "_GLOBAL_OBJS";
+       flags = "CFLAGS_" + target.toUpperCase();
+
+       if (configure_subst.Exists(sym)) {
+               tv = configure_subst.Item(sym);
+       } else {
+               tv = "";
+       }
+
+       file_list = file_list.split(new RegExp("\\s+"));
+
+       var re = new RegExp("\.[a-z0-9A-Z]+$");
+
+       dir = dir.replace(new RegExp("/", "g"), "\\");
+
+       var objs_line = "";
+       var srcs_line = "";
+
+       var sub_build = "$(BUILD_DIR)\\";
+
+       if (target != "php") {
+               build_dirs[build_dirs.length] = target;
+               sub_build += target + "\\";
+       }
+       DEFINE("CFLAGS_BD_" + target.toUpperCase(), "/Fo" + sub_build + " /Fd" + sub_build + " /Fp" + sub_build + " /FR" + sub_build + " ");
+
+       for (i in file_list) {
+               src = file_list[i];
+               obj = src.replace(re, ".obj");
+               tv += " " + sub_build + obj;
+
+               if (PHP_ONE_SHOT == "yes") {
+                       if (i > 0) {
+                               objs_line += " " + sub_build + obj;     
+                               srcs_line += " " + dir + "\\" + src;
+                       } else {
+                               objs_line = sub_build + obj;    
+                               srcs_line = dir + "\\" + src;
+                       }
+               } else {
+                       MFO.WriteLine(sub_build + obj + ": " + dir + "\\" + src);
+                       MFO.WriteLine("\t$(CC) $(CFLAGS) $(" + flags + ") $(CFLAGS_BD_" + target.toUpperCase() + ") -c " + dir + "\\" + src + " -o " + sub_build + obj);
+               }
+       }
+
+       if (PHP_ONE_SHOT == "yes") {
+               MFO.WriteLine(objs_line + ": " + srcs_line);
+               MFO.WriteLine("\t$(CC) $(CFLAGS) $(" + flags + ") $(CFLAGS_BD_" + target.toUpperCase() + ") -c " + srcs_line);
+       }
+
+       DEFINE(sym, tv);
+}
+
+function generate_internal_functions()
+{
+       var infile, outfile;
+       var indata;
+
+       STDOUT.WriteLine("Generating main/internal_functions.c");
+       
+       infile = FSO.OpenTextFile(WshShell.CurrentDirectory + "/main/internal_functions.c.in", 1);
+       indata = infile.ReadAll();
+       infile.Close();
+       
+       outfile = FSO.CreateTextFile(WshShell.CurrentDirectory + "/main/internal_functions.c", true);
+
+       indata = indata.replace("@EXT_INCLUDE_CODE@", extension_include_code);
+       indata = indata.replace("@EXT_MODULE_PTRS@", extension_module_ptrs);
+
+       outfile.Write(indata);
+       outfile.Close();
+}
+
+function generate_files()
+{
+       var i, dir, bd, last;
+
+       STDOUT.WriteBlankLines(1);
+       STDOUT.WriteLine("Creating build dirs...");
+       dir = get_define("BUILD_DIR");
+       build_dirs.sort();
+       last = null;
+       for (i = 0; i < build_dirs.length; i++) {
+               bd = FSO.BuildPath(dir, build_dirs[i]);
+               if (bd == last) {
+                       continue;
+               }
+               last = bd;
+               ADD_FLAG("BUILD_DIRS_SUB", bd);
+               if (!FSO.FolderExists(bd)) {
+                       FSO.CreateFolder(bd);
+               }
+       }
+               
+       STDOUT.WriteLine("Generating files...");
+       generate_makefile();
+       generate_internal_functions();
+       generate_config_h();
+
+
+       STDOUT.WriteLine("Done.");
+       STDOUT.WriteBlankLines(1);
+       STDOUT.WriteLine("Type 'nmake' to build PHP");
+}
+
+function generate_config_h()
+{
+       var infile, outfile;
+       var indata;
+       var prefix;
+
+       prefix = PHP_PREFIX.replace("\\", "\\\\");
+
+       STDOUT.WriteLine("Generating main/config.w32.h");
+       
+       infile = FSO.OpenTextFile(WshShell.CurrentDirectory + "/win32/build/config.w32.h.in", 1);
+       indata = infile.ReadAll();
+       infile.Close();
+       
+       outfile = FSO.CreateTextFile(WshShell.CurrentDirectory + "/main/config.w32.h", true);
+
+       indata = indata.replace(new RegExp("@PREFIX@", "g"), prefix);
+       outfile.Write(indata);
+
+       var keys = (new VBArray(configure_hdr.Keys())).toArray();
+       var i;
+       var item;
+
+       outfile.WriteBlankLines(1);
+       outfile.WriteLine("/* values determined by configure.js */");
+
+       for (i in keys) {
+               item = configure_hdr.Item(keys[i]);
+               outfile.WriteBlankLines(1);
+               outfile.WriteLine("/* " + item[1] + " */");
+               outfile.WriteLine("#define " + keys[i] + " " + item[0]);
+       }
+       
+       outfile.Close();
+}
+
+function generate_makefile()
+{
+       STDOUT.WriteLine("Generating Makefile");
+       var MF = FSO.CreateTextFile("Makefile", true);
+
+       MF.WriteLine("# Generated by configure.js");
+
+       /* spit out variable definitions */
+       var keys = (new VBArray(configure_subst.Keys())).toArray();
+       var i;
+
+       for (i in keys) {
+               // The trailing space is needed to prevent the trailing backslash
+               // that is part of the build dir flags (CFLAGS_BD_XXX) from being
+               // seen as a line continuation character
+               MF.WriteLine(keys[i] + "=" + word_wrap_and_indent(1,
+                       configure_subst.Item(keys[i]), ' \\', '\t') + " ");
+               MF.WriteBlankLines(1);
+       }
+
+       MF.WriteBlankLines(1);
+
+       var TF = FSO.OpenTextFile("win32/build/Makefile", 1);
+       MF.Write(TF.ReadAll());
+       TF.Close();
+
+       MF.WriteBlankLines(2);
+
+       MFO.Close();
+       TF = FSO.OpenTextFile("Makefile.objects", 1);
+       MF.Write(TF.ReadAll());
+       TF.Close();
+
+       MF.Close();     
+}
+
+function ADD_FLAG(name, flags, target)
+{
+       if (target != null) {
+               name = target.toUpperCase() + "_" + name;
+       }
+       if (configure_subst.Exists(name)) {
+               flags = configure_subst.Item(name) + " " + flags;
+               configure_subst.Remove(name);
+       }
+       configure_subst.Add(name, flags);
+}
+
+function get_define(name)
+{
+       return configure_subst.Item(name);
+}
+
+// Add a .def to the core to export symbols
+function ADD_DEF_FILE(name)
+{
+       if (!configure_subst.Exists("PHPDEF")) {
+               DEFINE("PHPDEF", "win32\\phpts.def");
+               ADD_FLAG("PHP_LDFLAGS", "/def:$(PHPDEF)");
+       }
+       ADD_FLAG("PHP_DLL_DEF_SOURCES", name);
+}
+
+function AC_DEFINE(name, value, comment, quote)
+{
+       if (quote == null) {
+               quote = true;
+       }
+       if (quote && typeof(value) == "string") {
+               value = '"' + value.replace(new RegExp('"', "g"), '\\"') + '"';
+       } else if (value.length == 0) {
+               value = '""';
+       }
+       var item = new Array(value, comment);
+       configure_hdr.Add(name, item);
+}
+
+function ERROR(msg)
+{
+       STDERR.WriteLine("ERROR: " + msg);
+       WScript.Quit(3);
+}
+
+function WARNING(msg)
+{
+       STDERR.WriteLine("WARNING: " + msg);
+}
+