]> granicus.if.org Git - php/commitdiff
some tweaks for Frank
authorWez Furlong <wez@php.net>
Wed, 3 Dec 2003 02:47:45 +0000 (02:47 +0000)
committerWez Furlong <wez@php.net>
Wed, 3 Dec 2003 02:47:45 +0000 (02:47 +0000)
ext/libxml/config.w32
ext/zlib/config.w32
sapi/apache/config.w32
win32/build/config.w32
win32/build/confutils.js

index d1cd69cb8777317e2b7fb2f266c97211d432ce21..5641e6f097b7838556dc9a155790551093b0181d 100644 (file)
@@ -6,7 +6,10 @@ 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");
+
+       CHECK_LIB("iconv.lib", "libxml", php_usual_lib_suspects);
+       CHECK_LIB("libxml2.lib", "libxml", php_usual_lib_suspects);
+       CHECK_HEADER_ADD_INCLUDE("libxml/parser.h", "CFLAGS", php_usual_include_suspects);
 }
 
 
index 99790cd3c4ea6009d7df8cf92cdd1920ad0b374e..5159696fd1615526f82eaf974587a7abbfcba562 100644 (file)
@@ -6,7 +6,8 @@ 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");
+       CHECK_LIB("zlib.lib", "zlib", "..\\zlib;" + php_usual_lib_suspects);
+       CHECK_HEADER_ADD_INCLUDE("zlib.h", "CFLAGS", "..\\zlib;" + php_usual_include_suspects);
 }
 
 
index 391d5a21928bbddc1401c643836cf691e00b1339..d9a69bfc125f78662ca44571f438882046b37510 100644 (file)
@@ -8,33 +8,19 @@ ARG_WITH('apache-libs', 'Where to find Apache 1.3 libraries', null);
 
 if (PHP_APACHE == "yes") {
 
-       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")) {
+       if (!CHECK_HEADER_ADD_INCLUDE("httpd.h", "CFLAGS_APACHE", php_usual_include_suspects +
+                       ";C:\\Program Files\\Apache Group\\Apache\\include" +
+                       ";..\\php_build\\apache\\src\\include")) {
                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")) {
+       if (!CHECK_LIB("ApacheCore.lib", "apache", php_usual_lib_suspects +
+                       ';C:\\Program Files\\Apache Group\\Apache\\libexec' +
+                       ';..\\php_build\\apache\\src\\corer')) {
                ERROR("Could not find apache libraries");
        }
 
-
        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');
+                       '/D APACHEPHP4_EXPORTS /D APACHE_READDIR_H');
 }
index 89b31e1e6c69118edf9be5ac51f8428ebac879fe..a088fc24087d608c5f74ce4440ebee2d55722bb0 100644 (file)
@@ -19,8 +19,7 @@ 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");
+DEFINE("BASE_INCLUDES", "/I . /I main /I regex /I Zend /I TSRM ");
 
 // CFLAGS for building the PHP dll
 DEFINE("CFLAGS_PHP", "/D _USRDLL /D PHP4DLLTS_EXPORTS /D PHP_EXPORTS \
@@ -89,18 +88,32 @@ if (PHP_DEBUG == "yes" && PHP_ZTS == "yes") {
 // that we need
 ARG_WITH('php-build', 'Path to where you extracted http://www.php.net/extra/win32build.zip. Assumes that it is a sibling of this source dir (..\\php_build) if not specified', 'no');
 
-if (PHP_PHP_BUILD == "no") {
-       if (FSO.FolderExists("..\\php_build")) {
-               PHP_PHP_BUILD = "..\\php_build";
+var php_usual_include_suspects = "..\\php_build\\include;..\\win32build\\include;..\\bindlib_w32";
+var php_usual_lib_suspects = "..\\php_build\\lib;..\\win32build\\lib;..\\bindlib_w32";
+
+// Poke around for some headers
+function probe_basic_headers()
+{
+       var p;
+
+       if (PHP_PHP_BUILD != "no") {
+               php_usual_include_suspects += ";" + PHP_PHP_BUILD + "\\include";
+               php_usual_lib_suspects += ";" + PHP_PHP_BUILD + "\\lib";
        }
-}
 
-if (!FSO.FolderExists(PHP_PHP_BUILD)) {
-       WARNING("Could not find the php_build dir; please specify it\r\n\
-using the --with-php-build option to configure");
+       p = CHECK_HEADER_ADD_INCLUDE("arpa\\nameser.h", "CFLAGS", php_usual_include_suspects);
+
+       // hack to catch common location of libs
+       if (typeof(p) == "string") {
+               p = p.replace(new RegExp("include$"), "lib");
+               ADD_FLAG("LDFLAGS", '/libpath:"' + p + '" ');
+               php_usual_lib_suspects += ";" + p;
+       }
 }
 
-DEFINE("PHP_BUILD", PHP_PHP_BUILD);
+probe_basic_headers();
+
+//DEFINE("PHP_BUILD", PHP_PHP_BUILD);
 
 STDOUT.WriteBlankLines(1);
 STDOUT.WriteLine("Build dir: " + get_define('BUILD_DIR'));
index 11870fc0695498294dfcd959bea9416743e33b06..50f9c9f73c15dc0ee94f89ead372dbafe33d60de 100644 (file)
@@ -17,7 +17,7 @@
   +----------------------------------------------------------------------+
 */
 
-// $Id: confutils.js,v 1.3 2003-12-03 00:56:14 wez Exp $
+// $Id: confutils.js,v 1.4 2003-12-03 02:47:45 wez Exp $
 
 var STDOUT = WScript.StdOut;
 var STDERR = WScript.StdErr;
@@ -267,49 +267,111 @@ function DEFINE(name, value)
        configure_subst.Add(name, value);
 }
 
-function PATH_PROG(progname, def, additional_paths)
+// Searches a set of paths for a file;
+// returns the dir in which the file was found,
+// true if it was found in the default env path,
+// or false if it was not found at all.
+// env_name is the optional name of an env var
+// specifying the default path to search
+function search_paths(thing_to_find, explicit_path, env_name)
 {
-       var i;
-       var found = false;
-       var p = def;
-       var exe;
+       var i, found = false, place = false, file, env;
 
-       exe = progname + ".exe";
-       STDOUT.Write("Checking for " + progname + " ... ");
+       STDOUT.Write("Checking for " + thing_to_find + " ... ");
+
+       if (explicit_path != null) {
+               if (typeof(explicit_path) == "string") {
+                       explicit_path = explicit_path.split(";");
+               }
 
-       if (additional_paths != null) {
-               for (i = 0; i < additional_paths.length; i++) {
-                       p = FSO.BuildPath(additional_paths[i], exe);
-                       if (FSO.FileExists(p)) {
+               for (i = 0; i < explicit_path.length; i++) {
+                       file = FSO.BuildPath(FSO.GetAbsolutePathName(explicit_path[i]), thing_to_find);
+                       if (FSO.FileExists(file)) {
                                found = true;
+                               place = explicit_path[i];
                                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
+       if (!found && env_name != null) {
+               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)) {
                                found = true;
-                               p = exe;
+                               place = true;
                                break;
                        }
                }
        }
-       if (!found) {
-               p = def;
-       }
-       if (p == null) {
-               STDOUT.WriteLine(" <not found>");
+
+       if (found && place == true) {
+               STDOUT.WriteLine(" <in default path>");
+       } else if (found) {
+               STDOUT.WriteLine(" " + place);
        } else {
-               STDOUT.WriteLine(p);
+               STDOUT.WriteLine(" <not found>");
+       }
+       return place;
+}
+
+function PATH_PROG(progname, def, additional_paths)
+{
+       var exe;
+       var place;
+
+       exe = progname + ".exe";
+
+       place = search_paths(exe, additional_paths, "PATH");
+
+       if (place == true) {
+               place = exe;
        }
-       DEFINE(progname.toUpperCase(), p);
+
+       if (place) {
+               DEFINE(progname.toUpperCase(), place);
+       }
+       return place;
+}
+
+function CHECK_LIB(libname, target, path_to_check)
+{
+       var p = search_paths(libname, path_to_check, "LIBS");
+       var have = 0;
+
+       if (typeof(p) == "string") {
+               ADD_FLAG("LDFLAGS_" + target.toUpperCase(), '/libpath:"' + p + '" ');
+               ADD_FLAG("LIBS_" + target.toUpperCase(), libname);
+               have = 1;
+       }
+
+//     AC_DEFINE("HAVE_" + header_name.toUpperCase().replace(new RegExp("/\\\\-\.", "g"), "_"), have);
+
+       return p;
+
+}
+
+function CHECK_HEADER_ADD_INCLUDE(header_name, flag_name, path_to_check, use_env)
+{
+       if (use_env == null) {
+               use_env = true;
+       }
+       var p = search_paths(header_name, path_to_check, use_env ? "INCLUDE" : null);
+       var have = 0;
+       var sym;
+
+       if (typeof(p) == "string") {
+               ADD_FLAG(flag_name, '/I "' + p + '" ');
+               have = 1;
+       }
+
+       sym = header_name.toUpperCase();
+       sym = sym.replace(new RegExp("[\\\\/\.-]", "g"), "_");
+
+       AC_DEFINE("HAVE_" + sym, have);
+
        return p;
 }
 
@@ -445,6 +507,7 @@ function ADD_SOURCES(dir, file_list, target)
        }
 
        file_list = file_list.split(new RegExp("\\s+"));
+       file_list.sort();
 
        var re = new RegExp("\.[a-z0-9A-Z]+$");