enable zlib/brotli/curl by default
[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
6 function check_for_main_ext(ext, header)
7 {
8 if (!header) {
9 header = "php_"+ ext +".h";
10 }
11
12 /* When in configure, we're always in the root of PHP source */
13 var ext_path = "ext\\" + ext;
14
15 STDOUT.Write("Checking for ext/"+ ext +" ... ");
16
17 if (FSO.FileExists(ext_path + "\\" + header)) {
18 STDOUT.WriteLine(ext_path);
19 return ext_path;
20 }
21
22 STDOUT.WriteLine("<not found>");
23 return false;
24 }
25
26 function check_for_pecl_ext(ext, header)
27 {
28 if (!header) {
29 header = "php_"+ ext +".h";
30 }
31
32 var g;
33 var s = ext +"\\"+ header;
34
35 STDOUT.Write("Checking for pecl/"+ ext +" ... ");
36 if ( (g = glob(configure_module_dirname +"\\..\\"+ s)) ||
37 (g = glob(configure_module_dirname +"\\..\\..\\..\\pecl\\"+ s))) {
38 var f = g[0].substr(0, g[0].length - header.length - 1);
39 STDOUT.WriteLine(f);
40 return f;
41 }
42 STDOUT.WriteLine("<not found>");
43 return false;
44 }
45
46 if (PHP_HTTP != "no") {
47
48 var PHP_HTTP_SRC_ARRAY = glob(configure_module_dirname + "/src/*.c");
49 var PHP_HTTP_SOURCES="";
50 for (var i=0; i<PHP_HTTP_SRC_ARRAY.length; ++i) {
51 var basename = FSO.GetFileName(PHP_HTTP_SRC_ARRAY[i]);
52 PHP_HTTP_SOURCES = PHP_HTTP_SOURCES + " " + basename;
53 }
54 //EXTENSION("http");
55 ADD_SOURCES(configure_module_dirname + "/src", PHP_HTTP_SOURCES, "http");
56 EXTENSION("http", "src/php_http.c");
57 AC_DEFINE("HAVE_HTTP", 1, "Have extended HTTP support");
58 AC_DEFINE("HTTP_SHARED_DEPS", 1, "Depend on shared extensions");
59
60 AC_DEFINE("HAVE_GETHOSTNAME", 1);
61
62 if (PHP_DEBUG != "no") {
63 ADD_FLAG("CFLAGS_HTTP", "/W3");
64 }
65
66 if (CHECK_HEADER_ADD_INCLUDE('zlib.h', 'CFLAGS_HTTP', '..\\zlib;' + php_usual_include_suspects)) {
67 AC_DEFINE('HTTP_HAVE_ZLIB', 1, "Have zlib library");
68 AC_DEFINE('PHP_HTTP_HAVE_ZLIB', 1, "");
69 ADD_FLAG("LDFLAGS_HTTP", "/FORCE:MULTIPLE");
70 } else {
71 WARNING("zlib encoding functions not enabled; libraries and headers not found");
72 }
73
74 if (typeof(PHP_HASH) != "undefined" && PHP_HASH != "no") {
75 var f;
76
77 if ((f = check_for_pecl_ext("hash")) || (f = check_for_main_ext("hash"))) {
78 AC_DEFINE("PHP_HTTP_HAVE_EXT_HASH", 1, "");
79 ADD_FLAG("CFLAGS_HTTP", '/I "' + f + '" /DHTTP_HAVE_PHP_HASH_H=1');
80 ADD_EXTENSION_DEP("http", "hash", true);
81 }
82 }
83
84 if (PHP_SESSION != "no") {
85 ADD_EXTENSION_DEP("http", "session", true);
86 }
87
88 if (PHP_ICONV != "no") {
89 AC_DEFINE("PHP_HTTP_HAVE_EXT_ICONV", 1, "");
90 ADD_EXTENSION_DEP("http", "iconv", true);
91 }
92
93 if (PHP_INTL != "no") {
94 ADD_EXTENSION_DEP("http", "intl", true);
95 AC_DEFINE("HAVE_IDNA2008", 1, "");
96 AC_DEFINE("HAVE_UIDNA_IDNTOASCII", 1, "");
97 AC_DEFINE("HAVE_UIDNA_NAMETOASCII_UTF8", 1, "");
98 AC_DEFINE("PHP_HTTP_HAVE_LIBICU", 1, "");
99 AC_DEFINE("PHP_HTTP_HAVE_IDNA2003", 1, "");
100 AC_DEFINE("PHP_HTTP_HAVE_IDNA2008", 1, "");
101 ADD_FLAG("LIBS_HTTP", "icuuc.lib icudt.lib icuin.lib icuio.lib");
102 /* Compat for ICU before 58.1.*/
103 if (CHECK_LIB("icule.lib", "http", PHP_HTTP)) {
104 ADD_FLAG("LIBS_HTTP", "icule.lib");
105 }
106 if (CHECK_LIB("iculx.lib", "http", PHP_HTTP)) {
107 ADD_FLAG("LIBS_HTTP", "iculx.lib");
108 }
109 }
110
111 if (PHP_CURL != "no") {
112 ADD_EXTENSION_DEP("http", "curl", true);
113 }
114
115
116 CURL_LIB="libcurl_a.lib;libcurl.lib;" + (PHP_DEBUG != "no" ? "libcurld.lib":"libcurl.lib");
117 if (CHECK_HEADER_ADD_INCLUDE("curl/curl.h", "CFLAGS_HTTP") &&
118 CHECK_HEADER_ADD_INCLUDE("openssl/crypto.h", "CFLAGS_HTTP") &&
119 CHECK_LIB(CURL_LIB, "http", PHP_HTTP) &&
120 CHECK_LIB("wldap32.lib", "http", PHP_HTTP) &&
121 CHECK_LIB("libssh2.lib;libssh2_a.lib", "http", PHP_HTTP) &&
122 CHECK_LIB("nghttp2.lib;nghttp2_a.lib", "http", PHP_HTTP) &&
123 CHECK_LIB("normaliz.lib", "http", PHP_HTTP) &&
124 CHECK_LIB("libssl.lib;ssleay32.lib", "http", PHP_HTTP) &&
125 CHECK_LIB("libcrypto.lib;libeay32.lib", "http", PHP_HTTP) &&
126 CHECK_LIB("crypt32.lib;libeay32.lib", "http", PHP_HTTP) &&
127 CHECK_LIB("zlib.lib;zlib_a.lib", "http", PHP_HTTP) &&
128 ADD_EXTENSION_DEP("http", "propro", true) &&
129 ADD_EXTENSION_DEP("http", "raphf", true) &&
130 CHECK_LIB("winmm.lib", "http", PHP_HTTP)) {
131 AC_DEFINE("PHP_HTTP_HAVE_LIBCURL", 1, "Have CURL library");
132 AC_DEFINE("PHP_HTTP_HAVE_SSL", 1, "Have SSL");
133 AC_DEFINE("PHP_HTTP_HAVE_LIBCURL_SSL", 1);
134 AC_DEFINE("PHP_HTTP_HAVE_LIBCURL_OPENSSL", 1);
135 AC_DEFINE("PHP_HTTP_HAVE_EXT_PROPRO", 1, "");
136 AC_DEFINE("PHP_HTTP_HAVE_EXT_RAPHF", 1, "");
137 AC_DEFINE("PHP_HTTP_HAVE_CLIENT", 1, "Have HTTP client support");
138 AC_DEFINE("PHP_HAVE_CURL_MULTI_STRERROR", 1, "");
139 AC_DEFINE("PHP_HAVE_CURL_SHARE_STRERROR", 1, "");
140 AC_DEFINE("PHP_HAVE_CURL_EASY_STRERROR", 1, "");
141 AC_DEFINE("PHP_HAVE_CURL_EASY_RESET", 1, "");
142 AC_DEFINE("PHP_HAVE_CURL_GETFORMDATA", 1, "");
143 AC_DEFINE("PHP_HAVE_CURL_FORMGET", 1, "");
144 AC_DEFINE("PHP_HAVE_CURL_MULTI_SETOPT", 1, "");
145 AC_DEFINE("PHP_HAVE_CURL_MULTI_TIMEOUT", 1, "");
146 ADD_FLAG("CFLAGS_HTTP", "/I" + configure_module_dirname + " ");
147
148 if (CHECK_HEADER_ADD_INCLUDE("event.h", "CFLAGS_HTTP") &&
149 CHECK_HEADER_ADD_INCLUDE("event2/event.h", "CFLAGS_HTTP") &&
150 CHECK_LIB("libevent.lib", "http", PHP_HTTP) &&
151 CHECK_LIB("libevent_core.lib", "http", PHP_HTTP) &&
152 CHECK_LIB("libevent_extras.lib", "http", PHP_HTTP)) {
153
154 AC_DEFINE("PHP_HTTP_HAVE_LIBEVENT", 1);
155 AC_DEFINE("PHP_HTTP_HAVE_LIBEVENT2", 1);
156 AC_DEFINE("PHP_HTTP_LIBEVENT_VERSION", "2.0.21 or greater");
157 } else {
158 WARNING("http module: libevent not enabled; libraries or headers not found");
159 }
160 } else {
161 WARNING("curl convenience functions not enabled; libraries and headers not found");
162 }
163 }