From b587077029cfd30b2daf4f4d519f69c37fae1841 Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Wed, 9 Feb 2005 10:59:36 +0000 Subject: [PATCH] * attempt to fix snap-build --- config.m4 | 2 +- config.w32 | 2 +- http.c | 30 ++++++++++++++++-------------- http_api.c | 27 +++++++++++++++------------ php_http.h | 4 ++-- php_http_api.h | 4 ++-- 6 files changed, 37 insertions(+), 32 deletions(-) diff --git a/config.m4 b/config.m4 index f501627..ae3f258 100644 --- a/config.m4 +++ b/config.m4 @@ -47,7 +47,7 @@ dnl ---- PHP_CHECK_LIBRARY(curl,curl_easy_init, [ - AC_DEFINE(HAVE_CURL,1,[Have CURL easy support]) + AC_DEFINE(HTTP_HAVE_CURL,1,[Have CURL easy support]) ],[ AC_MSG_ERROR(There is something wrong with libcurl. Please check config.log for more information.) ],[ diff --git a/config.w32 b/config.w32 index d06aa3f..e3401b5 100644 --- a/config.w32 +++ b/config.w32 @@ -12,7 +12,7 @@ if (PHP_HTTP != "no") { CHECK_LIB("libeay32.lib", "http", PHP_HTTP) && CHECK_LIB("zlib.lib", "http", PHP_HTTP) && CHECK_LIB("winmm.lib", "http", PHP_HTTP)) { - AC_DEFINE('HAVE_CURL', 1, 'Have CURL library'); + AC_DEFINE("HTTP_HAVE_CURL", 1, "Have CURL library"); } else { WARNING("curl convenience functions not enabled; libraries and headers not found"); } diff --git a/http.c b/http.c index 56ae91d..74e2968 100644 --- a/http.c +++ b/http.c @@ -21,14 +21,6 @@ #include "config.h" #endif -#if defined(HAVE_CURL) && HAVE_CURL -# ifdef PHP_WIN32 -# include -# include -# endif -#include -#endif - #include "php.h" #include "snprintf.h" #include "ext/standard/info.h" @@ -39,6 +31,16 @@ #include "php_http.h" #include "php_http_api.h" +#ifdef HTTP_HAVE_CURL + +#ifdef PHP_WIN32 +#include +#include +#endif + +#include +#endif + ZEND_DECLARE_MODULE_GLOBALS(http) #ifdef COMPILE_DL_HTTP @@ -65,7 +67,7 @@ function_entry http_functions[] = { PHP_FE(http_send_stream, NULL) PHP_FE(http_chunked_decode, NULL) PHP_FE(http_split_response, NULL) -#if defined(HAVE_CURL) && HAVE_CURL +#ifdef HTTP_HAVE_CURL PHP_FE(http_get, NULL) PHP_FE(http_head, NULL) PHP_FE(http_post_data, NULL) @@ -677,7 +679,7 @@ PHP_FUNCTION(http_split_response) /* }}} */ /* {{{ HAVE_CURL */ -#if defined(HAVE_CURL) && HAVE_CURL +#ifdef HTTP_HAVE_CURL /* {{{ proto string http_get(string url[, array options[, array &info]]) * @@ -948,7 +950,7 @@ static void php_http_init_globals(zend_http_globals *http_globals) http_globals->ctype = NULL; http_globals->etag = NULL; http_globals->lmod = 0; -#if defined(HAVE_CURL) && HAVE_CURL +#ifdef HTTP_HAVE_CURL http_globals->curlbuf.body.data = NULL; http_globals->curlbuf.body.used = 0; http_globals->curlbuf.body.free = 0; @@ -963,7 +965,7 @@ static void php_http_init_globals(zend_http_globals *http_globals) PHP_MINIT_FUNCTION(http) { ZEND_INIT_MODULE_GLOBALS(http, php_http_init_globals, NULL); -#if defined(HAVE_CURL) && HAVE_CURL +#ifdef HTTP_HAVE_CURL REGISTER_LONG_CONSTANT("HTTP_AUTH_BASIC", CURLAUTH_BASIC, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("HTTP_AUTH_DIGEST", CURLAUTH_DIGEST, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("HTTP_AUTH_NTLM", CURLAUTH_NTLM, CONST_CS | CONST_PERSISTENT); @@ -981,7 +983,7 @@ PHP_RSHUTDOWN_FUNCTION(http) if (HTTP_G(etag)) { efree(HTTP_G(etag)); } -#if defined(HAVE_CURL) && HAVE_CURL +#ifdef HTTP_HAVE_CURL if (HTTP_G(curlbuf).body.data) { efree(HTTP_G(curlbuf).body.data); } @@ -1000,7 +1002,7 @@ PHP_MINFO_FUNCTION(http) php_info_print_table_header(2, "Extended HTTP support", "enabled"); php_info_print_table_row(2, "Version:", PHP_EXT_HTTP_VERSION); php_info_print_table_row(2, "cURL convenience functions:", -#if defined(HAVE_CURL) && HAVE_CURL +#ifdef HTTP_HAVE_CURL "enabled" #else "disabled" diff --git a/http_api.c b/http_api.c index 059228d..064386e 100644 --- a/http_api.c +++ b/http_api.c @@ -23,15 +23,6 @@ #include -#if defined(HAVE_CURL) && HAVE_CURL -# ifdef PHP_WIN32 -# include -# include -# endif -#include -#include -#endif - #include "php.h" #include "php_version.h" #include "php_streams.h" @@ -55,6 +46,18 @@ #include "php_http.h" #include "php_http_api.h" +#ifdef HTTP_HAVE_CURL + +#ifdef PHP_WIN32 +#include +#include +#endif + +#include +#include +#endif + + ZEND_DECLARE_MODULE_GLOBALS(http) /* {{{ day/month names */ @@ -142,7 +145,7 @@ static int check_month(char *month); static int check_tzone(char *tzone); /* {{{ HAVE_CURL */ -#if defined(HAVE_CURL) && HAVE_CURL +#ifdef HTTP_HAVE_CURL #define http_curl_initbuf(m) _http_curl_initbuf((m) TSRMLS_CC) static inline void _http_curl_initbuf(http_curlbuf_member member TSRMLS_DC); #define http_curl_freebuf(m) _http_curl_freebuf((m) TSRMLS_CC) @@ -297,7 +300,7 @@ static STATUS _http_send_chunk(const void *data, const size_t begin, /* }}} */ /* {{{ HAVE_CURL */ -#if defined(HAVE_CURL) && HAVE_CURL +#ifdef HTTP_HAVE_CURL /* {{{ static inline void http_curl_initbuf(http_curlbuf_member) */ static inline void _http_curl_initbuf(http_curlbuf_member member TSRMLS_DC) @@ -1746,7 +1749,7 @@ PHP_HTTP_API void _http_split_response(const zval *zresponse, zval *zheaders, /* }}} */ /* {{{ HAVE_CURL */ -#if defined(HAVE_CURL) && HAVE_CURL +#ifdef HTTP_HAVE_CURL /* {{{ STATUS http_get(char *, HashTable *, HashTable *, char **, size_t *) */ PHP_HTTP_API STATUS _http_get(const char *URL, HashTable *options, diff --git a/php_http.h b/php_http.h index 2f2b7ee..4ed736c 100644 --- a/php_http.h +++ b/php_http.h @@ -52,7 +52,7 @@ PHP_FUNCTION(http_send_file); PHP_FUNCTION(http_send_stream); PHP_FUNCTION(http_chunked_decode); PHP_FUNCTION(http_split_response); -#if defined(HAVE_CURL) && HAVE_CURL +#ifdef HTTP_HAVE_CURL PHP_FUNCTION(http_get); PHP_FUNCTION(http_head); PHP_FUNCTION(http_post_data); @@ -72,7 +72,7 @@ ZEND_BEGIN_MODULE_GLOBALS(http) char *ctype; char *etag; time_t lmod; -#if defined(HAVE_CURL) && HAVE_CURL +#ifdef HTTP_HAVE_CURL struct { struct { char *data; diff --git a/php_http_api.h b/php_http_api.h index 34a0159..56cf541 100644 --- a/php_http_api.h +++ b/php_http_api.h @@ -52,7 +52,7 @@ typedef enum { #define HTTP_SERVER_VARS Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_SERVER]) /* {{{ HAVE_CURL */ -#if defined(HAVE_CURL) && HAVE_CURL +#ifdef HTTP_HAVE_CURL /* CURL buffer size */ #define HTTP_CURLBUF_BODYSIZE 16384 @@ -149,7 +149,7 @@ PHP_HTTP_API STATUS _http_chunked_decode(const char *encoded, const size_t encod PHP_HTTP_API void _http_split_response(const zval *zresponse, zval *zheaders, zval *zbody TSRMLS_DC); /* {{{ HAVE_CURL */ -#if defined(HAVE_CURL) && HAVE_CURL +#ifdef HTTP_HAVE_CURL #define http_get(u, o, i, d, l) _http_get((u), (o), (i), (d), (l) TSRMLS_CC) PHP_HTTP_API STATUS _http_get(const char *URL, HashTable *options, HashTable *info, char **data, size_t *data_len TSRMLS_DC); -- 2.30.2