wez Wed Jan 7 15:06:34 2004 EDT Modified files: /php-src/ext/oci8 config.w32 /php-src/ext/oracle config.w32 /php-src/ext/pspell config.w32 /php-src/ext/zlib config.w32 /php-src/sapi/nsapi config.w32 /php-src/win32/build confutils.js Log: glob-ify lib checks; this simplifies writing of config.w32 files a little.
Index: php-src/ext/oci8/config.w32 diff -u php-src/ext/oci8/config.w32:1.1 php-src/ext/oci8/config.w32:1.2 --- php-src/ext/oci8/config.w32:1.1 Fri Dec 19 10:04:25 2003 +++ php-src/ext/oci8/config.w32 Wed Jan 7 15:06:29 2004 @@ -1,4 +1,4 @@ -// $Id: config.w32,v 1.1 2003/12/19 15:04:25 wez Exp $ +// $Id: config.w32,v 1.2 2004/01/07 20:06:29 wez Exp $ // vim:ft=javascript ARG_WITH("oci8", "OCI8 support", "no"); @@ -6,7 +6,9 @@ if (PHP_OCI8 != "no") { if (CHECK_HEADER_ADD_INCLUDE("oci.h", "CFLAGS_OCI8", PHP_PHP_BUILD + "\\oci805\\include;" + PHP_OCI8) && - CHECK_LIB("oci.lib", "oci8", PHP_PHP_BUILD + "\\oci805\\lib;" + PHP_OCI8)) { + CHECK_LIB("oci.lib", "oci8", PHP_OCI8) + + ) { EXTENSION('oci8', 'oci8.c'); AC_DEFINE('HAVE_OCI8_TEMP_LOB', 1); Index: php-src/ext/oracle/config.w32 diff -u php-src/ext/oracle/config.w32:1.1 php-src/ext/oracle/config.w32:1.2 --- php-src/ext/oracle/config.w32:1.1 Fri Dec 19 10:04:26 2003 +++ php-src/ext/oracle/config.w32 Wed Jan 7 15:06:29 2004 @@ -1,12 +1,12 @@ -// $Id: config.w32,v 1.1 2003/12/19 15:04:26 wez Exp $ +// $Id: config.w32,v 1.2 2004/01/07 20:06:29 wez Exp $ // vim:ft=javascript ARG_WITH("oracle", "ORACLE support", "no"); if (PHP_ORACLE != "no") { - if (CHECK_HEADER_ADD_INCLUDE("winoci.h", "CFLAGS_ORACLE", PHP_PHP_BUILD + "\\oci73\\include;" + PHP_ORACLE) && - CHECK_LIB("ociw32.lib", "oracle", PHP_PHP_BUILD + "\\oci73\\lib;" + PHP_ORACLE)) { + if (CHECK_HEADER_ADD_INCLUDE("winoci.h", "CFLAGS_ORACLE", PHP_PHP_BUILD + "\\oci7*\\include;" + PHP_ORACLE) && + CHECK_LIB("ociw32.lib", "oracle", PHP_ORACLE, "oci7")) { EXTENSION('oracle', 'oracle.c'); AC_DEFINE('HAVE_ORACLE', 1); Index: php-src/ext/pspell/config.w32 diff -u php-src/ext/pspell/config.w32:1.1 php-src/ext/pspell/config.w32:1.2 --- php-src/ext/pspell/config.w32:1.1 Fri Dec 19 12:00:11 2003 +++ php-src/ext/pspell/config.w32 Wed Jan 7 15:06:30 2004 @@ -1,4 +1,4 @@ -// $Id: config.w32,v 1.1 2003/12/19 17:00:11 wez Exp $ +// $Id: config.w32,v 1.2 2004/01/07 20:06:30 wez Exp $ // vim:ft=javascript ARG_WITH("pspell", "pspell/aspell (whatever it's called this month) support", "no"); @@ -6,11 +6,9 @@ if (PHP_PSPELL != "no") { if (CHECK_HEADER_ADD_INCLUDE("pspell.h", "CFLAGS_PSPELL", PHP_PHP_BUILD + "\\include\\pspell;" + PHP_PSPELL) && - CHECK_LIB("aspell-15.lib", "pspell", PHP_PSPELL)) { + CHECK_LIB("aspell*.lib", "pspell", PHP_PSPELL)) { EXTENSION('pspell', 'pspell.c'); - AC_DEFINE('HAVE_PSPELL', 1); - } else { WARNING("pspell not enabled; libraries and headers not found"); } Index: php-src/ext/zlib/config.w32 diff -u php-src/ext/zlib/config.w32:1.5 php-src/ext/zlib/config.w32:1.6 --- php-src/ext/zlib/config.w32:1.5 Mon Dec 22 01:19:01 2003 +++ php-src/ext/zlib/config.w32 Wed Jan 7 15:06:31 2004 @@ -1,4 +1,4 @@ -// $Id: config.w32,v 1.5 2003/12/22 06:19:01 jon Exp $ +// $Id: config.w32,v 1.6 2004/01/07 20:06:31 wez Exp $ // vim:ft=javascript ARG_ENABLE("zlib", "ZLIB support", "yes"); @@ -6,7 +6,7 @@ if (PHP_ZLIB == "yes") { EXTENSION("zlib", "zlib.c zlib_fopen_wrapper.c", null, "/D ZLIB_EXPORTS"); AC_DEFINE("HAVE_ZLIB", 1, "ZLIB support"); - CHECK_LIB("zlib.lib", "zlib", "..\\zlib;" + php_usual_lib_suspects); + CHECK_LIB("zlib.lib", "zlib", PHP_ZLIB); CHECK_HEADER_ADD_INCLUDE("zlib.h", "CFLAGS", "..\\zlib;" + php_usual_include_suspects); } Index: php-src/sapi/nsapi/config.w32 diff -u php-src/sapi/nsapi/config.w32:1.3 php-src/sapi/nsapi/config.w32:1.4 --- php-src/sapi/nsapi/config.w32:1.3 Fri Dec 19 15:39:01 2003 +++ php-src/sapi/nsapi/config.w32 Wed Jan 7 15:06:31 2004 @@ -1,5 +1,5 @@ // vim:ft=javascript -// $Id: config.w32,v 1.3 2003/12/19 20:39:01 wez Exp $ +// $Id: config.w32,v 1.4 2004/01/07 20:06:31 wez Exp $ ARG_ENABLE('nsapi', 'Build NSAPI for Netscape/iPlanet/SunONE webservers', 'no'); @@ -11,8 +11,7 @@ WARNING("NSAPI module requires an --enable-zts build of PHP"); } else if (CHECK_HEADER_ADD_INCLUDE("nsapi.h", "CFLAGS_NSAPI", PHP_NSAPI + ';' + PHP_NSAPI_INCLUDES) && - CHECK_LIB("ns-httpd40.lib;ns-httpd36.lib;ns-httpd35.lib;ns-httpd30.lib", - "nsapi", PHP_NSAPI + ";" + PHP_NSAPI_LIBS)) { + CHECK_LIB("ns-httpd*.lib", "nsapi", PHP_NSAPI + ";" + PHP_NSAPI_LIBS)) { SAPI('nsapi', 'nsapi.c', 'php' + PHP_VERSION + 'nsapi.dll', '/D XP_WIN32 '); } else { WARNING("Could not find NSAPI headers/libraries"); Index: php-src/win32/build/confutils.js diff -u php-src/win32/build/confutils.js:1.30 php-src/win32/build/confutils.js:1.31 --- php-src/win32/build/confutils.js:1.30 Tue Dec 23 12:20:50 2003 +++ php-src/win32/build/confutils.js Wed Jan 7 15:06:32 2004 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -// $Id: confutils.js,v 1.30 2003/12/23 17:20:50 wez Exp $ +// $Id: confutils.js,v 1.31 2004/01/07 20:06:32 wez Exp $ var STDOUT = WScript.StdOut; var STDERR = WScript.StdErr; @@ -387,16 +387,19 @@ STDOUT.Write("Checking for " + thing_to_find + " ... "); + thing_to_find = thing_to_find.replace(new RegExp("/", "g"), "\\"); + if (explicit_path != null) { if (typeof(explicit_path) == "string") { explicit_path = explicit_path.split(";"); } for (i = 0; i < explicit_path.length; i++) { - file = FSO.BuildPath(FSO.GetAbsolutePathName(explicit_path[i]), thing_to_find); - if (FSO.FileExists(file)) { + file = glob(explicit_path[i] + "\\" + thing_to_find); + if (file) { found = true; - place = explicit_path[i]; + place = file[0]; + place = place.substr(0, place.length - thing_to_find.length - 1); break; } } @@ -406,8 +409,8 @@ env = WshShell.Environment("Process").Item(env_name); env = env.split(";"); for (i = 0; i < env.length; i++) { - file = FSO.BuildPath(env[i], thing_to_find); - if (FSO.FileExists(file)) { + file = glob(env[i] + "\\" + thing_to_find); + if (file) { found = true; place = true; break; @@ -456,7 +459,127 @@ return place; } -function CHECK_LIB(libnames, target, path_to_check) +function find_pattern_in_path(pattern, path) +{ + if (path == null) { + return false; + } + + var dirs = path.split(';'); + var i; + var items; + + for (i = 0; i < dirs.length; i++) { + items = glob(dirs[i] + "\\" + pattern); + if (items) { + return condense_path(items[0]); + } + } + return false; +} + +function CHECK_LIB(libnames, target, path_to_check, common_name) +{ + STDOUT.Write("Checking for library " + libnames + " ... "); + + if (common_name == null && target != null) { + common_name = target; + } + + if (path_to_check == null) { + path_to_check = ""; + } + + // if they specified a common name for the package that contains + // the library, tag some useful defaults on to the end of the + // path to be searched + if (common_name != null) { + path_to_check += ";" + PHP_PHP_BUILD + "\\" + common_name + "*"; + path_to_check += ";" + PHP_PHP_BUILD + "\\lib\\" + common_name + "*"; + path_to_check += ";..\\" + common_name + "*"; + } + + // Determine target for build flags + if (target == null) { + target = ""; + } else { + target = "_" + target.toUpperCase(); + } + + // Expand path to include general dirs + path_to_check += ";" + php_usual_lib_suspects; + + // It is common practice to put libs under one of these dir names + var subdirs = new Array(PHP_DEBUG == "yes" ? "Debug" : "Release", "lib", "libs", "libexec"); + + // libnames can be ; separated list of accepted library names + libnames = libnames.split(';'); + + var i, j, k, libname; + var location = false; + var path = path_to_check.split(';'); + + for (i = 0; i < libnames.length; i++) { + libname = libnames[i]; + + for (k = 0; k < path.length; k++) { + location = glob(path[k] + "\\" + libname); + if (location) { + location = location[0]; + break; + } + for (j = 0; j < subdirs.length; j++) { + location = glob(path[k] + "\\" + subdirs[j] + "\\" + libname); + if (location) { + location = location[0]; + break; + } + } + if (location) + break; + } + + if (location) { + location = condense_path(location); + var libdir = FSO.GetParentFolderName(location); + libname = FSO.GetFileName(location); + ADD_FLAG("LDFLAGS" + target, '/libpath:"' + libdir + '" '); + ADD_FLAG("LIBS" + target, libname); + + STDOUT.WriteLine(location); + + return location; + } + + // Check in their standard lib path + location = find_pattern_in_path(libname, WshShell.Environment("Process").Item("LIB")); + + if (location) { + location = condense_path(location); + libname = FSO.GetFileName(location); + ADD_FLAG("LIBS" + target, libname); + + STDOUT.WriteLine("<in LIB path> " + libname); + return location; + } + + // Check in their general extra libs path + location = find_pattern_in_path(libname, PHP_EXTRA_LIBS); + if (location) { + location = condense_path(location); + libname = FSO.GetFileName(location); + ADD_FLAG("LIBS" + target, libname); + STDOUT.WriteLine("<in extra libs path>"); + return location; + } + } + + STDOUT.WriteLine("<not found>"); + + return false; +} + +function OLD_CHECK_LIB(libnames, target, path_to_check) { if (target == null) { target = ""; @@ -916,7 +1039,7 @@ var indata; var prefix; - prefix = PHP_PREFIX.replace("\\", "\\\\"); + prefix = PHP_PREFIX.replace(new RegExp("\\\\", "g"), "\\\\"); STDOUT.WriteLine("Generating main/config.w32.h"); @@ -1051,7 +1174,6 @@ function copy_and_subst(srcname, destname, subst_array) { if (!FSO.FileExists(srcname)) { - STDOUT.WriteLine("copy_and_subst under " + configure_module_dirname); srcname = configure_module_dirname + "\\" + srcname; destname = configure_module_dirname + "\\" + destname; } @@ -1080,6 +1202,12 @@ var p; var base = ""; var is_pat_re = /\*/; + +//STDOUT.WriteLine("glob: " + path_pattern); + + if (FSO.FileExists(path_pattern)) { + return new Array(path_pattern); + } // first, build as much as possible that doesn't have a pattern for (p = 0; p < path_parts.length; p++) { @@ -1100,6 +1228,10 @@ var re = null; var items = null; + if (p == parts.length) { + return false; + } + //STDOUT.WriteLine("inner: base=" + base + " p=" + p + " pat=" + pat); if (FSO.FileExists(full_name)) { @@ -1116,10 +1248,14 @@ } // Convert the pattern into a regexp - re = new RegExp("^" + pat.replace(/\./g, '\\.').replace(/\*/g, '.*') + "$"); + re = new RegExp("^" + pat.replace(/\./g, '\\.').replace(/\*/g, '.*').replace(/\?/g, '.') + "$", "i"); items = new Array(); + if (!FSO.FolderExists(base)) { + return false; + } + var folder = FSO.GetFolder(base); var fc = null; var subitems = null; @@ -1159,6 +1295,9 @@ } } + if (items.length == 0) + return false; + return items; }
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php