- highly experimental stream wrapper
[m6w6/ext-http] / config.w32
1 // config.w32 for pecl/http
2 // $Id$
3
4 ARG_ENABLE("http", "whether to enable extended HTTP support", "no");
5 ARG_ENABLE("http-stream-wrapper", "whether to enable experimental stream wrapper", "no", "no");
6
7 function check_for_main_ext(ext, header)
8 {
9 if (!header) {
10 header = "php_"+ ext +".h";
11 }
12
13 var r = new RegExp(PHP_VERSION +"."+ PHP_MINOR_VERSION);
14 var g = glob(configure_module_dirname +"\\..\\..\\*\\ext\\"+ ext +"\\"+ header);
15
16 STDOUT.Write("Checking for ext/"+ ext +" ... ");
17 for (i = 0; i < g.length; i++) {
18 if (g[i].match(r)) {
19 var f = g[i].substr(0, g[i].length - header.length - 1);
20 STDOUT.WriteLine(f);
21 return f;
22 }
23 }
24 STDOUT.WriteLine("<not found>");
25 return false;
26 }
27
28 function check_for_pecl_ext(ext, header)
29 {
30 if (!header) {
31 header = "php_"+ ext +".h";
32 }
33
34 var g;
35 var s = ext +"\\"+ header;
36
37 STDOUT.Write("Checking for pecl/"+ ext +" ... ");
38 if ( (g = glob(configure_module_dirname +"\\..\\"+ s)) ||
39 (g = glob(configure_module_dirname +"\\..\\..\\..\\pecl\\"+ s))) {
40 var f = g[0].substr(0, g[0].length - header.length - 1);
41 STDOUT.WriteLine(f);
42 return f;
43 }
44 STDOUT.WriteLine("<not found>");
45 return false;
46 }
47
48 if (PHP_HTTP != "no") {
49
50 EXTENSION("http",
51 "missing.c http.c http_functions.c http_exception_object.c "+
52 "http_util_object.c http_message_object.c http_requestpool_object.c "+
53 "http_request_object.c http_response_object.c "+
54 "http_api.c http_cache_api.c http_request_pool_api.c "+
55 "http_request_api.c http_date_api.c http_headers_api.c "+
56 "http_message_api.c http_send_api.c http_url_api.c "+
57 "http_info_api.c http_request_method_api.c http_encoding_api.c "+
58 "http_filter_api.c http_request_body_api.c http_wrapper_api.c",
59 null,
60 "/I\"" + configure_module_dirname + "/phpstr\"");
61 ADD_SOURCES(configure_module_dirname + "/phpstr", "phpstr.c", "http");
62 AC_DEFINE("HAVE_HTTP", 1, "Have extended HTTP support");
63
64 if (PHP_HTTP_STREAM_WRAPPER == "yes") {
65 AC_DEFINE("HTTP_HAVE_WRAPPER", 1, "Have experimental HTTP stream wrapper");
66 }
67
68 if (PHP_DEBUG != "no") {
69 ADD_FLAG("CFLAGS_HTTP", "/W3");
70 }
71
72 if (CHECK_HEADER_ADD_INCLUDE('zlib.h', 'CFLAGS_HTTP', '..\\zlib;' + php_usual_include_suspects)) {
73 AC_DEFINE('HTTP_HAVE_ZLIB', 1, "Have zlib library");
74 ADD_FLAG("LDFLAGS_HTTP", "/FORCE:MULTIPLE");
75 } else {
76 WARNING("zlib encoding functions not enabled; libraries and headers not found");
77 }
78
79 if (PHP_HASH != "no") {
80 var f;
81
82 if ((f = check_for_pecl_ext("hash")) || (f = check_for_main_ext("hash"))) {
83 ADD_FLAG("CFLAGS_HTTP", "/I"+ f);
84 AC_DEFINE("HTTP_HAVE_EXT_HASH", 1, "");
85 ADD_EXTENSION_DEP("http", "hash", true);
86 }
87 }
88
89 CURL_LIB = PHP_DEBUG != "no" ? "libcurld.lib":"libcurl.lib";
90 if (CHECK_HEADER_ADD_INCLUDE("curl/curl.h", "CFLAGS_HTTP") &&
91 CHECK_HEADER_ADD_INCLUDE("openssl/crypto.h", "CFLAGS_HTTP") &&
92 CHECK_LIB(CURL_LIB, "http", PHP_HTTP) &&
93 CHECK_LIB("ssleay32.lib", "http", PHP_HTTP) &&
94 CHECK_LIB("libeay32.lib", "http", PHP_HTTP) &&
95 CHECK_LIB("zlib.lib", "http", PHP_HTTP) &&
96 CHECK_LIB("winmm.lib", "http", PHP_HTTP)) {
97 AC_DEFINE("HTTP_HAVE_CURL", 1, "Have CURL library");
98 AC_DEFINE("HTTP_HAVE_SSL", 1, "Have SSL");
99 AC_DEFINE("HAVE_CURL_MULTI_STRERROR", 1, "");
100 AC_DEFINE("HAVE_CURL_EASY_STRERROR", 1, "");
101 AC_DEFINE("HAVE_CURL_EASY_RESET", 1, "");
102 } else {
103 WARNING("curl convenience functions not enabled; libraries and headers not found");
104 }
105
106 MAGIC_LIB = PHP_DEBUG != "no" ? "libmagic-staticd.lib":"libmagic-static.lib";
107 if (CHECK_HEADER_ADD_INCLUDE("magic.h", "CFLAGS_HTTP") &&
108 CHECK_LIB(MAGIC_LIB, "http", PHP_HTTP)) {
109 AC_DEFINE("HTTP_HAVE_MAGIC", 1, "Have magic library");
110 AC_DEFINE("USE_MAGIC_STATIC", "", "");
111 } else {
112 WARNING("content type guessing not enabled; libraries and headers not found");
113 }
114 }