summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2013-06-03 18:34:10 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2013-06-03 18:34:10 +0000
commitf143c3cab79c59dd57124f19d16ac35253843136 (patch)
tree9fa67aa3d59e9d96f5f37858e95c4ab91960ea92
parent6f61a1acd01dc2ad1d2f5c1f7458702c77c69f9c (diff)
downloadlibserf-tarball-f143c3cab79c59dd57124f19d16ac35253843136.tar.gz
-rw-r--r--CHANGES47
-rw-r--r--Makefile.in11
-rw-r--r--auth/auth.c61
-rw-r--r--auth/auth.h18
-rw-r--r--auth/auth_basic.c6
-rw-r--r--auth/auth_digest.c27
-rw-r--r--auth/auth_kerb.c358
-rw-r--r--auth/auth_kerb.h9
-rw-r--r--auth/auth_kerb_gss.c78
-rw-r--r--auth/auth_kerb_sspi.c64
-rw-r--r--buckets/allocator.c14
-rw-r--r--buckets/buckets.c84
-rw-r--r--buckets/dechunk_buckets.c10
-rw-r--r--buckets/headers_buckets.c6
-rw-r--r--buckets/mmap_buckets.c22
-rw-r--r--buckets/response_body_buckets.c135
-rw-r--r--buckets/response_buckets.c43
-rw-r--r--buckets/socket_buckets.c13
-rw-r--r--buckets/ssl_buckets.c297
-rwxr-xr-xbuild/config.guess99
-rwxr-xr-xbuild/config.sub150
-rw-r--r--build/serf.def5
-rwxr-xr-xconfigure4369
-rw-r--r--configure.in58
-rw-r--r--context.c23
-rw-r--r--outgoing.c282
-rw-r--r--serf.h43
-rw-r--r--serf.mak10
-rw-r--r--serf_bucket_types.h22
-rw-r--r--serf_private.h66
-rwxr-xr-xserfmake27
-rw-r--r--ssltunnel.c19
-rw-r--r--test/CuTest.c13
-rw-r--r--test/CuTest.h5
-rw-r--r--test/serf_get.c40
-rw-r--r--test/server/serfcacert.pem50
-rw-r--r--test/server/serfrootcacert.pem60
-rw-r--r--test/server/serfservercert.pem50
-rw-r--r--test/server/serfserverkey.pem18
-rw-r--r--test/server/test_server.c171
-rw-r--r--test/server/test_server.h94
-rw-r--r--test/server/test_sslserver.c252
-rw-r--r--test/test_buckets.c332
-rw-r--r--test/test_context.c850
-rw-r--r--test/test_serf.h22
-rw-r--r--test/test_ssl.c21
-rw-r--r--test/test_util.c129
47 files changed, 5578 insertions, 3005 deletions
diff --git a/CHANGES b/CHANGES
index 5124082..67ba89f 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,49 @@
-Serf 1.1.0 [2012-06-07, from /tags/1.1.0]
+Serf 1.2.1 [2013-06-03, from /tags/1.2.1]
+ Fix issue 95: add gssapi switches to configure (r1864, r1900)
+ Fix issue 97: skip mmap bucket if APR_HAS_MMAP is undefined (r1877)
+ Fix issue 100: building against an old Windows Platform SDK (r1881)
+ Fix issue 102: digest authentication failures (r1885)
+ Improve error return values in SSPI authentication (r1804)
+ Ensure serf-1.pc is constructed by serfmake (r1865)
+ Optimize SPNego authentication processing (r1868)
+ Reject certs that application does not like (r1794)
+ Fix possible endless loop in serf_linebuf_fetch() (r1816)
+ Windows build: dereference INTDIR in serf.mak (r1882)
+
+
+Serf 1.2.0 [2013-02-22, from /tags/1.2.0, r1726]
+ Fixed issue 94: Serf can enter an infinite loop when server aborts conn.
+ Fixed issue 91: Serf doesn't handle an incoming 408 Timeout Request
+ Fixed issue 80: Serf is not handling Negotiate authentication correctly
+ Fixed issue 77: Endless loop if server doesn't accept Negotiate authn
+ Fixed issue 93: cleanup-after-fork interferes with parent (r1714)
+ Fixed most of issue 89: Support REAL SPNEGO authentication
+ Enable Negotiate/Kerberos support for proxy servers.
+ Return error when C-L, chunked, gzip encoded response bodies where
+ truncated (due to aborted connection) (r1688)
+ Add a logging mechanism that can be enabled at compile-time.
+ Don't lookup server address if a proxy was configured. (r1706)
+ Fix an off-by-one in buffer sizing (r1695)
+ Disable SSL compression by default + API to enable it (r1692)
+ New serf_connection_get_latency() for estimated network latency (r1689)
+ New error code and RFC compliance for the HTTPS tunnel (r1701, r1644)
+ Handle EINTR when a user suspends and then backgrounds the app (r1708)
+ Minor fixes and test suite improvements.
+
+
+Serf 1.1.1 [2012-10-04, from /tags/1.1.1, r1657]
+ Fixed issue 86: ensure requeued requests are correctly handled.
+ This fixes:
+ - infinite loop with multiple connection resets or SIGPIPE errors
+ - "connection" hang where we would not re-queue requests that are
+ held after we re-connect
+ Fixed issue 74: test_all goes in an endless loop
+ Fix memleak when conn. is closed explicitly/due to pool cleanups (r1623)
+ Windows: Fix https connection aborts (r1628..-30,-33,-34,-37)
+ Add new error codes for the SSL bucket
+
+
+Serf 1.1.0 [2012-06-07, from /tags/1.1.0, r1617]
New: serf_bucket_request_set_CL() for C-L based, non-chunked requests
New: serf_ssl_server_cert_chain_callback_set() for full-chain validation
diff --git a/Makefile.in b/Makefile.in
index ba50496..911f725 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -10,7 +10,8 @@ SERF_DOTTED_VERSION=@SERF_DOTTED_VERSION@
OBJECTS = buckets/aggregate_buckets.lo buckets/request_buckets.lo context.lo \
buckets/buckets.lo buckets/simple_buckets.lo buckets/file_buckets.lo \
buckets/mmap_buckets.lo buckets/socket_buckets.lo \
- buckets/response_buckets.lo buckets/headers_buckets.lo \
+ buckets/response_body_buckets.lo buckets/response_buckets.lo \
+ buckets/headers_buckets.lo \
buckets/allocator.lo buckets/dechunk_buckets.lo \
buckets/deflate_buckets.lo buckets/limit_buckets.lo \
buckets/ssl_buckets.lo buckets/barrier_buckets.lo \
@@ -27,7 +28,8 @@ TEST_OBJECTS = test/serf_get.lo test/serf_response.lo test/serf_request.lo \
TEST_SUITE_OBJECTS = test/CuTest.lo test/test_all.lo test/test_util.lo \
test/test_buckets.lo test/test_context.lo \
- test/test_ssl.lo test/server/test_server.lo
+ test/test_ssl.lo test/server/test_server.lo \
+ test/server/test_sslserver.lo
PROGRAMS = $(TEST_OBJECTS:.lo=) test/test_all
@@ -69,6 +71,7 @@ buckets/simple_buckets.lo: buckets/simple_buckets.c $(HEADERS)
buckets/file_buckets.lo: buckets/file_buckets.c $(HEADERS)
buckets/mmap_buckets.lo: buckets/mmap_buckets.c $(HEADERS)
buckets/socket_buckets.lo: buckets/socket_buckets.c $(HEADERS)
+buckets/response_body_buckets.lo: buckets/response_body_buckets.c $(HEADERS)
buckets/response_buckets.lo: buckets/response_buckets.c $(HEADERS)
buckets/headers_buckets.lo: buckets/headers_buckets.c $(HEADERS)
buckets/allocator.lo: buckets/allocator.c $(HEADERS)
@@ -130,8 +133,8 @@ check: test/serf_response test/test_all
install: $(TARGET_LIB)
$(MKDIR) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir) $(DESTDIR)$(pkgconfigdir)
$(LIBTOOL) $(LTFLAGS) --mode=install $(INSTALL) -m 644 $(TARGET_LIB) $(DESTDIR)$(libdir)
- for i in $(srcdir)/*.h; do \
- $(INSTALL) -m 644 $$i $(DESTDIR)$(includedir); \
+ for i in $(HEADERS); do \
+ $(INSTALL) -m 644 $(srcdir)/$$i $(DESTDIR)$(includedir); \
done
$(INSTALL) -m 644 serf.pc $(DESTDIR)$(pkgconfigdir)/serf-$(SERF_MAJOR_VERSION).pc
diff --git a/auth/auth.c b/auth/auth.c
index 13f822b..c78b519 100644
--- a/auth/auth.c
+++ b/auth/auth.c
@@ -22,7 +22,8 @@
#include <apr_strings.h>
static apr_status_t
-default_auth_response_handler(int code,
+default_auth_response_handler(peer_t peer,
+ int code,
serf_connection_t *conn,
serf_request_t *request,
serf_bucket_t *response,
@@ -83,6 +84,16 @@ static const serf__authn_scheme_t serf_authn_schemes[] = {
serf__setup_request_kerb_auth,
serf__validate_response_kerb_auth,
},
+ {
+ 407,
+ "Negotiate",
+ SERF_AUTHN_NEGOTIATE,
+ serf__init_kerb,
+ serf__init_kerb_connection,
+ serf__handle_kerb_auth,
+ serf__setup_request_kerb_auth,
+ serf__validate_response_kerb_auth,
+ },
#endif
/* ADD NEW AUTHENTICATION IMPLEMENTATIONS HERE (as they're written) */
@@ -163,12 +174,18 @@ static int handle_auth_header(void *baton,
Note that we don't reuse the auth scheme stored in the context,
as that may have changed. (ex. fallback from ntlm to basic.) */
for (scheme = serf_authn_schemes; scheme->code != 0; ++scheme) {
- if (ab->code == scheme->code &&
- strcmp(auth_name, scheme->name) == 0 &&
- ctx->authn_types & scheme->type) {
+ if (! (ab->code == scheme->code &&
+ ctx->authn_types & scheme->type))
+ continue;
+
+ serf__log_skt(AUTH_VERBOSE, __FILE__, conn->skt,
+ "Client supports: %s\n", scheme->name);
+ if (strcmp(auth_name, scheme->name) == 0) {
serf__auth_handler_func_t handler = scheme->handle_func;
apr_status_t status = 0;
+ serf__log_skt(AUTH_VERBOSE, __FILE__, conn->skt,
+ "... matched: %s\n", scheme->name);
/* If this is the first time we use this scheme on this connection,
make sure to initialize the authentication handler first. */
if (ab->code == 401 && ctx->authn_info.scheme != scheme) {
@@ -254,6 +271,9 @@ static apr_status_t dispatch_auth(int code,
if (!auth_hdr) {
return SERF_ERROR_AUTHN_FAILED;
}
+ serf__log_skt(AUTH_VERBOSE, __FILE__, request->conn->skt,
+ "%s authz required. Response header(s): %s\n",
+ code == 401 ? "Server" : "Proxy", auth_hdr);
/* Iterate over all headers. Try to find a matching authentication scheme
handler.
@@ -274,9 +294,6 @@ static apr_status_t dispatch_auth(int code,
/* No matching authentication found. */
return SERF_ERROR_AUTHN_NOT_SUPPORTED;
}
- } else {
- /* Validate the response authn headers if needed. */
-
}
return APR_SUCCESS;
@@ -295,6 +312,8 @@ apr_status_t serf__handle_auth_response(int *consumed_response,
*consumed_response = 0;
+ /* TODO: the response bucket was created by the application, not at all
+ guaranteed that this is of type response_bucket!! */
status = serf_bucket_response_status(response, &sl);
if (SERF_BUCKET_READ_ERROR(status)) {
return status;
@@ -342,6 +361,34 @@ apr_status_t serf__handle_auth_response(int *consumed_response,
request->setup_baton);
return APR_EOF;
+ } else {
+ /* Validate the response authn headers if needed. */
+ serf__validate_response_func_t validate_resp;
+ serf_connection_t *conn = request->conn;
+ serf_context_t *ctx = conn->ctx;
+ apr_status_t resp_status = APR_SUCCESS;
+
+ if (ctx->authn_info.scheme) {
+ validate_resp = ctx->authn_info.scheme->validate_response_func;
+ resp_status = validate_resp(HOST, sl.code, conn, request, response,
+ pool);
+ }
+ if (!resp_status && ctx->proxy_authn_info.scheme) {
+ validate_resp = ctx->proxy_authn_info.scheme->validate_response_func;
+ resp_status = validate_resp(PROXY, sl.code, conn, request, response,
+ pool);
+ }
+ if (resp_status) {
+ /* If there was an error in the final step of the authentication,
+ consider the reponse body as invalid and discard it. */
+ status = discard_body(response);
+ *consumed_response = 1;
+ if (!APR_STATUS_IS_EOF(status)) {
+ return status;
+ }
+ /* The whole body was discarded, now return our error. */
+ return resp_status;
+ }
}
return APR_SUCCESS;
diff --git a/auth/auth.h b/auth/auth.h
index 1f2c751..4f075db 100644
--- a/auth/auth.h
+++ b/auth/auth.h
@@ -40,8 +40,10 @@ apr_status_t serf__handle_basic_auth(int code,
const char *auth_attr,
void *baton,
apr_pool_t *pool);
-apr_status_t serf__setup_request_basic_auth(int code,
+apr_status_t serf__setup_request_basic_auth(peer_t peer,
+ int code,
serf_connection_t *conn,
+ serf_request_t *request,
const char *method,
const char *uri,
serf_bucket_t *hdrs_bkt);
@@ -60,12 +62,15 @@ apr_status_t serf__handle_digest_auth(int code,
const char *auth_attr,
void *baton,
apr_pool_t *pool);
-apr_status_t serf__setup_request_digest_auth(int code,
+apr_status_t serf__setup_request_digest_auth(peer_t peer,
+ int code,
serf_connection_t *conn,
+ serf_request_t *request,
const char *method,
const char *uri,
serf_bucket_t *hdrs_bkt);
-apr_status_t serf__validate_response_digest_auth(int code,
+apr_status_t serf__validate_response_digest_auth(peer_t peer,
+ int code,
serf_connection_t *conn,
serf_request_t *request,
serf_bucket_t *response,
@@ -86,12 +91,15 @@ apr_status_t serf__handle_kerb_auth(int code,
const char *auth_attr,
void *baton,
apr_pool_t *pool);
-apr_status_t serf__setup_request_kerb_auth(int code,
+apr_status_t serf__setup_request_kerb_auth(peer_t peer,
+ int code,
serf_connection_t *conn,
+ serf_request_t *request,
const char *method,
const char *uri,
serf_bucket_t *hdrs_bkt);
-apr_status_t serf__validate_response_kerb_auth(int code,
+apr_status_t serf__validate_response_kerb_auth(peer_t peer,
+ int code,
serf_connection_t *conn,
serf_request_t *request,
serf_bucket_t *response,
diff --git a/auth/auth_basic.c b/auth/auth_basic.c
index b876cb8..7a0589c 100644
--- a/auth/auth_basic.c
+++ b/auth/auth_basic.c
@@ -130,8 +130,10 @@ serf__init_basic_connection(int code,
}
apr_status_t
-serf__setup_request_basic_auth(int code,
+serf__setup_request_basic_auth(peer_t peer,
+ int code,
serf_connection_t *conn,
+ serf_request_t *request,
const char *method,
const char *uri,
serf_bucket_t *hdrs_bkt)
@@ -139,7 +141,7 @@ serf__setup_request_basic_auth(int code,
serf_context_t *ctx = conn->ctx;
basic_authn_info_t *authn_info;
- if (code == 401) {
+ if (peer == HOST) {
authn_info = ctx->authn_info.baton;
} else {
authn_info = ctx->proxy_authn_info.baton;
diff --git a/auth/auth_digest.c b/auth/auth_digest.c
index 2e29180..1c4adf0 100644
--- a/auth/auth_digest.c
+++ b/auth/auth_digest.c
@@ -358,13 +358,15 @@ serf__init_digest_connection(int code,
}
apr_status_t
-serf__setup_request_digest_auth(int code,
+serf__setup_request_digest_auth(peer_t peer,
+ int code,
serf_connection_t *conn,
+ serf_request_t *request,
const char *method,
const char *uri,
serf_bucket_t *hdrs_bkt)
{
- digest_authn_info_t *digest_info = (code == 401) ? conn->authn_baton :
+ digest_authn_info_t *digest_info = (peer == HOST) ? conn->authn_baton :
conn->proxy_authn_baton;
apr_status_t status = APR_SUCCESS;
@@ -372,11 +374,13 @@ serf__setup_request_digest_auth(int code,
const char *value;
apr_uri_t parsed_uri;
- /* extract path from uri */
+ /* TODO: per request pool? */
+
+ /* Extract path from uri. */
status = apr_uri_parse(conn->pool, uri, &parsed_uri);
/* Build a new Authorization header. */
- digest_info->header = (code == 401) ? "Authorization" :
+ digest_info->header = (peer == HOST) ? "Authorization" :
"Proxy-Authorization";
value = build_auth_header(digest_info, parsed_uri.path, method,
conn->pool);
@@ -384,13 +388,19 @@ serf__setup_request_digest_auth(int code,
serf_bucket_headers_setn(hdrs_bkt, digest_info->header,
value);
digest_info->digest_nc++;
+
+ /* Store the uri of this request on the serf_request_t object, to make
+ it available when validating the Authentication-Info header of the
+ matching response. */
+ request->auth_baton = parsed_uri.path;
}
return status;
}
apr_status_t
-serf__validate_response_digest_auth(int code,
+serf__validate_response_digest_auth(peer_t peer,
+ int code,
serf_connection_t *conn,
serf_request_t *request,
serf_bucket_t *response,
@@ -403,13 +413,13 @@ serf__validate_response_digest_auth(int code,
const char *qop = NULL;
const char *nc_str = NULL;
serf_bucket_t *hdrs;
- digest_authn_info_t *digest_info = (code == 401) ? conn->authn_baton :
+ digest_authn_info_t *digest_info = (peer == HOST) ? conn->authn_baton :
conn->proxy_authn_baton;
hdrs = serf_bucket_response_get_headers(response);
/* Need a copy cuz we're going to write NUL characters into the string. */
- if (code == 401)
+ if (peer == HOST)
auth_attr = apr_pstrdup(pool,
serf_bucket_headers_get(hdrs, "Authentication-Info"));
else
@@ -457,8 +467,9 @@ serf__validate_response_digest_auth(int code,
if (rspauth) {
const char *ha2, *tmp, *resp_hdr_hex;
unsigned char resp_hdr[APR_MD5_DIGESTSIZE];
+ const char *req_uri = request->auth_baton;
- ha2 = build_digest_ha2(conn->host_info.path, "", qop, pool);
+ ha2 = build_digest_ha2(req_uri, "", qop, pool);
tmp = apr_psprintf(pool, "%s:%s:%s:%s:%s:%s",
digest_info->ha1, digest_info->nonce, nc_str,
digest_info->cnonce, digest_info->qop, ha2);
diff --git a/auth/auth_kerb.c b/auth/auth_kerb.c
index f9be9a4..27fb968 100644
--- a/auth/auth_kerb.c
+++ b/auth/auth_kerb.c
@@ -17,7 +17,10 @@
#ifdef SERF_HAVE_KERB
-/*** Kerberos authentication ***/
+/** These functions implement SPNEGO-based Kerberos and NTLM authentication,
+ * using either GSS-API (RFC 2743) or SSPI on Windows.
+ * The HTTP message exchange is documented in RFC 4559.
+ **/
#include <serf.h>
#include <serf_private.h>
@@ -27,20 +30,13 @@
#include <apr_base64.h>
#include <apr_strings.h>
-/** These functions implements Kerberos authentication, using GSS-API
- * (RFC 2743). The message-exchange is documented in RFC 4559.
- *
- * Note: this implementation uses gssapi and only works on *nix.
- **/
-
/** TODO:
+ ** - This implements the SPNEGO mechanism, not Kerberos directly. Adapt
+ ** filename, functions & comments.
** - send session key directly on new connections where we already know
** the server requires Kerberos authn.
- ** - fix authn status, as the COMPLETE/CONTINUE status values
- ** are never used.
** - Add a way for serf to give detailed error information back to the
** application.
- ** - proxy support
**/
/* Authentication over HTTP using Kerberos
@@ -72,30 +68,95 @@
* WWW-Authenticate: Negotiate <Base64 encoded server
* authentication data>
*
- * -> The server returned a key to proof itself to us. We check this key
- * with the TGS again.
+ * -> The server returned an (optional) key to proof itself to us. We check this
+ * key with the TGS again. If it checks out, we can return the response
+ * body to the application.
*
- * Note: It's possible that the server returns 401 again in step 3, if the
- * Kerberos context isn't complete yet. Some (simple) tests with
- * mod_auth_kerb and MIT Kerberos 5 show this never happens.
+ * Note: It's possible that the server returns 401 again in step 2, if the
+ * Kerberos context isn't complete yet. This means there is 3rd step
+ * where we'll send a request with an Authorization header to the
+ * server. Some (simple) tests with mod_auth_kerb and MIT Kerberos 5 show
+ * this never happens.
*
- * This handshake is required for every new connection. If the handshake is
- * completed successfully, all other requests on the same connection will
- * be authenticated without needing to pass the WWW-Authenticate header.
+ * Depending on the type of HTTP server, this handshake is required for either
+ * every new connection, or for every new request! For more info see the next
+ * comment on authn_persistence_state_t.
*
* Note: Step 1 of the handshake will only happen on the first connection, once
* we know the server requires Kerberos authentication, the initial requests
- * on the other connections will include a session key, so we start at
+ * on the other connections will include a session key, so we start at
* step 2 in the handshake.
* ### TODO: Not implemented yet!
*/
+/* Current state of the authentication of the current request. */
typedef enum {
gss_api_auth_not_started,
gss_api_auth_in_progress,
gss_api_auth_completed,
} gss_api_auth_state;
+/**
+ authn_persistence_state_t: state that indicates if we are talking with a
+ server that requires authentication only of the first request (stateful),
+ or of each request (stateless).
+
+ INIT: Begin state. Authenticating the first request on this connection.
+ UNDECIDED: we haven't identified the server yet, assume STATEFUL for now.
+ Pipeline mode disabled, requests are sent only after the response off the
+ previous request arrived.
+ STATELESS: we know the server requires authentication for each request.
+ On all new requests add the Authorization header with an initial SPNEGO
+ token (created per request).
+ To keep things simple, keep the connection in one by one mode.
+ (otherwise we'd have to keep a queue of gssapi context objects to match
+ the Negotiate header of the response with the session initiated by the
+ mathing request).
+ This state is an final state.
+ STATEFUL: alright, we have authenticated the connection and for the server
+ that is enough. Don't add an Authorization header to new requests.
+ Serf will switch to pipelined mode.
+ This state is not a final state, although in practical scenario's it will
+ be. When we receive a 40x response from the server switch to STATELESS
+ mode.
+
+ We start in state init for the first request until it is authenticated.
+
+ The rest of the state machine starts with the arrival of the response to the
+ second request, and then goes on with each response:
+
+ --------
+ | INIT | C --> S: GET request in response to 40x of the server
+ -------- add [Proxy]-Authorization header
+ |
+ |
+ ------------
+ | UNDECIDED| C --> S: GET request, assume stateful,
+ ------------ no [Proxy]-Authorization header
+ |
+ |
+ |------------------------------------------------
+ | |
+ | C <-- S: 40x Authentication | C <-- S: 200 OK
+ | Required |
+ | |
+ v v
+ ------------- ------------
+ ->| STATELESS |<------------------------------| STATEFUL |<--
+ | ------------- C <-- S: 40x ------------ |
+ * | | Authentication | | 200 OK
+ | / Required | |
+ ----- -----/
+
+ **/
+typedef enum {
+ pstate_init,
+ pstate_undecided,
+ pstate_stateless,
+ pstate_stateful,
+} authn_persistence_state_t;
+
+
/* HTTP Service name, used to get the session key. */
#define KRB_HTTP_SERVICE "HTTP"
@@ -110,6 +171,9 @@ typedef struct
/* Current state of the authentication cycle. */
gss_api_auth_state state;
+ /* Current persistence state. */
+ authn_persistence_state_t pstate;
+
const char *header;
const char *value;
} gss_authn_info_t;
@@ -157,8 +221,7 @@ gss_api_get_credentials(char *token, apr_size_t token_len,
status = APR_SUCCESS;
break;
default:
- status = SERF_ERROR_AUTHN_FAILED;
- break;
+ return status;
}
/* Return the session key to our caller. */
@@ -168,65 +231,109 @@ gss_api_get_credentials(char *token, apr_size_t token_len,
return status;
}
-/* Read the header sent by the server (if any), invoke the gssapi authn
- code and use the resulting Server Ticket on the next request to the
+/* do_auth is invoked in two situations:
+ - when a response from a server is received that contains an authn header
+ (either from a 40x or 2xx response)
+ - when a request is prepared on a connection with stateless authentication.
+
+ Read the header sent by the server (if any), invoke the gssapi authn
+ code and use the resulting Server Ticket on the next request to the
server. */
static apr_status_t
-do_auth(int code,
+do_auth(peer_t peer,
+ int code,
gss_authn_info_t *gss_info,
serf_connection_t *conn,
const char *auth_hdr,
apr_pool_t *pool)
{
serf_context_t *ctx = conn->ctx;
- serf__authn_info_t *authn_info = (code == 401) ? &ctx->authn_info :
+ serf__authn_info_t *authn_info = (peer == HOST) ? &ctx->authn_info :
&ctx->proxy_authn_info;
const char *tmp = NULL;
char *token = NULL;
apr_size_t tmp_len = 0, token_len = 0;
- const char *space = NULL;
apr_status_t status;
- /* The server will return a token as attribute to the Negotiate key.
- Negotiate YGwGCSqGSIb3EgECAgIAb10wW6ADAgEFoQMCAQ+iTzBNoAMCARCiRgREa6mouM
- BAMFqKVdTGtfpZNXKzyw4Yo1paphJdIA3VOgncaoIlXxZLnkHiIHS2v65pVvrp
- bRIyjF8xve9HxpnNIucCY9c=
+ /* Is this a response from a host/proxy? auth_hdr should always be set. */
+ if (code && auth_hdr) {
+ const char *space = NULL;
+ /* The server will return a token as attribute to the Negotiate key.
+ Negotiate YGwGCSqGSIb3EgECAgIAb10wW6ADAgEFoQMCAQ+iTzBNoAMCARCiRgREa6
+ mouMBAMFqKVdTGtfpZNXKzyw4Yo1paphJdIA3VOgncaoIlXxZLnkHiIHS2v65pVvrp
+ bRIyjF8xve9HxpnNIucCY9c=
- Read this base64 value, decode it and validate it so we're sure the server
- is who we expect it to be. */
- if (auth_hdr)
+ Read this base64 value, decode it and validate it so we're sure the
+ server is who we expect it to be. */
space = strchr(auth_hdr, ' ');
- if (space) {
- token = apr_palloc(pool, apr_base64_decode_len(space + 1));
- token_len = apr_base64_decode(token, space + 1);
+ if (space) {
+ token = apr_palloc(pool, apr_base64_decode_len(space + 1));
+ token_len = apr_base64_decode(token, space + 1);
+ }
+ } else {
+ /* This is a new request, not a retry in response to a 40x of the
+ host/proxy.
+ Only add the Authorization header if we know the server requires
+ per-request authentication (stateless). */
+ if (gss_info->pstate != pstate_stateless)
+ return APR_SUCCESS;
}
- /* We can get a whole batch of 401 responses from the server, but we should
- only start the authentication phase once, so if we started authentication
- already ignore all responses with initial Negotiate authentication header.
+ switch(gss_info->pstate) {
+ case pstate_init:
+ /* Nothing to do here */
+ break;
+ case pstate_undecided: /* Fall through */
+ case pstate_stateful:
+ {
+ /* Switch to stateless mode, from now on handle authentication
+ of each request with a new gss context. This is easiest to
+ manage when sending requests one by one. */
+ serf__log_skt(AUTH_VERBOSE, __FILE__, conn->skt,
+ "Server requires per-request SPNEGO authn, "
+ "switching to stateless mode.\n");
+
+ gss_info->pstate = pstate_stateless;
+ serf_connection_set_max_outstanding_requests(conn, 1);
+ break;
+ }
+ case pstate_stateless:
+ /* Nothing to do here */
+ break;
+ }
- Note: as we set the max. transfer rate to one message at a time until the
- authentication cycle is finished, this check shouldn't be needed. */
- if (!token && gss_info->state != gss_api_auth_not_started)
- return APR_SUCCESS;
+ /* If the server didn't provide us with a token, start with a new initial
+ step in the SPNEGO authentication. */
+ if (!token) {
+ serf__kerb_reset_sec_context(gss_info->gss_ctx);
+ gss_info->state = gss_api_auth_not_started;
+ }
- status = gss_api_get_credentials(token, token_len, conn->host_info.hostname,
- &tmp, &tmp_len,
- gss_info);
+ if (peer == HOST) {
+ status = gss_api_get_credentials(token, token_len,
+ conn->host_info.hostname,
+ &tmp, &tmp_len,
+ gss_info);
+ } else {
+ char *proxy_host;
+ apr_getnameinfo(&proxy_host, conn->ctx->proxy_address, 0);
+ status = gss_api_get_credentials(token, token_len, proxy_host,
+ &tmp, &tmp_len,
+ gss_info);
+ }
if (status)
return status;
- serf__encode_auth_header(&gss_info->value, authn_info->scheme->name,
- tmp,
- tmp_len,
- pool);
- gss_info->header = (code == 401) ? "Authorization" : "Proxy-Authorization";
-
- /* If the handshake is finished tell serf it can send as much requests as it
- likes. */
- if (gss_info->state == gss_api_auth_completed)
- serf_connection_set_max_outstanding_requests(conn, 0);
+ /* On the next request, add an Authorization header. */
+ if (tmp_len) {
+ serf__encode_auth_header(&gss_info->value, authn_info->scheme->name,
+ tmp,
+ tmp_len,
+ pool);
+ gss_info->header = (peer == HOST) ?
+ "Authorization" : "Proxy-Authorization";
+ }
return APR_SUCCESS;
}
@@ -252,6 +359,7 @@ serf__init_kerb_connection(int code,
gss_info = apr_pcalloc(pool, sizeof(*gss_info));
gss_info->pool = conn->pool;
gss_info->state = gss_api_auth_not_started;
+ gss_info->pstate = pstate_init;
status = serf__kerb_create_sec_context(&gss_info->gss_ctx, pool,
gss_info->pool);
@@ -268,10 +376,13 @@ serf__init_kerb_connection(int code,
/* Make serf send the initial requests one by one */
serf_connection_set_max_outstanding_requests(conn, 1);
+ serf__log_skt(AUTH_VERBOSE, __FILE__, conn->skt,
+ "Initialized Kerberos context for this connection.\n");
+
return APR_SUCCESS;
}
-/* A 401 response was received, handle the authentication. */
+/* A 40x response was received, handle the authentication. */
apr_status_t
serf__handle_kerb_auth(int code,
serf_request_t *request,
@@ -285,7 +396,8 @@ serf__handle_kerb_auth(int code,
gss_authn_info_t *gss_info = (code == 401) ? conn->authn_baton :
conn->proxy_authn_baton;
- return do_auth(code,
+ return do_auth(code == 401 ? HOST : PROXY,
+ code,
gss_info,
request->conn,
auth_hdr,
@@ -294,26 +406,80 @@ serf__handle_kerb_auth(int code,
/* Setup the authn headers on this request message. */
apr_status_t
-serf__setup_request_kerb_auth(int code,
+serf__setup_request_kerb_auth(peer_t peer,
+ int code,
serf_connection_t *conn,
+ serf_request_t *request,
const char *method,
const char *uri,
serf_bucket_t *hdrs_bkt)
{
- gss_authn_info_t *gss_info = (code == 401) ? conn->authn_baton :
+ gss_authn_info_t *gss_info = (peer == HOST) ? conn->authn_baton :
conn->proxy_authn_baton;
+ /* If we have an ongoing authentication handshake, the handler of the
+ previous response will have created the authn headers for this request
+ already. */
if (gss_info && gss_info->header && gss_info->value) {
+ serf__log_skt(AUTH_VERBOSE, __FILE__, conn->skt,
+ "Set Negotiate authn header on retried request.\n");
+
serf_bucket_headers_setn(hdrs_bkt, gss_info->header,
gss_info->value);
/* We should send each token only once. */
gss_info->header = NULL;
gss_info->value = NULL;
+
return APR_SUCCESS;
}
- return SERF_ERROR_AUTHN_FAILED;
+ switch (gss_info->pstate) {
+ case pstate_init:
+ /* We shouldn't normally arrive here, do nothing. */
+ break;
+ case pstate_undecided: /* fall through */
+ serf__log_skt(AUTH_VERBOSE, __FILE__, conn->skt,
+ "Assume for now that the server supports persistent "
+ "SPNEGO authentication.\n");
+ /* Nothing to do here. */
+ break;
+ case pstate_stateful:
+ serf__log_skt(AUTH_VERBOSE, __FILE__, conn->skt,
+ "SPNEGO on this connection is persistent, "
+ "don't set authn header on next request.\n");
+ /* Nothing to do here. */
+ break;
+ case pstate_stateless:
+ {
+ apr_status_t status;
+
+ /* Authentication on this connection is known to be stateless.
+ Add an initial Negotiate token for the server, to bypass the
+ 40x response we know we'll otherwise receive.
+ (RFC 4559 section 4.2) */
+ serf__log_skt(AUTH_VERBOSE, __FILE__, conn->skt,
+ "Add initial Negotiate header to request.\n");
+
+ status = do_auth(peer,
+ code,
+ gss_info,
+ conn,
+ 0l, /* no response authn header */
+ conn->pool);
+ if (status)
+ return status;
+
+ serf_bucket_headers_setn(hdrs_bkt, gss_info->header,
+ gss_info->value);
+ /* We should send each token only once. */
+ gss_info->header = NULL;
+ gss_info->value = NULL;
+ break;
+ }
+ }
+
+ return APR_SUCCESS;
}
/* Function is called when 2xx responses are received. Normally we don't
@@ -322,26 +488,62 @@ serf__setup_request_kerb_auth(int code,
* data which should be validated by the client (mutual authentication).
*/
apr_status_t
-serf__validate_response_kerb_auth(int code,
- serf_connection_t *conn,
- serf_request_t *request,
- serf_bucket_t *response,
- apr_pool_t *pool)
+serf__validate_response_kerb_auth(peer_t peer,
+ int code,
+ serf_connection_t *conn,
+ serf_request_t *request,
+ serf_bucket_t *response,
+ apr_pool_t *pool)
{
- gss_authn_info_t *gss_info = (code == 401) ? conn->authn_baton :
- conn->proxy_authn_baton;
- serf_bucket_t *hdrs;
- const char *auth_hdr;
-
- hdrs = serf_bucket_response_get_headers(response);
- auth_hdr = serf_bucket_headers_get(hdrs, "WWW-Authenticate");
+ gss_authn_info_t *gss_info;
+ const char *auth_hdr_name;
+
+ /* TODO: currently this function is only called when a response includes
+ an Authenticate header. This header is optional. If the server does
+ not provide this header on the first 2xx response, we will not promote
+ the connection from undecided to stateful. This won't break anything,
+ but means we stay in non-pipelining mode. */
+ serf__log_skt(AUTH_VERBOSE, __FILE__, conn->skt,
+ "Validate Negotiate response header.\n");
+
+ if (peer == HOST) {
+ gss_info = conn->authn_baton;
+ auth_hdr_name = "WWW-Authenticate";
+ } else {
+ gss_info = conn->proxy_authn_baton;
+ auth_hdr_name = "Proxy-Authenticate";
+ }
if (gss_info->state != gss_api_auth_completed) {
- return do_auth(code,
- gss_info,
- conn,
- auth_hdr,
- pool);
+ serf_bucket_t *hdrs;
+ const char *auth_hdr_val;
+ apr_status_t status;
+
+ hdrs = serf_bucket_response_get_headers(response);
+ auth_hdr_val = serf_bucket_headers_get(hdrs, auth_hdr_name);
+
+ status = do_auth(peer, code, gss_info, conn, auth_hdr_val, pool);
+ if (status)
+ return status;
+ }
+
+ if (gss_info->state == gss_api_auth_completed) {
+ switch(gss_info->pstate) {
+ case pstate_init:
+ /* Authentication of the first request is done. */
+ gss_info->pstate = pstate_undecided;
+ break;
+ case pstate_undecided:
+ /* The server didn't request for authentication even though
+ we didn't add an Authorization header to previous
+ request. That means it supports persistent authentication. */
+ gss_info->pstate = pstate_stateful;
+ serf_connection_set_max_outstanding_requests(conn, 0);
+ break;
+ default:
+ /* Nothing to do here. */
+ break;
+ }
}
return APR_SUCCESS;
diff --git a/auth/auth_kerb.h b/auth/auth_kerb.h
index a0689c1..0972c56 100644
--- a/auth/auth_kerb.h
+++ b/auth/auth_kerb.h
@@ -94,6 +94,15 @@ serf__kerb_init_sec_context(serf__kerb_context_t *ctx,
apr_pool_t *result_pool
);
+/*
+ * Reset a previously created security context so we can start with a new one.
+ *
+ * This is triggered when the server requires per-request authentication,
+ * where each request requires a new security context.
+ */
+apr_status_t
+serf__kerb_reset_sec_context(serf__kerb_context_t *ctx);
+
#ifdef __cplusplus
}
#endif
diff --git a/auth/auth_kerb_gss.c b/auth/auth_kerb_gss.c
index b7267d6..69d93ab 100644
--- a/auth/auth_kerb_gss.c
+++ b/auth/auth_kerb_gss.c
@@ -13,21 +13,69 @@
* limitations under the License.
*/
+#include "serf.h"
+#include "serf_private.h"
#include "auth_kerb.h"
#ifdef SERF_USE_GSSAPI
#include <apr_strings.h>
#include <gssapi/gssapi.h>
+
+/* This module can support all authentication mechanisms as provided by
+ the GSS-API implementation, but for now it only supports SPNEGO for
+ Negotiate.
+ SPNEGO can delegate authentication to Kerberos if supported by the
+ host. */
+
+#ifndef GSS_SPNEGO_MECHANISM
+static gss_OID_desc spnego_mech_oid = { 6, "\x2b\x06\x01\x05\x05\x02" };
+#define GSS_SPNEGO_MECHANISM &spnego_mech_oid
+#endif
+
struct serf__kerb_context_t
{
/* GSSAPI context */
gss_ctx_id_t gss_ctx;
- /* Mechanism used to authenticate, should be Kerberos. */
+ /* Mechanism used to authenticate. */
gss_OID gss_mech;
};
+static void
+log_error(int verbose_flag, const char *filename,
+ serf__kerb_context_t *ctx,
+ OM_uint32 err_maj_stat,
+ OM_uint32 err_min_stat,
+ const char *msg)
+{
+ OM_uint32 maj_stat, min_stat;
+ gss_buffer_desc stat_buff;
+ OM_uint32 msg_ctx = 0;
+
+ if (verbose_flag) {
+ maj_stat = gss_display_status(&min_stat,
+ err_maj_stat,
+ GSS_C_GSS_CODE,
+ ctx->gss_mech,
+ &msg_ctx,
+ &stat_buff);
+ if (maj_stat == GSS_S_COMPLETE ||
+ maj_stat == GSS_S_FAILURE) {
+ maj_stat = gss_display_status(&min_stat,
+ err_min_stat,
+ GSS_C_MECH_CODE,
+ ctx->gss_mech,
+ &msg_ctx,
+ &stat_buff);
+ }
+
+ serf__log(verbose_flag, filename,
+ "%s (%x,%d): %s\n", msg,
+ err_maj_stat, err_min_stat, stat_buff.value);
+ }
+}
+
/* Cleans the GSS context object, when the pool used to create it gets
cleared or destroyed. */
static apr_status_t
@@ -66,7 +114,7 @@ serf__kerb_create_sec_context(serf__kerb_context_t **ctx_p,
ctx = apr_pcalloc(result_pool, sizeof(*ctx));
ctx->gss_ctx = GSS_C_NO_CONTEXT;
- ctx->gss_mech = GSS_C_NO_OID;
+ ctx->gss_mech = GSS_SPNEGO_MECHANISM;
apr_pool_cleanup_register(result_pool, ctx,
cleanup_ctx,
@@ -78,6 +126,19 @@ serf__kerb_create_sec_context(serf__kerb_context_t **ctx_p,
}
apr_status_t
+serf__kerb_reset_sec_context(serf__kerb_context_t *ctx)
+{
+ OM_uint32 dummy_stat;
+
+ if (ctx->gss_ctx)
+ (void)gss_delete_sec_context(&dummy_stat, &ctx->gss_ctx,
+ GSS_C_NO_BUFFER);
+ ctx->gss_ctx = GSS_C_NO_CONTEXT;
+
+ return APR_SUCCESS;
+}
+
+apr_status_t
serf__kerb_init_sec_context(serf__kerb_context_t *ctx,
const char *service,
const char *hostname,
@@ -92,11 +153,15 @@ serf__kerb_init_sec_context(serf__kerb_context_t *ctx,
OM_uint32 gss_min_stat, gss_maj_stat;
gss_name_t host_gss_name;
gss_buffer_desc bufdesc;
+ gss_OID dummy; /* unused */
/* Get the name for the HTTP service at the target host. */
+ /* TODO: should be shared between multiple requests. */
bufdesc.value = apr_pstrcat(scratch_pool, service, "@", hostname, NULL);
bufdesc.length = strlen(bufdesc.value);
- gss_maj_stat = gss_import_name (&gss_min_stat, &bufdesc, GSS_C_NT_HOSTBASED_SERVICE,
+ serf__log(AUTH_VERBOSE, __FILE__, "Get principal for %s\n", bufdesc.value);
+ gss_maj_stat = gss_import_name (&gss_min_stat, &bufdesc,
+ GSS_C_NT_HOSTBASED_SERVICE,
&host_gss_name);
if(GSS_ERROR(gss_maj_stat)) {
return APR_EGENERAL;
@@ -115,12 +180,12 @@ serf__kerb_init_sec_context(serf__kerb_context_t *ctx,
GSS_C_NO_CREDENTIAL, /* XXXXX claimant_cred_handle */
&ctx->gss_ctx, /* gssapi context handle */
host_gss_name, /* HTTP@server name */
- ctx->gss_mech, /* mech_type (0 ininitially */
+ ctx->gss_mech, /* mech_type (SPNEGO) */
GSS_C_MUTUAL_FLAG, /* ensure the peer authenticates itself */
0, /* default validity period */
GSS_C_NO_CHANNEL_BINDINGS, /* do not use channel bindings */
&gss_input_buf, /* server token, initially empty */
- &ctx->gss_mech, /* actual mech type */
+ &dummy, /* actual mech type */
gss_output_buf_p, /* output_token */
NULL, /* ret_flags */
NULL /* not interested in remaining validity */
@@ -139,6 +204,9 @@ serf__kerb_init_sec_context(serf__kerb_context_t *ctx,
case GSS_S_CONTINUE_NEEDED:
return APR_EAGAIN;
default:
+ log_error(AUTH_VERBOSE, __FILE__, ctx,
+ gss_maj_stat, gss_min_stat,
+ "Error during Kerberos handshake");
return APR_EGENERAL;
}
}
diff --git a/auth/auth_kerb_sspi.c b/auth/auth_kerb_sspi.c
index db28ab1..ba023cb 100644
--- a/auth/auth_kerb_sspi.c
+++ b/auth/auth_kerb_sspi.c
@@ -14,6 +14,7 @@
*/
#include "auth_kerb.h"
+#include "serf.h"
#ifdef SERF_USE_SSPI
#include <apr.h>
@@ -22,6 +23,11 @@
#define SECURITY_WIN32
#include <sspi.h>
+/* SEC_E_MUTUAL_AUTH_FAILED is not defined in Windows Platform SDK 5.0. */
+#ifndef SEC_E_MUTUAL_AUTH_FAILED
+#define SEC_E_MUTUAL_AUTH_FAILED _HRESULT_TYPEDEF_(0x80090363L)
+#endif
+
struct serf__kerb_context_t
{
CredHandle sspi_credentials;
@@ -29,6 +35,45 @@ struct serf__kerb_context_t
BOOL initalized;
};
+/* Map SECURITY_STATUS from SSPI to APR error code. Some error codes mapped
+ * to our own codes and some to Win32 error codes:
+ * http://support.microsoft.com/kb/113996
+ */
+static apr_status_t
+map_sspi_status(SECURITY_STATUS sspi_status)
+{
+ switch(sspi_status)
+ {
+ case SEC_E_INSUFFICIENT_MEMORY:
+ return APR_FROM_OS_ERROR(ERROR_NO_SYSTEM_RESOURCES);
+ case SEC_E_INVALID_HANDLE:
+ return APR_FROM_OS_ERROR(ERROR_INVALID_HANDLE);
+ case SEC_E_UNSUPPORTED_FUNCTION:
+ return APR_FROM_OS_ERROR(ERROR_INVALID_FUNCTION);
+ case SEC_E_TARGET_UNKNOWN:
+ return APR_FROM_OS_ERROR(ERROR_BAD_NETPATH);
+ case SEC_E_INTERNAL_ERROR:
+ return APR_FROM_OS_ERROR(ERROR_INTERNAL_ERROR);
+ case SEC_E_SECPKG_NOT_FOUND:
+ case SEC_E_BAD_PKGID:
+ return APR_FROM_OS_ERROR(ERROR_NO_SUCH_PACKAGE);
+ case SEC_E_NO_IMPERSONATION:
+ return APR_FROM_OS_ERROR(ERROR_CANNOT_IMPERSONATE);
+ case SEC_E_NO_AUTHENTICATING_AUTHORITY:
+ return APR_FROM_OS_ERROR(ERROR_NO_LOGON_SERVERS);
+ case SEC_E_UNTRUSTED_ROOT:
+ return APR_FROM_OS_ERROR(ERROR_TRUST_FAILURE);
+ case SEC_E_WRONG_PRINCIPAL:
+ return APR_FROM_OS_ERROR(ERROR_WRONG_TARGET_NAME);
+ case SEC_E_MUTUAL_AUTH_FAILED:
+ return APR_FROM_OS_ERROR(ERROR_MUTUAL_AUTH_FAILED);
+ case SEC_E_TIME_SKEW:
+ return APR_FROM_OS_ERROR(ERROR_TIME_SKEW);
+ default:
+ return SERF_ERROR_AUTHN_FAILED;
+ }
+}
+
/* Cleans the SSPI context object, when the pool used to create it gets
cleared or destroyed. */
static apr_status_t
@@ -81,7 +126,7 @@ serf__kerb_create_sec_context(serf__kerb_context_t **ctx_p,
&ctx->sspi_credentials, NULL);
if (FAILED(sspi_status)) {
- return APR_EGENERAL;
+ return map_sspi_status(sspi_status);
}
*ctx_p = ctx;
@@ -116,6 +161,19 @@ get_canonical_hostname(const char **canonname,
}
apr_status_t
+serf__kerb_reset_sec_context(serf__kerb_context_t *ctx)
+{
+ if (SecIsValidHandle(&ctx->sspi_context)) {
+ DeleteSecurityContext(&ctx->sspi_context);
+ SecInvalidateHandle(&ctx->sspi_context);
+ }
+
+ ctx->initalized = FALSE;
+
+ return APR_SUCCESS;
+}
+
+apr_status_t
serf__kerb_init_sec_context(serf__kerb_context_t *ctx,
const char *service,
const char *hostname,
@@ -203,8 +261,8 @@ serf__kerb_init_sec_context(serf__kerb_context_t *ctx,
return APR_SUCCESS;
default:
- return APR_EGENERAL;
+ return map_sspi_status(status);
}
}
-#endif /* SERF_USE_SSPI */ \ No newline at end of file
+#endif /* SERF_USE_SSPI */
diff --git a/buckets/allocator.c b/buckets/allocator.c
index 857cc74..108167e 100644
--- a/buckets/allocator.c
+++ b/buckets/allocator.c
@@ -144,14 +144,14 @@ serf_bucket_alloc_t *serf_bucket_allocator_create(
}
#endif
- /* ### this implies buckets cannot cross a fork/exec. desirable?
- *
- * ### hmm. it probably also means that buckets cannot be AROUND
- * ### during a fork/exec. the new process will try to clean them
- * ### up and figure out there are unfreed blocks...
- */
+ /* NOTE: On a fork/exec, the child won't bother cleaning up memory.
+ This is just fine... the memory will go away at exec.
+
+ NOTE: If the child will NOT perform an exec, then the parent or
+ the child will need to decide who to clean up any
+ outstanding connection/buckets (as appropriate). */
apr_pool_cleanup_register(pool, allocator,
- allocator_cleanup, allocator_cleanup);
+ allocator_cleanup, apr_pool_cleanup_null);
return allocator;
}
diff --git a/buckets/buckets.c b/buckets/buckets.c
index 29175ff..72b3913 100644
--- a/buckets/buckets.c
+++ b/buckets/buckets.c
@@ -464,11 +464,10 @@ apr_status_t serf_linebuf_fetch(
/* Whatever was read, the line is now ready for use. */
linebuf->state = SERF_LINEBUF_READY;
+ } else {
+ /* no data available, try again later. */
+ return APR_EAGAIN;
}
- /* ### we need data. gotta check this char. bail if zero?! */
- /* else len == 0 */
-
- /* ### status */
}
else {
int found;
@@ -536,3 +535,80 @@ apr_status_t serf_linebuf_fetch(
}
/* NOTREACHED */
}
+
+/* Logging functions.
+ Use with one of the [COMP]_VERBOSE defines so that the compiler knows to
+ optimize this code out when no logging is needed. */
+static void log_time()
+{
+ apr_time_exp_t tm;
+
+ apr_time_exp_lt(&tm, apr_time_now());
+ fprintf(stderr, "[%d-%02d-%02dT%02d:%02d:%02d.%06d%+03d] ",
+ 1900 + tm.tm_year, 1 + tm.tm_mon, tm.tm_mday,
+ tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_usec,
+ tm.tm_gmtoff/3600);
+}
+
+void serf__log(int verbose_flag, const char *filename, const char *fmt, ...)
+{
+ va_list argp;
+
+ if (verbose_flag) {
+ log_time();
+
+ if (filename)
+ fprintf(stderr, "%s: ", filename);
+
+ va_start(argp, fmt);
+ vfprintf(stderr, fmt, argp);
+ va_end(argp);
+ }
+}
+
+void serf__log_nopref(int verbose_flag, const char *fmt, ...)
+{
+ va_list argp;
+
+ if (verbose_flag) {
+ va_start(argp, fmt);
+ vfprintf(stderr, fmt, argp);
+ va_end(argp);
+ }
+}
+
+void serf__log_skt(int verbose_flag, const char *filename, apr_socket_t *skt,
+ const char *fmt, ...)
+{
+ va_list argp;
+
+ if (verbose_flag) {
+ apr_sockaddr_t *sa;
+ log_time();
+
+ if (skt) {
+ /* Log local and remote ip address:port */
+ fprintf(stderr, "[l:");
+ if (apr_socket_addr_get(&sa, APR_LOCAL, skt) == APR_SUCCESS) {
+ char buf[32];
+ apr_sockaddr_ip_getbuf(buf, 32, sa);
+ fprintf(stderr, "%s:%d", buf, sa->port);
+ }
+ fprintf(stderr, " r:");
+ if (apr_socket_addr_get(&sa, APR_REMOTE, skt) == APR_SUCCESS) {
+ char buf[32];
+ apr_sockaddr_ip_getbuf(buf, 32, sa);
+ fprintf(stderr, "%s:%d", buf, sa->port);
+ }
+ fprintf(stderr, "] ");
+ }
+
+ if (filename)
+ fprintf(stderr, "%s: ", filename);
+
+ va_start(argp, fmt);
+ vfprintf(stderr, fmt, argp);
+ va_end(argp);
+ }
+}
+
diff --git a/buckets/dechunk_buckets.c b/buckets/dechunk_buckets.c
index 28dd671..262cffb 100644
--- a/buckets/dechunk_buckets.c
+++ b/buckets/dechunk_buckets.c
@@ -135,6 +135,11 @@ static apr_status_t serf_dechunk_read(serf_bucket_t *bucket,
ctx->body_left = 2; /* CRLF */
}
+ /* We need more data but there is no more available. */
+ if (ctx->body_left && APR_STATUS_IS_EOF(status)) {
+ return SERF_ERROR_TRUNCATED_HTTP_RESPONSE;
+ }
+
/* Return the data we just read. */
return status;
@@ -148,6 +153,11 @@ static apr_status_t serf_dechunk_read(serf_bucket_t *bucket,
* if we're done reading the chunk terminator.
*/
ctx->body_left -= *len;
+
+ /* We need more data but there is no more available. */
+ if (ctx->body_left && APR_STATUS_IS_EOF(status))
+ return SERF_ERROR_TRUNCATED_HTTP_RESPONSE;
+
if (!ctx->body_left) {
ctx->state = STATE_SIZE;
}
diff --git a/buckets/headers_buckets.c b/buckets/headers_buckets.c
index 8bf91b4..1c37ef0 100644
--- a/buckets/headers_buckets.c
+++ b/buckets/headers_buckets.c
@@ -163,11 +163,11 @@ const char *serf_bucket_headers_get(
be comma-separated, that is clearly the correct behavior;
for others, the correct behavior is undefined anyway. */
- /* The "+1" is for the comma; serf_bstrmemdup() will also add
- one slot for the terminating '\0'. */
+ /* The "+1" is for the comma; the +1 in the alloc
+ call is for the terminating '\0' */
apr_size_t new_size = found->value_size + value_size + 1;
char *new_val = serf_bucket_mem_alloc(headers_bucket->allocator,
- new_size);
+ new_size + 1);
memcpy(new_val, val, value_size);
new_val[value_size] = ',';
memcpy(new_val + value_size + 1, found->value,
diff --git a/buckets/mmap_buckets.c b/buckets/mmap_buckets.c
index f55a76b..c96bce4 100644
--- a/buckets/mmap_buckets.c
+++ b/buckets/mmap_buckets.c
@@ -19,6 +19,7 @@
#include "serf.h"
#include "serf_bucket_util.h"
+#if APR_HAS_MMAP
typedef struct {
apr_mmap_t *mmap;
@@ -116,3 +117,24 @@ const serf_bucket_type_t serf_bucket_type_mmap = {
serf_mmap_peek,
serf_default_destroy_and_data,
};
+
+#else /* !APR_HAS_MMAP */
+
+serf_bucket_t *serf_bucket_mmap_create(apr_mmap_t *file_mmap,
+ serf_bucket_alloc_t *allocator)
+{
+ return NULL;
+}
+
+const serf_bucket_type_t serf_bucket_type_mmap = {
+ "MMAP",
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+};
+
+#endif
diff --git a/buckets/response_body_buckets.c b/buckets/response_body_buckets.c
new file mode 100644
index 0000000..c9648a6
--- /dev/null
+++ b/buckets/response_body_buckets.c
@@ -0,0 +1,135 @@
+/* Copyright 2002-2004 Justin Erenkrantz and Greg Stein
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <apr_pools.h>
+
+#include "serf.h"
+#include "serf_bucket_util.h"
+
+/* Older versions of APR do not have this macro. */
+#ifdef APR_SIZE_MAX
+#define REQUESTED_MAX APR_SIZE_MAX
+#else
+#define REQUESTED_MAX (~((apr_size_t)0))
+#endif
+
+
+typedef struct {
+ serf_bucket_t *stream;
+ apr_uint64_t remaining;
+} body_context_t;
+
+serf_bucket_t *serf_bucket_response_body_create(
+ serf_bucket_t *stream, apr_uint64_t len, serf_bucket_alloc_t *allocator)
+{
+ body_context_t *ctx;
+
+ ctx = serf_bucket_mem_alloc(allocator, sizeof(*ctx));
+ ctx->stream = stream;
+ ctx->remaining = len;
+
+ return serf_bucket_create(&serf_bucket_type_response_body, allocator, ctx);
+}
+
+static apr_status_t serf_response_body_read(serf_bucket_t *bucket,
+ apr_size_t requested,
+ const char **data,
+ apr_size_t *len)
+{
+ body_context_t *ctx = bucket->data;
+ apr_status_t status;
+
+ if (!ctx->remaining) {
+ *len = 0;
+ return APR_EOF;
+ }
+
+ if (requested == SERF_READ_ALL_AVAIL || requested > ctx->remaining) {
+ if (ctx->remaining <= REQUESTED_MAX) {
+ requested = (apr_size_t) ctx->remaining;
+ } else {
+ requested = REQUESTED_MAX;
+ }
+ }
+
+ status = serf_bucket_read(ctx->stream, requested, data, len);
+
+ if (!SERF_BUCKET_READ_ERROR(status)) {
+ ctx->remaining -= *len;
+ }
+
+ if (APR_STATUS_IS_EOF(status) && ctx->remaining > 0) {
+ /* The server sent less data than expected. */
+ status = SERF_ERROR_TRUNCATED_HTTP_RESPONSE;
+ }
+
+ return status;
+}
+
+static apr_status_t serf_response_body_readline(serf_bucket_t *bucket,
+ int acceptable, int *found,
+ const char **data,
+ apr_size_t *len)
+{
+ body_context_t *ctx = bucket->data;
+ apr_status_t status;
+
+ if (!ctx->remaining) {
+ *len = 0;
+ return APR_EOF;
+ }
+
+ status = serf_bucket_readline(ctx->stream, acceptable, found, data, len);
+
+ if (!SERF_BUCKET_READ_ERROR(status)) {
+ ctx->remaining -= *len;
+ }
+
+ if (APR_STATUS_IS_EOF(status) && ctx->remaining > 0) {
+ /* The server sent less data than expected. */
+ status = SERF_ERROR_TRUNCATED_HTTP_RESPONSE;
+ }
+
+ return status;
+}
+
+static apr_status_t serf_response_body_peek(serf_bucket_t *bucket,
+ const char **data,
+ apr_size_t *len)
+{
+ body_context_t *ctx = bucket->data;
+
+ return serf_bucket_peek(ctx->stream, data, len);
+}
+
+static void serf_response_body_destroy(serf_bucket_t *bucket)
+{
+ body_context_t *ctx = bucket->data;
+
+ serf_bucket_destroy(ctx->stream);
+
+ serf_default_destroy_and_data(bucket);
+}
+
+const serf_bucket_type_t serf_bucket_type_response_body = {
+ "RESPONSE_BODY",
+ serf_response_body_read,
+ serf_response_body_readline,
+ serf_default_read_iovec,
+ serf_default_read_for_sendfile,
+ serf_default_read_bucket,
+ serf_response_body_peek,
+ serf_response_body_destroy,
+};
diff --git a/buckets/response_buckets.c b/buckets/response_buckets.c
index 975fedc..cb6a19c 100644
--- a/buckets/response_buckets.c
+++ b/buckets/response_buckets.c
@@ -249,8 +249,8 @@ static apr_status_t run_machine(serf_bucket_t *bkt, response_context_t *ctx)
if (errno == ERANGE) {
return APR_FROM_OS_ERROR(ERANGE);
}
- ctx->body = serf_bucket_limit_create(ctx->body, length,
- bkt->allocator);
+ ctx->body = serf_bucket_response_body_create(
+ ctx->body, length, bkt->allocator);
}
else {
v = serf_bucket_headers_get(ctx->headers, "Transfer-Encoding");
@@ -385,13 +385,15 @@ static apr_status_t serf_response_read(serf_bucket_t *bucket,
}
rv = serf_bucket_read(ctx->body, requested, data, len);
+ if (SERF_BUCKET_READ_ERROR(rv))
+ return rv;
+
if (APR_STATUS_IS_EOF(rv)) {
if (ctx->chunked) {
ctx->state = STATE_TRAILERS;
/* Mask the result. */
rv = APR_SUCCESS;
- }
- else {
+ } else {
ctx->state = STATE_DONE;
}
}
@@ -414,6 +416,39 @@ static apr_status_t serf_response_readline(serf_bucket_t *bucket,
return serf_bucket_readline(ctx->body, acceptable, found, data, len);
}
+apr_status_t serf_response_full_become_aggregate(serf_bucket_t *bucket)
+{
+ response_context_t *ctx = bucket->data;
+ serf_bucket_t *bkt;
+ char buf[256];
+ int size;
+
+ serf_bucket_aggregate_become(bucket);
+
+ /* Add reconstructed status line. */
+ size = apr_snprintf(buf, 256, "HTTP/%d.%d %d ",
+ SERF_HTTP_VERSION_MAJOR(ctx->sl.version),
+ SERF_HTTP_VERSION_MINOR(ctx->sl.version),
+ ctx->sl.code);
+ bkt = serf_bucket_simple_copy_create(buf, size,
+ bucket->allocator);
+ serf_bucket_aggregate_append(bucket, bkt);
+ bkt = serf_bucket_simple_copy_create(ctx->sl.reason, strlen(ctx->sl.reason),
+ bucket->allocator);
+ serf_bucket_aggregate_append(bucket, bkt);
+ bkt = SERF_BUCKET_SIMPLE_STRING_LEN("\r\n", 2,
+ bucket->allocator);
+ serf_bucket_aggregate_append(bucket, bkt);
+
+ /* Add headers and stream buckets in order. */
+ serf_bucket_aggregate_append(bucket, ctx->headers);
+ serf_bucket_aggregate_append(bucket, ctx->stream);
+
+ serf_bucket_mem_free(bucket->allocator, ctx);
+
+ return APR_SUCCESS;
+}
+
/* ### need to implement */
#define serf_response_peek NULL
diff --git a/buckets/socket_buckets.c b/buckets/socket_buckets.c
index dd2469a..ef718af 100644
--- a/buckets/socket_buckets.c
+++ b/buckets/socket_buckets.c
@@ -17,6 +17,7 @@
#include <apr_network_io.h>
#include "serf.h"
+#include "serf_private.h"
#include "serf_bucket_util.h"
@@ -40,6 +41,15 @@ static apr_status_t socket_reader(void *baton, apr_size_t bufsize,
*len = bufsize;
status = apr_socket_recv(ctx->skt, buf, len);
+ if (status && !APR_STATUS_IS_EAGAIN(status))
+ serf__log_skt(SOCK_VERBOSE, __FILE__, ctx->skt,
+ "socket_recv error %d\n", status);
+
+ if (*len)
+ serf__log_skt(SOCK_MSG_VERBOSE, __FILE__, ctx->skt,
+ "--- socket_recv:\n%.*s\n-(%d)-\n",
+ *len, buf, *len);
+
if (ctx->progress_func)
ctx->progress_func(ctx->progress_baton, *len, 0);
@@ -60,7 +70,8 @@ serf_bucket_t *serf_bucket_socket_create(
ctx->databuf.read = socket_reader;
ctx->databuf.read_baton = ctx;
- ctx->progress_func = ctx->progress_baton = NULL;
+ ctx->progress_func = NULL;
+ ctx->progress_baton = NULL;
return serf_bucket_create(&serf_bucket_type_socket, allocator, ctx);
}
diff --git a/buckets/ssl_buckets.c b/buckets/ssl_buckets.c
index 3f43543..c5a0e60 100644
--- a/buckets/ssl_buckets.c
+++ b/buckets/ssl_buckets.c
@@ -43,6 +43,7 @@
#include <apr_atomic.h>
#include "serf.h"
+#include "serf_private.h"
#include "serf_bucket_util.h"
#include <openssl/bio.h>
@@ -64,8 +65,6 @@
#endif
-/*#define SSL_VERBOSE*/
-
/*
* Here's an overview of the SSL bucket's relationship to OpenSSL and serf.
*
@@ -180,6 +179,10 @@ struct serf_ssl_context_t {
EVP_PKEY *cached_cert_pw;
apr_status_t pending_err;
+
+ /* Status of a fatal error, returned on subsequent encrypt or decrypt
+ requests. */
+ apr_status_t fatal_err;
};
typedef struct {
@@ -198,6 +201,47 @@ struct serf_ssl_certificate_t {
int depth;
};
+static void disable_compression(serf_ssl_context_t *ssl_ctx);
+
+#if SSL_VERBOSE
+/* Log all ssl alerts that we receive from the server. */
+static void
+apps_ssl_info_callback(const SSL *s, int where, int ret)
+{
+ const char *str;
+ int w;
+ w = where & ~SSL_ST_MASK;
+
+ if (w & SSL_ST_CONNECT)
+ str = "SSL_connect";
+ else if (w & SSL_ST_ACCEPT)
+ str = "SSL_accept";
+ else
+ str = "undefined";
+
+ if (where & SSL_CB_LOOP) {
+ serf__log(SSL_VERBOSE, __FILE__, "%s:%s\n", str,
+ SSL_state_string_long(s));
+ }
+ else if (where & SSL_CB_ALERT) {
+ str = (where & SSL_CB_READ) ? "read" : "write";
+ serf__log(SSL_VERBOSE, __FILE__, "SSL3 alert %s:%s:%s\n",
+ str,
+ SSL_alert_type_string_long(ret),
+ SSL_alert_desc_string_long(ret));
+ }
+ else if (where & SSL_CB_EXIT) {
+ if (ret == 0)
+ serf__log(SSL_VERBOSE, __FILE__, "%s:failed in %s\n", str,
+ SSL_state_string_long(s));
+ else if (ret < 0) {
+ serf__log(SSL_VERBOSE, __FILE__, "%s:error in %s\n", str,
+ SSL_state_string_long(s));
+ }
+ }
+}
+#endif
+
/* Returns the amount read. */
static int bio_bucket_read(BIO *bio, char *in, int inlen)
{
@@ -206,17 +250,14 @@ static int bio_bucket_read(BIO *bio, char *in, int inlen)
apr_status_t status;
apr_size_t len;
-#ifdef SSL_VERBOSE
- printf("bio_bucket_read called for %d bytes\n", inlen);
-#endif
+ serf__log(SSL_VERBOSE, __FILE__, "bio_bucket_read called for %d bytes\n",
+ inlen);
if (ctx->encrypt.status == SERF_ERROR_WAIT_CONN
&& BIO_should_read(ctx->bio)) {
-#ifdef SSL_VERBOSE
- printf("bio_bucket_read waiting: (%d %d %d)\n",
+ serf__log(SSL_VERBOSE, __FILE__, "bio_bucket_read waiting: (%d %d %d)\n",
BIO_should_retry(ctx->bio), BIO_should_read(ctx->bio),
BIO_get_retry_flags(ctx->bio));
-#endif
/* Falling back... */
ctx->encrypt.exhausted_reset = 1;
BIO_clear_retry_flags(bio);
@@ -225,9 +266,9 @@ static int bio_bucket_read(BIO *bio, char *in, int inlen)
status = serf_bucket_read(ctx->decrypt.pending, inlen, &data, &len);
ctx->decrypt.status = status;
-#ifdef SSL_VERBOSE
- printf("bio_bucket_read received %d bytes (%d)\n", len, status);
-#endif
+
+ serf__log(SSL_VERBOSE, __FILE__, "bio_bucket_read received %d bytes (%d)\n",
+ len, status);
if (!SERF_BUCKET_READ_ERROR(status)) {
/* Oh suck. */
@@ -250,16 +291,14 @@ static int bio_bucket_write(BIO *bio, const char *in, int inl)
serf_ssl_context_t *ctx = bio->ptr;
serf_bucket_t *tmp;
-#ifdef SSL_VERBOSE
- printf("bio_bucket_write called for %d bytes\n", inl);
-#endif
+ serf__log(SSL_VERBOSE, __FILE__, "bio_bucket_write called for %d bytes\n",
+ inl);
+
if (ctx->encrypt.status == SERF_ERROR_WAIT_CONN
&& !BIO_should_read(ctx->bio)) {
-#ifdef SSL_VERBOSE
- printf("bio_bucket_write waiting: (%d %d %d)\n",
+ serf__log(SSL_VERBOSE, __FILE__, "bio_bucket_write waiting: (%d %d %d)\n",
BIO_should_retry(ctx->bio), BIO_should_read(ctx->bio),
BIO_get_retry_flags(ctx->bio));
-#endif
/* Falling back... */
ctx->encrypt.exhausted_reset = 1;
BIO_clear_retry_flags(bio);
@@ -424,6 +463,9 @@ validate_server_certificate(int cert_valid, X509_STORE_CTX *store_ctx)
case X509_V_ERR_INVALID_CA:
failures |= SERF_SSL_CERT_UNKNOWNCA;
break;
+ case X509_V_ERR_CERT_REVOKED:
+ failures |= SERF_SSL_CERT_REVOKED;
+ break;
default:
failures |= SERF_SSL_CERT_UNKNOWN_FAILURE;
break;
@@ -455,9 +497,13 @@ validate_server_certificate(int cert_valid, X509_STORE_CTX *store_ctx)
failures, cert);
if (status == APR_SUCCESS)
cert_valid = 1;
- else
+ else {
+ /* Even if openssl found the certificate valid, the application
+ told us to reject it. */
+ cert_valid = 0;
/* Pass the error back to the caller through the context-run. */
ctx->pending_err = status;
+ }
apr_pool_destroy(subpool);
}
@@ -490,7 +536,7 @@ validate_server_certificate(int cert_valid, X509_STORE_CTX *store_ctx)
certs_len = 1;
} else {
int i;
-
+
certs_len = sk_X509_num(chain);
/* Room for all the certs and a trailing NULL. */
@@ -514,6 +560,9 @@ validate_server_certificate(int cert_valid, X509_STORE_CTX *store_ctx)
if (status == APR_SUCCESS) {
cert_valid = 1;
} else {
+ /* Even if openssl found the certificate valid, the application
+ told us to reject it. */
+ cert_valid = 0;
/* Pass the error back to the caller through the context-run. */
ctx->pending_err = status;
}
@@ -534,18 +583,18 @@ static apr_status_t ssl_decrypt(void *baton, apr_size_t bufsize,
const char *data;
int ssl_len;
-#ifdef SSL_VERBOSE
- printf("ssl_decrypt: begin %d\n", bufsize);
-#endif
+ if (ctx->fatal_err)
+ return ctx->fatal_err;
+
+ serf__log(SSL_VERBOSE, __FILE__, "ssl_decrypt: begin %d\n", bufsize);
/* Is there some data waiting to be read? */
ssl_len = SSL_read(ctx->ssl, buf, bufsize);
if (ssl_len > 0) {
-#ifdef SSL_VERBOSE
- printf("ssl_decrypt: %d bytes (%d); status: %d; flags: %d\n",
- ssl_len, bufsize, ctx->decrypt.status,
- BIO_get_retry_flags(ctx->bio));
-#endif
+ serf__log(SSL_VERBOSE, __FILE__,
+ "ssl_decrypt: %d bytes (%d); status: %d; flags: %d\n",
+ ssl_len, bufsize, ctx->decrypt.status,
+ BIO_get_retry_flags(ctx->bio));
*len = ssl_len;
return APR_SUCCESS;
}
@@ -555,10 +604,9 @@ static apr_status_t ssl_decrypt(void *baton, apr_size_t bufsize,
if (!SERF_BUCKET_READ_ERROR(status) && priv_len) {
serf_bucket_t *tmp;
-#ifdef SSL_VERBOSE
- printf("ssl_decrypt: read %d bytes (%d); status: %d\n", priv_len,
- bufsize, status);
-#endif
+ serf__log(SSL_VERBOSE, __FILE__,
+ "ssl_decrypt: read %d bytes (%d); status: %d\n",
+ priv_len, bufsize, status);
tmp = serf_bucket_simple_copy_create(data, priv_len,
ctx->decrypt.pending->allocator);
@@ -581,29 +629,55 @@ static apr_status_t ssl_decrypt(void *baton, apr_size_t bufsize,
break;
case SSL_ERROR_SSL:
*len = 0;
- status = ctx->pending_err ? ctx->pending_err : APR_EGENERAL;
- ctx->pending_err = 0;
+ if (ctx->pending_err) {
+ status = ctx->pending_err;
+ ctx->pending_err = 0;
+ } else {
+ ctx->fatal_err = status = SERF_ERROR_SSL_COMM_FAILED;
+ }
break;
default:
*len = 0;
- status = APR_EGENERAL;
+ ctx->fatal_err = status = SERF_ERROR_SSL_COMM_FAILED;
break;
}
- }
- else {
+ } else if (ssl_len == 0) {
+ /* The server shut down the connection. */
+ int ssl_err, shutdown;
+ *len = 0;
+
+ /* Check for SSL_RECEIVED_SHUTDOWN */
+ shutdown = SSL_get_shutdown(ctx->ssl);
+ /* Check for SSL_ERROR_ZERO_RETURN */
+ ssl_err = SSL_get_error(ctx->ssl, ssl_len);
+
+ if (shutdown == SSL_RECEIVED_SHUTDOWN &&
+ ssl_err == SSL_ERROR_ZERO_RETURN) {
+ /* The server closed the SSL session. While this doesn't
+ necessary mean the connection is closed, let's close
+ it here anyway.
+ We can optimize this later. */
+ serf__log(SSL_VERBOSE, __FILE__,
+ "ssl_decrypt: SSL read error: server"
+ " shut down connection!\n");
+ status = APR_EOF;
+ } else {
+ /* A fatal error occurred. */
+ ctx->fatal_err = status = SERF_ERROR_SSL_COMM_FAILED;
+ }
+ } else {
*len = ssl_len;
-#ifdef SSL_VERBOSE
- printf("---\n%s\n-(%d)-\n", buf, *len);
-#endif
+ serf__log(SSL_MSG_VERBOSE, __FILE__,
+ "---\n%.*s\n-(%d)-\n", *len, buf, *len);
}
}
else {
*len = 0;
}
-#ifdef SSL_VERBOSE
- printf("ssl_decrypt: %d %d %d\n", status, *len,
- BIO_get_retry_flags(ctx->bio));
-#endif
+ serf__log(SSL_VERBOSE, __FILE__,
+ "ssl_decrypt: %d %d %d\n", status, *len,
+ BIO_get_retry_flags(ctx->bio));
+
return status;
}
@@ -616,9 +690,10 @@ static apr_status_t ssl_encrypt(void *baton, apr_size_t bufsize,
serf_ssl_context_t *ctx = baton;
apr_status_t status;
-#ifdef SSL_VERBOSE
- printf("ssl_encrypt: begin %d\n", bufsize);
-#endif
+ if (ctx->fatal_err)
+ return ctx->fatal_err;
+
+ serf__log(SSL_VERBOSE, __FILE__, "ssl_encrypt: begin %d\n", bufsize);
/* Try to read already encrypted but unread data first. */
status = serf_bucket_read(ctx->encrypt.pending, bufsize, &data, len);
@@ -632,29 +707,28 @@ static apr_status_t ssl_encrypt(void *baton, apr_size_t bufsize,
if (APR_STATUS_IS_EOF(status)) {
status = APR_SUCCESS;
}
-#ifdef SSL_VERBOSE
- printf("ssl_encrypt: %d %d %d (quick read)\n", status, *len,
- BIO_get_retry_flags(ctx->bio));
-#endif
+
+ serf__log(SSL_VERBOSE, __FILE__, "ssl_encrypt: %d %d %d (quick read)\n",
+ status, *len, BIO_get_retry_flags(ctx->bio));
+
return status;
}
if (BIO_should_retry(ctx->bio) && BIO_should_write(ctx->bio)) {
-#ifdef SSL_VERBOSE
- printf("ssl_encrypt: %d %d %d (should write exit)\n", status, *len,
- BIO_get_retry_flags(ctx->bio));
-#endif
+ serf__log(SSL_VERBOSE, __FILE__,
+ "ssl_encrypt: %d %d %d (should write exit)\n",
+ status, *len, BIO_get_retry_flags(ctx->bio));
+
return APR_EAGAIN;
}
/* If we were previously blocked, unblock ourselves now. */
if (BIO_should_read(ctx->bio)) {
-#ifdef SSL_VERBOSE
- printf("ssl_encrypt: reset %d %d (%d %d %d)\n", status,
- ctx->encrypt.status,
- BIO_should_retry(ctx->bio), BIO_should_read(ctx->bio),
- BIO_get_retry_flags(ctx->bio));
-#endif
+ serf__log(SSL_VERBOSE, __FILE__, "ssl_encrypt: reset %d %d (%d %d %d)\n",
+ status, ctx->encrypt.status,
+ BIO_should_retry(ctx->bio), BIO_should_read(ctx->bio),
+ BIO_get_retry_flags(ctx->bio));
+
ctx->encrypt.status = APR_SUCCESS;
ctx->encrypt.exhausted_reset = 0;
}
@@ -696,18 +770,20 @@ static apr_status_t ssl_encrypt(void *baton, apr_size_t bufsize,
interim_bufsize -= vecs_data_len;
interim_len = vecs_data_len;
-#ifdef SSL_VERBOSE
- printf("ssl_encrypt: bucket read %d bytes; status %d\n",
- interim_len, status);
- printf("---\n%s\n-(%d)-\n", vecs_data, interim_len);
-#endif
+ serf__log(SSL_VERBOSE, __FILE__,
+ "ssl_encrypt: bucket read %d bytes; "\
+ "status %d\n", interim_len, status);
+ serf__log(SSL_MSG_VERBOSE, __FILE__, "---\n%.*s\n-(%d)-\n",
+ interim_len, vecs_data, interim_len);
+
/* Stash our status away. */
ctx->encrypt.status = status;
ssl_len = SSL_write(ctx->ssl, vecs_data, interim_len);
-#ifdef SSL_VERBOSE
- printf("ssl_encrypt: SSL write: %d\n", ssl_len);
-#endif
+
+ serf__log(SSL_VERBOSE, __FILE__,
+ "ssl_encrypt: SSL write: %d\n", ssl_len);
+
/* We're done. */
serf_bucket_mem_free(ctx->allocator, vecs_data);
@@ -720,9 +796,10 @@ static apr_status_t ssl_encrypt(void *baton, apr_size_t bufsize,
vecs, vecs_read);
ssl_err = SSL_get_error(ctx->ssl, ssl_len);
-#ifdef SSL_VERBOSE
- printf("ssl_encrypt: SSL write error: %d\n", ssl_err);
-#endif
+
+ serf__log(SSL_VERBOSE, __FILE__,
+ "ssl_encrypt: SSL write error: %d\n", ssl_err);
+
if (ssl_err == SSL_ERROR_SYSCALL) {
status = ctx->encrypt.status;
if (SERF_BUCKET_READ_ERROR(status)) {
@@ -735,12 +812,13 @@ static apr_status_t ssl_encrypt(void *baton, apr_size_t bufsize,
status = SERF_ERROR_WAIT_CONN;
}
else {
- status = APR_EGENERAL;
+ ctx->fatal_err = status = SERF_ERROR_SSL_COMM_FAILED;
}
}
-#ifdef SSL_VERBOSE
- printf("ssl_encrypt: SSL write error: %d %d\n", status, *len);
-#endif
+
+ serf__log(SSL_VERBOSE, __FILE__,
+ "ssl_encrypt: SSL write error: %d %d\n",
+ status, *len);
}
}
}
@@ -767,10 +845,9 @@ static apr_status_t ssl_encrypt(void *baton, apr_size_t bufsize,
*len += vecs[i].iov_len;
}
-#ifdef SSL_VERBOSE
- printf("ssl_encrypt read agg: %d %d %d %d\n", status, agg_status,
- ctx->encrypt.status, *len);
-#endif
+ serf__log(SSL_VERBOSE, __FILE__,
+ "ssl_encrypt read agg: %d %d %d %d\n", status, agg_status,
+ ctx->encrypt.status, *len);
if (!agg_status) {
status = agg_status;
@@ -783,11 +860,11 @@ static apr_status_t ssl_encrypt(void *baton, apr_size_t bufsize,
ctx->encrypt.status = SERF_ERROR_WAIT_CONN;
}
-#ifdef SSL_VERBOSE
- printf("ssl_encrypt finished: %d %d (%d %d %d)\n", status, *len,
- BIO_should_retry(ctx->bio), BIO_should_read(ctx->bio),
- BIO_get_retry_flags(ctx->bio));
-#endif
+ serf__log(SSL_VERBOSE, __FILE__,
+ "ssl_encrypt finished: %d %d (%d %d %d)\n", status, *len,
+ BIO_should_retry(ctx->bio), BIO_should_read(ctx->bio),
+ BIO_get_retry_flags(ctx->bio));
+
return status;
}
@@ -873,6 +950,20 @@ static void init_ssl_libraries(void)
#if APR_HAS_THREADS
int i, numlocks;
#endif
+
+#ifdef SSL_VERBOSE
+ /* Warn when compile-time and run-time version of OpenSSL differ in
+ major/minor version number. */
+ long libver = SSLeay();
+
+ if ((libver ^ OPENSSL_VERSION_NUMBER) & 0xFFF00000) {
+ serf__log(SSL_VERBOSE, __FILE__,
+ "Warning: OpenSSL library version mismatch, compile-time "
+ "was %lx, runtime is %lx.\n",
+ OPENSSL_VERSION_NUMBER, libver);
+ }
+#endif
+
CRYPTO_malloc_init();
ERR_load_crypto_strings();
SSL_load_error_strings();
@@ -1107,6 +1198,7 @@ static serf_ssl_context_t *ssl_init_context(void)
ssl_ctx->cached_cert = 0;
ssl_ctx->cached_cert_pw = 0;
ssl_ctx->pending_err = APR_SUCCESS;
+ ssl_ctx->fatal_err = APR_SUCCESS;
ssl_ctx->cert_callback = NULL;
ssl_ctx->cert_pw_callback = NULL;
@@ -1116,6 +1208,8 @@ static serf_ssl_context_t *ssl_init_context(void)
SSL_CTX_set_verify(ssl_ctx->ctx, SSL_VERIFY_PEER,
validate_server_certificate);
SSL_CTX_set_options(ssl_ctx->ctx, SSL_OP_ALL);
+ /* Disable SSL compression by default. */
+ disable_compression(ssl_ctx);
ssl_ctx->ssl = SSL_new(ssl_ctx->ctx);
ssl_ctx->bio = BIO_new(&bio_bucket_method);
@@ -1127,6 +1221,10 @@ static serf_ssl_context_t *ssl_init_context(void)
SSL_set_app_data(ssl_ctx->ssl, ssl_ctx);
+#if SSL_VERBOSE
+ SSL_CTX_set_info_callback(ssl_ctx->ctx, apps_ssl_info_callback);
+#endif
+
ssl_ctx->encrypt.stream = NULL;
ssl_ctx->encrypt.stream_next = NULL;
ssl_ctx->encrypt.pending = serf_bucket_aggregate_create(allocator);
@@ -1206,7 +1304,7 @@ apr_status_t serf_ssl_use_default_certificates(serf_ssl_context_t *ssl_ctx)
int result = X509_STORE_set_default_paths(store);
- return result ? APR_SUCCESS : APR_EGENERAL;
+ return result ? APR_SUCCESS : SERF_ERROR_SSL_CERT_FAILED;
}
apr_status_t serf_ssl_load_cert_file(
@@ -1228,7 +1326,7 @@ apr_status_t serf_ssl_load_cert_file(
}
}
- return APR_EGENERAL;
+ return SERF_ERROR_SSL_CERT_FAILED;
}
@@ -1240,7 +1338,7 @@ apr_status_t serf_ssl_trust_cert(
int result = X509_STORE_add_cert(store, cert->ssl_cert);
- return result ? APR_SUCCESS : APR_EGENERAL;
+ return result ? APR_SUCCESS : SERF_ERROR_SSL_CERT_FAILED;
}
@@ -1521,6 +1619,31 @@ const char *serf_ssl_cert_export(
return encoded_cert;
}
+/* Disables compression for all SSL sessions. */
+static void disable_compression(serf_ssl_context_t *ssl_ctx)
+{
+#ifdef SSL_OP_NO_COMPRESSION
+ SSL_CTX_set_options(ssl_ctx->ctx, SSL_OP_NO_COMPRESSION);
+#endif
+}
+
+apr_status_t serf_ssl_use_compression(serf_ssl_context_t *ssl_ctx, int enabled)
+{
+ if (enabled) {
+#ifdef SSL_OP_NO_COMPRESSION
+ SSL_clear_options(ssl_ctx->ssl, SSL_OP_NO_COMPRESSION);
+ return APR_SUCCESS;
+#endif
+ } else {
+#ifdef SSL_OP_NO_COMPRESSION
+ SSL_set_options(ssl_ctx->ssl, SSL_OP_NO_COMPRESSION);
+ return APR_SUCCESS;
+#endif
+ }
+
+ return APR_EGENERAL;
+}
+
static void serf_ssl_destroy_and_data(serf_bucket_t *bucket)
{
ssl_context_t *ctx = bucket->data;
diff --git a/build/config.guess b/build/config.guess
index 40eaed4..2055429 100755
--- a/build/config.guess
+++ b/build/config.guess
@@ -1,14 +1,12 @@
#! /bin/sh
# Attempt to guess a canonical system name.
-# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
-# 2011 Free Software Foundation, Inc.
+# Copyright 1992-2013 Free Software Foundation, Inc.
-timestamp='2011-05-11'
+timestamp='2013-04-24'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
+# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
@@ -17,26 +15,22 @@ timestamp='2011-05-11'
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
-# 02110-1301, USA.
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-
-# Originally written by Per Bothner. Please send patches (context
-# diff format) to <config-patches@gnu.org> and include a ChangeLog
-# entry.
+# the same distribution terms that you use for the rest of that
+# program. This Exception is an additional permission under section 7
+# of the GNU General Public License, version 3 ("GPLv3").
#
-# This script attempts to guess a canonical system name similar to
-# config.sub. If it succeeds, it prints the system name on stdout, and
-# exits with 0. Otherwise, it exits with 1.
+# Originally written by Per Bothner.
#
# You can get the latest version of this script from:
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+#
+# Please send patches with a ChangeLog entry to config-patches@gnu.org.
+
me=`echo "$0" | sed -e 's,.*/,,'`
@@ -56,9 +50,7 @@ version="\
GNU config.guess ($timestamp)
Originally written by Per Bothner.
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free
-Software Foundation, Inc.
+Copyright 1992-2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -145,7 +137,7 @@ UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
*:NetBSD:*:*)
# NetBSD (nbsd) targets should (where applicable) match one or
- # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+ # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
# *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
# switched to ELF, *-*-netbsd* would select the old
# object file format. This provides both forward
@@ -202,6 +194,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
echo "${machine}-${os}${release}"
exit ;;
+ *:Bitrig:*:*)
+ UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
+ echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE}
+ exit ;;
*:OpenBSD:*:*)
UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
@@ -304,7 +300,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
echo arm-acorn-riscix${UNAME_RELEASE}
exit ;;
- arm:riscos:*:*|arm:RISCOS:*:*)
+ arm*:riscos:*:*|arm*:RISCOS:*:*)
echo arm-unknown-riscos
exit ;;
SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
@@ -792,21 +788,26 @@ EOF
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
exit ;;
*:FreeBSD:*:*)
- case ${UNAME_MACHINE} in
- pc98)
- echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+ UNAME_PROCESSOR=`/usr/bin/uname -p`
+ case ${UNAME_PROCESSOR} in
amd64)
echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
*)
- echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+ echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
esac
exit ;;
i*:CYGWIN*:*)
echo ${UNAME_MACHINE}-pc-cygwin
exit ;;
+ *:MINGW64*:*)
+ echo ${UNAME_MACHINE}-pc-mingw64
+ exit ;;
*:MINGW*:*)
echo ${UNAME_MACHINE}-pc-mingw32
exit ;;
+ i*:MSYS*:*)
+ echo ${UNAME_MACHINE}-pc-msys
+ exit ;;
i*:windows32*:*)
# uname -m includes "-pc" on this system.
echo ${UNAME_MACHINE}-mingw32
@@ -861,6 +862,13 @@ EOF
i*86:Minix:*:*)
echo ${UNAME_MACHINE}-pc-minix
exit ;;
+ aarch64:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ aarch64_be:Linux:*:*)
+ UNAME_MACHINE=aarch64_be
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
alpha:Linux:*:*)
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
EV5) UNAME_MACHINE=alphaev5 ;;
@@ -875,6 +883,9 @@ EOF
if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
exit ;;
+ arc:Linux:*:* | arceb:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
arm*:Linux:*:*)
eval $set_cc_for_build
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
@@ -895,13 +906,16 @@ EOF
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
cris:Linux:*:*)
- echo cris-axis-linux-gnu
+ echo ${UNAME_MACHINE}-axis-linux-gnu
exit ;;
crisv32:Linux:*:*)
- echo crisv32-axis-linux-gnu
+ echo ${UNAME_MACHINE}-axis-linux-gnu
exit ;;
frv:Linux:*:*)
- echo frv-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ hexagon:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
i*86:Linux:*:*)
LIBC=gnu
@@ -910,6 +924,11 @@ EOF
#ifdef __dietlibc__
LIBC=dietlibc
#endif
+ #else
+ #include <features.h>
+ #ifdef __UCLIBC__
+ LIBC=uclibc
+ #endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
@@ -942,8 +961,11 @@ EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
;;
+ or1k:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
or32:Linux:*:*)
- echo or32-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
padre:Linux:*:*)
echo sparc-unknown-linux-gnu
@@ -978,13 +1000,15 @@ EOF
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
tile*:Linux:*:*)
- echo ${UNAME_MACHINE}-tilera-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
vax:Linux:*:*)
echo ${UNAME_MACHINE}-dec-linux-gnu
exit ;;
x86_64:Linux:*:*)
- echo x86_64-unknown-linux-gnu
+ LIBC=gnu
+ test -r /lib/libc.so && od -An -S13 /lib/libc.so | grep -q __uClibc_main && LIBC=uclibc
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
xtensa*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
@@ -1191,6 +1215,9 @@ EOF
BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
echo i586-pc-haiku
exit ;;
+ x86_64:Haiku:*:*)
+ echo x86_64-unknown-haiku
+ exit ;;
SX-4:SUPER-UX:*:*)
echo sx4-nec-superux${UNAME_RELEASE}
exit ;;
@@ -1246,7 +1273,7 @@ EOF
NEO-?:NONSTOP_KERNEL:*:*)
echo neo-tandem-nsk${UNAME_RELEASE}
exit ;;
- NSE-?:NONSTOP_KERNEL:*:*)
+ NSE-*:NONSTOP_KERNEL:*:*)
echo nse-tandem-nsk${UNAME_RELEASE}
exit ;;
NSR-?:NONSTOP_KERNEL:*:*)
@@ -1315,11 +1342,11 @@ EOF
i*86:AROS:*:*)
echo ${UNAME_MACHINE}-pc-aros
exit ;;
+ x86_64:VMkernel:*:*)
+ echo ${UNAME_MACHINE}-unknown-esx
+ exit ;;
esac
-#echo '(No uname command or uname output not recognized.)' 1>&2
-#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
-
eval $set_cc_for_build
cat >$dummy.c <<EOF
#ifdef _SEQUENT_
diff --git a/build/config.sub b/build/config.sub
index 30fdca8..8b612ab 100755
--- a/build/config.sub
+++ b/build/config.sub
@@ -1,38 +1,31 @@
#! /bin/sh
# Configuration validation subroutine script.
-# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
-# 2011 Free Software Foundation, Inc.
+# Copyright 1992-2013 Free Software Foundation, Inc.
-timestamp='2011-03-23'
+timestamp='2013-04-24'
-# This file is (in principle) common to ALL GNU software.
-# The presence of a machine in this file suggests that SOME GNU software
-# can handle that machine. It does not imply ALL GNU software can.
-#
-# This file is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
-# 02110-1301, USA.
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
+# the same distribution terms that you use for the rest of that
+# program. This Exception is an additional permission under section 7
+# of the GNU General Public License, version 3 ("GPLv3").
-# Please send patches to <config-patches@gnu.org>. Submit a context
-# diff and a properly formatted GNU ChangeLog entry.
+# Please send patches with a ChangeLog entry to config-patches@gnu.org.
#
# Configuration subroutine to validate and canonicalize a configuration type.
# Supply the specified configuration type as an argument.
@@ -75,9 +68,7 @@ Report bugs and patches to <config-patches@gnu.org>."
version="\
GNU config.sub ($timestamp)
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free
-Software Foundation, Inc.
+Copyright 1992-2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -125,13 +116,17 @@ esac
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in
nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
- linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
+ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
knetbsd*-gnu* | netbsd*-gnu* | \
kopensolaris*-gnu* | \
storm-chaos* | os2-emx* | rtmk-nova*)
os=-$maybe_os
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
;;
+ android-linux)
+ os=-linux-android
+ basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
+ ;;
*)
basic_machine=`echo $1 | sed 's/-[^-]*$//'`
if [ $basic_machine != $1 ]
@@ -154,7 +149,7 @@ case $os in
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
- -apple | -axis | -knuth | -cray | -microblaze)
+ -apple | -axis | -knuth | -cray | -microblaze*)
os=
basic_machine=$1
;;
@@ -223,6 +218,12 @@ case $os in
-isc*)
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
+ -lynx*178)
+ os=-lynxos178
+ ;;
+ -lynx*5)
+ os=-lynxos5
+ ;;
-lynx*)
os=-lynxos
;;
@@ -247,20 +248,27 @@ case $basic_machine in
# Some are omitted here because they have special meanings below.
1750a | 580 \
| a29k \
+ | aarch64 | aarch64_be \
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
| am33_2.0 \
- | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
+ | arc | arceb \
+ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
+ | avr | avr32 \
+ | be32 | be64 \
| bfin \
| c4x | clipper \
| d10v | d30v | dlx | dsp16xx \
+ | epiphany \
| fido | fr30 | frv \
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+ | hexagon \
| i370 | i860 | i960 | ia64 \
| ip2k | iq2000 \
+ | le32 | le64 \
| lm32 \
| m32c | m32r | m32rle | m68000 | m68k | m88k \
- | maxq | mb | microblaze | mcore | mep | metag \
+ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \
| mips | mipsbe | mipseb | mipsel | mipsle \
| mips16 \
| mips64 | mips64el \
@@ -278,20 +286,21 @@ case $basic_machine in
| mipsisa64r2 | mipsisa64r2el \
| mipsisa64sb1 | mipsisa64sb1el \
| mipsisa64sr71k | mipsisa64sr71kel \
+ | mipsr5900 | mipsr5900el \
| mipstx39 | mipstx39el \
| mn10200 | mn10300 \
| moxie \
| mt \
| msp430 \
| nds32 | nds32le | nds32be \
- | nios | nios2 \
+ | nios | nios2 | nios2eb | nios2el \
| ns16k | ns32k \
| open8 \
- | or32 \
+ | or1k | or32 \
| pdp10 | pdp11 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle \
| pyramid \
- | rx \
+ | rl78 | rx \
| score \
| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
| sh64 | sh64le \
@@ -300,7 +309,7 @@ case $basic_machine in
| spu \
| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
| ubicom32 \
- | v850 | v850e \
+ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
| we32k \
| x86 | xc16x | xstormy16 | xtensa \
| z8k | z80)
@@ -315,8 +324,7 @@ case $basic_machine in
c6x)
basic_machine=tic6x-unknown
;;
- m6811 | m68hc11 | m6812 | m68hc12 | picochip)
- # Motorola 68HC11/12.
+ m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip)
basic_machine=$basic_machine-unknown
os=-none
;;
@@ -329,7 +337,10 @@ case $basic_machine in
strongarm | thumb | xscale)
basic_machine=arm-unknown
;;
-
+ xgate)
+ basic_machine=$basic_machine-unknown
+ os=-none
+ ;;
xscaleeb)
basic_machine=armeb-unknown
;;
@@ -352,11 +363,13 @@ case $basic_machine in
# Recognize the basic CPU types with company name.
580-* \
| a29k-* \
+ | aarch64-* | aarch64_be-* \
| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
- | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
+ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
| avr-* | avr32-* \
+ | be32-* | be64-* \
| bfin-* | bs2000-* \
| c[123]* | c30-* | [cjt]90-* | c4x-* \
| clipper-* | craynv-* | cydra-* \
@@ -365,12 +378,15 @@ case $basic_machine in
| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
| h8300-* | h8500-* \
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+ | hexagon-* \
| i*86-* | i860-* | i960-* | ia64-* \
| ip2k-* | iq2000-* \
+ | le32-* | le64-* \
| lm32-* \
| m32c-* | m32r-* | m32rle-* \
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
- | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
+ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
+ | microblaze-* | microblazeel-* \
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
| mips16-* \
| mips64-* | mips64el-* \
@@ -388,19 +404,20 @@ case $basic_machine in
| mipsisa64r2-* | mipsisa64r2el-* \
| mipsisa64sb1-* | mipsisa64sb1el-* \
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
+ | mipsr5900-* | mipsr5900el-* \
| mipstx39-* | mipstx39el-* \
| mmix-* \
| mt-* \
| msp430-* \
| nds32-* | nds32le-* | nds32be-* \
- | nios-* | nios2-* \
+ | nios-* | nios2-* | nios2eb-* | nios2el-* \
| none-* | np1-* | ns16k-* | ns32k-* \
| open8-* \
| orion-* \
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
| pyramid-* \
- | romp-* | rs6000-* | rx-* \
+ | rl78-* | romp-* | rs6000-* | rx-* \
| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
@@ -408,10 +425,11 @@ case $basic_machine in
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
| tahoe-* \
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
- | tile-* | tilegx-* \
+ | tile*-* \
| tron-* \
| ubicom32-* \
- | v850-* | v850e-* | vax-* \
+ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
+ | vax-* \
| we32k-* \
| x86-* | x86_64-* | xc16x-* | xps100-* \
| xstormy16-* | xtensa*-* \
@@ -711,7 +729,6 @@ case $basic_machine in
i370-ibm* | ibm*)
basic_machine=i370-ibm
;;
-# I'm not sure what "Sysv32" means. Should this be sysv3.2?
i*86v32)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-sysv32
@@ -769,9 +786,13 @@ case $basic_machine in
basic_machine=ns32k-utek
os=-sysv
;;
- microblaze)
+ microblaze*)
basic_machine=microblaze-xilinx
;;
+ mingw64)
+ basic_machine=x86_64-pc
+ os=-mingw64
+ ;;
mingw32)
basic_machine=i386-pc
os=-mingw32
@@ -808,10 +829,18 @@ case $basic_machine in
ms1-*)
basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
;;
+ msys)
+ basic_machine=i386-pc
+ os=-msys
+ ;;
mvs)
basic_machine=i370-ibm
os=-mvs
;;
+ nacl)
+ basic_machine=le32-unknown
+ os=-nacl
+ ;;
ncr3000)
basic_machine=i486-ncr
os=-sysv4
@@ -992,7 +1021,11 @@ case $basic_machine in
basic_machine=i586-unknown
os=-pw32
;;
- rdos)
+ rdos | rdos64)
+ basic_machine=x86_64-pc
+ os=-rdos
+ ;;
+ rdos32)
basic_machine=i386-pc
os=-rdos
;;
@@ -1120,13 +1153,8 @@ case $basic_machine in
basic_machine=t90-cray
os=-unicos
;;
- # This must be matched before tile*.
- tilegx*)
- basic_machine=tilegx-unknown
- os=-linux-gnu
- ;;
tile*)
- basic_machine=tile-unknown
+ basic_machine=$basic_machine-unknown
os=-linux-gnu
;;
tx39)
@@ -1324,21 +1352,21 @@ case $os in
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
| -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
- | -sym* | -kopensolaris* \
+ | -sym* | -kopensolaris* | -plan9* \
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
| -aos* | -aros* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
- | -openbsd* | -solidbsd* \
+ | -bitrig* | -openbsd* | -solidbsd* \
| -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -chorusos* | -chorusrdb* | -cegcc* \
- | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
- | -mingw32* | -linux-gnu* | -linux-android* \
- | -linux-newlib* | -linux-uclibc* \
+ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+ | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
+ | -linux-newlib* | -linux-musl* | -linux-uclibc* \
| -uxpv* | -beos* | -mpeix* | -udk* \
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
@@ -1470,9 +1498,6 @@ case $os in
-aros*)
os=-aros
;;
- -kaos*)
- os=-kaos
- ;;
-zvmoe)
os=-zvmoe
;;
@@ -1521,6 +1546,9 @@ case $basic_machine in
c4x-* | tic4x-*)
os=-coff
;;
+ hexagon-*)
+ os=-elf
+ ;;
tic54x-*)
os=-coff
;;
@@ -1548,9 +1576,6 @@ case $basic_machine in
;;
m68000-sun)
os=-sunos3
- # This also exists in the configure program, but was not the
- # default.
- # os=-sunos4
;;
m68*-cisco)
os=-aout
@@ -1564,6 +1589,9 @@ case $basic_machine in
mips*-*)
os=-elf
;;
+ or1k-*)
+ os=-elf
+ ;;
or32-*)
os=-coff
;;
diff --git a/build/serf.def b/build/serf.def
index 3aa46c2..150a4b3 100644
--- a/build/serf.def
+++ b/build/serf.def
@@ -16,6 +16,8 @@ serf_connection_set_max_outstanding_requests
serf_connection_set_async_responses
serf_connection_request_create
serf_connection_priority_request_create
+serf_connection_get_latency
+serf_request_is_written
serf_request_cancel
serf_request_get_pool
serf_request_get_alloc
@@ -45,6 +47,7 @@ serf_bucket_response_status
serf_bucket_response_wait_for_headers
serf_bucket_response_get_headers
serf_bucket_response_set_head
+serf_bucket_response_body_create
serf_bucket_bwtp_frame_get_channel
serf_bucket_bwtp_frame_get_type
serf_bucket_bwtp_frame_get_phrase
@@ -93,6 +96,7 @@ serf_ssl_cert_certificate
serf_ssl_cert_export
serf_ssl_load_cert_file
serf_ssl_trust_cert
+serf_ssl_use_compression
serf_bucket_ssl_encrypt_create
serf_bucket_ssl_encrypt_context_get
serf_bucket_ssl_decrypt_create
@@ -101,6 +105,7 @@ serf_bucket_barrier_create
serf_bucket_iovec_create
serf_bucket_type_request
serf_bucket_type_response
+serf_bucket_type_response_body
serf_bucket_type_bwtp_frame
serf_bucket_type_bwtp_incoming_frame
serf_bucket_type_aggregate
diff --git a/configure b/configure
index 4e45fdf..d260ac9 100755
--- a/configure
+++ b/configure
@@ -1,60 +1,81 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.61.
+# Generated by GNU Autoconf 2.69.
+#
+#
+# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
+#
#
-# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-# 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
# This configure script is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.
-## --------------------- ##
-## M4sh Initialization. ##
-## --------------------- ##
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
# Be more Bourne compatible
DUALCASE=1; export DUALCASE # for MKS sh
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
emulate sh
NULLCMD=:
- # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
# is contrary to our usage. Disable this feature.
alias -g '${1+"$@"}'='"$@"'
setopt NO_GLOB_SUBST
else
- case `(set -o) 2>/dev/null` in
- *posix*) set -o posix ;;
+ case `(set -o) 2>/dev/null` in #(
+ *posix*) :
+ set -o posix ;; #(
+ *) :
+ ;;
esac
-
fi
-
-
-# PATH needs CR
-# Avoid depending upon Character Ranges.
-as_cr_letters='abcdefghijklmnopqrstuvwxyz'
-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-as_cr_Letters=$as_cr_letters$as_cr_LETTERS
-as_cr_digits='0123456789'
-as_cr_alnum=$as_cr_Letters$as_cr_digits
-
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
- echo "#! /bin/sh" >conf$$.sh
- echo "exit 0" >>conf$$.sh
- chmod +x conf$$.sh
- if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
- PATH_SEPARATOR=';'
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='print -r --'
+ as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='printf %s\n'
+ as_echo_n='printf %s'
+else
+ if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+ as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+ as_echo_n='/usr/ucb/echo -n'
else
- PATH_SEPARATOR=:
+ as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+ as_echo_n_body='eval
+ arg=$1;
+ case $arg in #(
+ *"$as_nl"*)
+ expr "X$arg" : "X\\(.*\\)$as_nl";
+ arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+ esac;
+ expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+ '
+ export as_echo_n_body
+ as_echo_n='sh -c $as_echo_n_body as_echo'
fi
- rm -f conf$$.sh
+ export as_echo_body
+ as_echo='sh -c $as_echo_body as_echo'
fi
-# Support unset when possible.
-if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
- as_unset=unset
-else
- as_unset=false
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ PATH_SEPARATOR=:
+ (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+ (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+ PATH_SEPARATOR=';'
+ }
fi
@@ -63,20 +84,19 @@ fi
# there to prevent editors from complaining about space-tab.
# (If _AS_PATH_WALK were called with IFS unset, it would disable word
# splitting by setting IFS to empty value.)
-as_nl='
-'
IFS=" "" $as_nl"
# Find who we are. Look in the path if we contain no directory separator.
-case $0 in
+as_myself=
+case $0 in #((
*[\\/]* ) as_myself=$0 ;;
*) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
- test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-done
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+ done
IFS=$as_save_IFS
;;
@@ -87,354 +107,366 @@ if test "x$as_myself" = x; then
as_myself=$0
fi
if test ! -f "$as_myself"; then
- echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
- { (exit 1); exit 1; }
+ $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ exit 1
fi
-# Work around bugs in pre-3.0 UWIN ksh.
-for as_var in ENV MAIL MAILPATH
-do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there. '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
done
PS1='$ '
PS2='> '
PS4='+ '
# NLS nuisances.
-for as_var in \
- LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
- LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
- LC_TELEPHONE LC_TIME
-do
- if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
- eval $as_var=C; export $as_var
- else
- ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
- fi
-done
-
-# Required to use basename.
-if expr a : '\(a\)' >/dev/null 2>&1 &&
- test "X`expr 00001 : '.*\(...\)'`" = X001; then
- as_expr=expr
-else
- as_expr=false
-fi
-
-if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
- as_basename=basename
-else
- as_basename=false
-fi
-
-
-# Name of the executable.
-as_me=`$as_basename -- "$0" ||
-$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
- X"$0" : 'X\(//\)$' \| \
- X"$0" : 'X\(/\)' \| . 2>/dev/null ||
-echo X/"$0" |
- sed '/^.*\/\([^/][^/]*\)\/*$/{
- s//\1/
- q
- }
- /^X\/\(\/\/\)$/{
- s//\1/
- q
- }
- /^X\/\(\/\).*/{
- s//\1/
- q
- }
- s/.*/./; q'`
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
# CDPATH.
-$as_unset CDPATH
-
-
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+# Use a proper internal environment variable to ensure we don't fall
+ # into an infinite loop, continuously re-executing ourselves.
+ if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then
+ _as_can_reexec=no; export _as_can_reexec;
+ # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+ *v*x* | *x*v* ) as_opts=-vx ;;
+ *v* ) as_opts=-v ;;
+ *x* ) as_opts=-x ;;
+ * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
+as_fn_exit 255
+ fi
+ # We don't want this to propagate to other subprocesses.
+ { _as_can_reexec=; unset _as_can_reexec;}
if test "x$CONFIG_SHELL" = x; then
- if (eval ":") 2>/dev/null; then
- as_have_required=yes
+ as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
+ emulate sh
+ NULLCMD=:
+ # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '\${1+\"\$@\"}'='\"\$@\"'
+ setopt NO_GLOB_SUBST
else
- as_have_required=no
+ case \`(set -o) 2>/dev/null\` in #(
+ *posix*) :
+ set -o posix ;; #(
+ *) :
+ ;;
+esac
fi
-
- if test $as_have_required = yes && (eval ":
-(as_func_return () {
- (exit \$1)
-}
-as_func_success () {
- as_func_return 0
-}
-as_func_failure () {
- as_func_return 1
-}
-as_func_ret_success () {
- return 0
-}
-as_func_ret_failure () {
- return 1
-}
+"
+ as_required="as_fn_return () { (exit \$1); }
+as_fn_success () { as_fn_return 0; }
+as_fn_failure () { as_fn_return 1; }
+as_fn_ret_success () { return 0; }
+as_fn_ret_failure () { return 1; }
exitcode=0
-if as_func_success; then
- :
-else
- exitcode=1
- echo as_func_success failed.
-fi
-
-if as_func_failure; then
- exitcode=1
- echo as_func_failure succeeded.
-fi
+as_fn_success || { exitcode=1; echo as_fn_success failed.; }
+as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }
+as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }
+as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }
+if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
-if as_func_ret_success; then
- :
else
- exitcode=1
- echo as_func_ret_success failed.
-fi
-
-if as_func_ret_failure; then
- exitcode=1
- echo as_func_ret_failure succeeded.
-fi
-
-if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
- :
+ exitcode=1; echo positional parameters were not saved.
+fi
+test x\$exitcode = x0 || exit 1
+test -x / || exit 1"
+ as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
+ as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
+ eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
+ test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1
+test \$(( 1 + 1 )) = 2 || exit 1"
+ if (eval "$as_required") 2>/dev/null; then :
+ as_have_required=yes
else
- exitcode=1
- echo positional parameters were not saved.
+ as_have_required=no
fi
+ if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then :
-test \$exitcode = 0) || { (exit 1); exit 1; }
-
-(
- as_lineno_1=\$LINENO
- as_lineno_2=\$LINENO
- test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" &&
- test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; }
-") 2> /dev/null; then
- :
else
- as_candidate_shells=
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+as_found=false
for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
- case $as_dir in
+ as_found=:
+ case $as_dir in #(
/*)
for as_base in sh bash ksh sh5; do
- as_candidate_shells="$as_candidate_shells $as_dir/$as_base"
+ # Try only shells that exist, to save several forks.
+ as_shell=$as_dir/$as_base
+ if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
+ { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then :
+ CONFIG_SHELL=$as_shell as_have_required=yes
+ if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then :
+ break 2
+fi
+fi
done;;
esac
+ as_found=false
done
+$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&
+ { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then :
+ CONFIG_SHELL=$SHELL as_have_required=yes
+fi; }
IFS=$as_save_IFS
- for as_shell in $as_candidate_shells $SHELL; do
- # Try only shells that exist, to save several forks.
- if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
- { ("$as_shell") 2> /dev/null <<\_ASEOF
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
- emulate sh
- NULLCMD=:
- # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
- # is contrary to our usage. Disable this feature.
- alias -g '${1+"$@"}'='"$@"'
- setopt NO_GLOB_SUBST
-else
- case `(set -o) 2>/dev/null` in
- *posix*) set -o posix ;;
-esac
-
-fi
-
-
-:
-_ASEOF
-}; then
- CONFIG_SHELL=$as_shell
- as_have_required=yes
- if { "$as_shell" 2> /dev/null <<\_ASEOF
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
- emulate sh
- NULLCMD=:
- # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
- # is contrary to our usage. Disable this feature.
- alias -g '${1+"$@"}'='"$@"'
- setopt NO_GLOB_SUBST
-else
- case `(set -o) 2>/dev/null` in
- *posix*) set -o posix ;;
+ if test "x$CONFIG_SHELL" != x; then :
+ export CONFIG_SHELL
+ # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+ *v*x* | *x*v* ) as_opts=-vx ;;
+ *v* ) as_opts=-v ;;
+ *x* ) as_opts=-x ;;
+ * ) as_opts= ;;
esac
-
-fi
-
-
-:
-(as_func_return () {
- (exit $1)
-}
-as_func_success () {
- as_func_return 0
-}
-as_func_failure () {
- as_func_return 1
-}
-as_func_ret_success () {
- return 0
-}
-as_func_ret_failure () {
- return 1
-}
-
-exitcode=0
-if as_func_success; then
- :
-else
- exitcode=1
- echo as_func_success failed.
-fi
-
-if as_func_failure; then
- exitcode=1
- echo as_func_failure succeeded.
-fi
-
-if as_func_ret_success; then
- :
-else
- exitcode=1
- echo as_func_ret_success failed.
-fi
-
-if as_func_ret_failure; then
- exitcode=1
- echo as_func_ret_failure succeeded.
-fi
-
-if ( set x; as_func_ret_success y && test x = "$1" ); then
- :
-else
- exitcode=1
- echo positional parameters were not saved.
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
+exit 255
+fi
+
+ if test x$as_have_required = xno; then :
+ $as_echo "$0: This script requires a shell more modern than all"
+ $as_echo "$0: the shells that I found on your system."
+ if test x${ZSH_VERSION+set} = xset ; then
+ $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
+ $as_echo "$0: be upgraded to zsh 4.3.4 or later."
+ else
+ $as_echo "$0: Please tell bug-autoconf@gnu.org about your system,
+$0: including any error possibly output before this
+$0: message. Then install a modern shell, or manually run
+$0: the script under such a shell if you do have one."
+ fi
+ exit 1
fi
-
-test $exitcode = 0) || { (exit 1); exit 1; }
-
-(
- as_lineno_1=$LINENO
- as_lineno_2=$LINENO
- test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; }
-
-_ASEOF
-}; then
- break
fi
-
fi
+SHELL=${CONFIG_SHELL-/bin/sh}
+export SHELL
+# Unset more variables known to interfere with behavior of common tools.
+CLICOLOR_FORCE= GREP_OPTIONS=
+unset CLICOLOR_FORCE GREP_OPTIONS
- done
-
- if test "x$CONFIG_SHELL" != x; then
- for as_var in BASH_ENV ENV
- do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
- done
- export CONFIG_SHELL
- exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
-fi
+## --------------------- ##
+## M4sh Shell Functions. ##
+## --------------------- ##
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+ { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+ return $1
+} # as_fn_set_status
- if test $as_have_required = no; then
- echo This script requires a shell more modern than all the
- echo shells that I found on your system. Please install a
- echo modern shell, or manually run the script under such a
- echo shell if you do have one.
- { (exit 1); exit 1; }
-fi
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+ set +e
+ as_fn_set_status $1
+ exit $1
+} # as_fn_exit
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+ case $as_dir in #(
+ -*) as_dir=./$as_dir;;
+ esac
+ test -d "$as_dir" || eval $as_mkdir_p || {
+ as_dirs=
+ while :; do
+ case $as_dir in #(
+ *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+ *) as_qdir=$as_dir;;
+ esac
+ as_dirs="'$as_qdir' $as_dirs"
+ as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ test -d "$as_dir" && break
+ done
+ test -z "$as_dirs" || eval "mkdir $as_dirs"
+ } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
-fi
-fi
+} # as_fn_mkdir_p
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+ test -f "$1" && test -x "$1"
+} # as_fn_executable_p
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+ eval 'as_fn_append ()
+ {
+ eval $1+=\$2
+ }'
+else
+ as_fn_append ()
+ {
+ eval $1=\$$1\$2
+ }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+ eval 'as_fn_arith ()
+ {
+ as_val=$(( $* ))
+ }'
+else
+ as_fn_arith ()
+ {
+ as_val=`expr "$@" || test $? -eq 1`
+ }
+fi # as_fn_arith
-(eval "as_func_return () {
- (exit \$1)
-}
-as_func_success () {
- as_func_return 0
-}
-as_func_failure () {
- as_func_return 1
-}
-as_func_ret_success () {
- return 0
-}
-as_func_ret_failure () {
- return 1
-}
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with STATUS, using 1 if that was 0.
+as_fn_error ()
+{
+ as_status=$1; test $as_status -eq 0 && as_status=1
+ if test "$4"; then
+ as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
+ fi
+ $as_echo "$as_me: error: $2" >&2
+ as_fn_exit $as_status
+} # as_fn_error
-exitcode=0
-if as_func_success; then
- :
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
else
- exitcode=1
- echo as_func_success failed.
-fi
-
-if as_func_failure; then
- exitcode=1
- echo as_func_failure succeeded.
+ as_expr=false
fi
-if as_func_ret_success; then
- :
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+ as_basename=basename
else
- exitcode=1
- echo as_func_ret_success failed.
-fi
-
-if as_func_ret_failure; then
- exitcode=1
- echo as_func_ret_failure succeeded.
+ as_basename=false
fi
-if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
- :
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
else
- exitcode=1
- echo positional parameters were not saved.
+ as_dirname=false
fi
-test \$exitcode = 0") || {
- echo No shell found that supports shell functions.
- echo Please tell autoconf@gnu.org about your system,
- echo including any error possibly output before this
- echo message
-}
-
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
- as_lineno_1=$LINENO
- as_lineno_2=$LINENO
- test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
- # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
- # uniformly replaced by the line number. The first 'sed' inserts a
- # line-number line after each line using $LINENO; the second 'sed'
- # does the real work. The second script uses 'N' to pair each
- # line-number line with the line containing $LINENO, and appends
- # trailing '-' during substitution so that $LINENO is not a special
- # case at line end.
- # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
- # scripts with optimization help from Paolo Bonzini. Blame Lee
- # E. McMahon (1931-1989) for sed's syntax. :-)
+ as_lineno_1=$LINENO as_lineno_1a=$LINENO
+ as_lineno_2=$LINENO as_lineno_2a=$LINENO
+ eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&
+ test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || {
+ # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-)
sed -n '
p
/[$]LINENO/=
@@ -451,9 +483,12 @@ test \$exitcode = 0") || {
s/-\n.*//
' >$as_me.lineno &&
chmod +x "$as_me.lineno" ||
- { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
- { (exit 1); exit 1; }; }
+ { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
+ # If we had to re-execute with $CONFIG_SHELL, we're ensured to have
+ # already done that, so ensure we don't try to do so again and fall
+ # in an infinite loop. This has already happened in practice.
+ _as_can_reexec=no; export _as_can_reexec
# Don't try to exec as it changes $[0], causing all sort of problems
# (the dirname of $[0] is not the place where we might find the
# original and so on. Autoconf is especially sensitive to this).
@@ -462,84 +497,55 @@ test \$exitcode = 0") || {
exit
}
-
-if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
- as_dirname=dirname
-else
- as_dirname=false
-fi
-
ECHO_C= ECHO_N= ECHO_T=
-case `echo -n x` in
+case `echo -n x` in #(((((
-n*)
- case `echo 'x\c'` in
+ case `echo 'xy\c'` in
*c*) ECHO_T=' ';; # ECHO_T is single tab character.
- *) ECHO_C='\c';;
+ xy) ECHO_C='\c';;
+ *) echo `echo ksh88 bug on AIX 6.1` > /dev/null
+ ECHO_T=' ';;
esac;;
*)
ECHO_N='-n';;
esac
-if expr a : '\(a\)' >/dev/null 2>&1 &&
- test "X`expr 00001 : '.*\(...\)'`" = X001; then
- as_expr=expr
-else
- as_expr=false
-fi
-
rm -f conf$$ conf$$.exe conf$$.file
if test -d conf$$.dir; then
rm -f conf$$.dir/conf$$.file
else
rm -f conf$$.dir
- mkdir conf$$.dir
-fi
-echo >conf$$.file
-if ln -s conf$$.file conf$$ 2>/dev/null; then
- as_ln_s='ln -s'
- # ... but there are two gotchas:
- # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
- # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
- # In both cases, we have to default to `cp -p'.
- ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
- as_ln_s='cp -p'
-elif ln conf$$.file conf$$ 2>/dev/null; then
- as_ln_s=ln
+ mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+ if ln -s conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+ # In both cases, we have to default to `cp -pR'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ as_ln_s='cp -pR'
+ elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+ else
+ as_ln_s='cp -pR'
+ fi
else
- as_ln_s='cp -p'
+ as_ln_s='cp -pR'
fi
rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
rmdir conf$$.dir 2>/dev/null
if mkdir -p . 2>/dev/null; then
- as_mkdir_p=:
+ as_mkdir_p='mkdir -p "$as_dir"'
else
test -d ./-p && rmdir ./-p
as_mkdir_p=false
fi
-if test -x / >/dev/null 2>&1; then
- as_test_x='test -x'
-else
- if ls -dL / >/dev/null 2>&1; then
- as_ls_L_option=L
- else
- as_ls_L_option=
- fi
- as_test_x='
- eval sh -c '\''
- if test -d "$1"; then
- test -d "$1/.";
- else
- case $1 in
- -*)set "./$1";;
- esac;
- case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
- ???[sx]*):;;*)false;;esac;fi
- '\'' sh
- '
-fi
-as_executable_p=$as_test_x
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
# Sed expression to map a string onto a valid CPP name.
as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
@@ -548,11 +554,11 @@ as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
-
-exec 7<&0 </dev/null 6>&1
+test -n "$DJDIR" || exec 7<&0 </dev/null
+exec 6>&1
# Name of the host.
-# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
+# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status,
# so uname gets run too.
ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
@@ -567,7 +573,6 @@ cross_compiling=no
subdirs=
MFLAGS=
MAKEFLAGS=
-SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME=
@@ -575,6 +580,7 @@ PACKAGE_TARNAME=
PACKAGE_VERSION=
PACKAGE_STRING=
PACKAGE_BUGREPORT=
+PACKAGE_URL=
ac_unique_file="context.c"
ac_default_prefix=/usr/local/serf
@@ -614,93 +620,102 @@ ac_includes_default="\
# include <unistd.h>
#endif"
-ac_subst_vars='SHELL
-PATH_SEPARATOR
-PACKAGE_NAME
-PACKAGE_TARNAME
-PACKAGE_VERSION
-PACKAGE_STRING
-PACKAGE_BUGREPORT
-exec_prefix
-prefix
-program_transform_name
-bindir
-sbindir
-libexecdir
-datarootdir
-datadir
-sysconfdir
-sharedstatedir
-localstatedir
-includedir
-oldincludedir
-docdir
-infodir
-htmldir
-dvidir
-pdfdir
-psdir
-libdir
-localedir
-mandir
-DEFS
-ECHO_C
-ECHO_N
-ECHO_T
-LIBS
-build_alias
-host_alias
-target_alias
-mkdir_p
-build
-build_cpu
-build_vendor
-build_os
-host
-host_cpu
-host_vendor
-host_os
-target
-target_cpu
-target_vendor
-target_os
-LTFLAGS
-APR_LIBTOOL
-APR_BINDIR
-APR_INCLUDES
-APR_VERSION
-APR_CONFIG
-APU_BINDIR
-APU_INCLUDES
-APU_VERSION
-APU_CONFIG
-CC
-CFLAGS
-LDFLAGS
-CPPFLAGS
-ac_ct_CC
-EXEEXT
-OBJEXT
-CPP
-INSTALL_PROGRAM
-INSTALL_SCRIPT
-INSTALL_DATA
-SERF_MAJOR_VERSION
-SERF_DOTTED_VERSION
-SERF_BUILD_SRCLIB_DIRS
-SERF_CLEAN_SRCLIB_DIRS
-GREP
-EGREP
-SERF_LIBS
-EXTRA_CPPFLAGS
-EXTRA_CFLAGS
-EXTRA_CXXFLAGS
-EXTRA_LDFLAGS
-EXTRA_LIBS
-EXTRA_INCLUDES
+ac_subst_vars='LTLIBOBJS
LIBOBJS
-LTLIBOBJS'
+EXTRA_INCLUDES
+EXTRA_LIBS
+EXTRA_LDFLAGS
+EXTRA_CXXFLAGS
+EXTRA_CFLAGS
+EXTRA_CPPFLAGS
+SERF_LIBS
+EGREP
+GREP
+SERF_CLEAN_SRCLIB_DIRS
+SERF_BUILD_SRCLIB_DIRS
+SERF_DOTTED_VERSION
+SERF_MAJOR_VERSION
+INSTALL_DATA
+INSTALL_SCRIPT
+INSTALL_PROGRAM
+CPP
+OBJEXT
+EXEEXT
+ac_ct_CC
+CPPFLAGS
+LDFLAGS
+CFLAGS
+CC
+APU_CONFIG
+APU_VERSION
+APU_INCLUDES
+APU_BINDIR
+APR_CONFIG
+APR_VERSION
+APR_INCLUDES
+APR_BINDIR
+APR_LIBTOOL
+LTFLAGS
+target_os
+target_vendor
+target_cpu
+target
+host_os
+host_vendor
+host_cpu
+host
+build_os
+build_vendor
+build_cpu
+build
+mkdir_p
+target_alias
+host_alias
+build_alias
+LIBS
+ECHO_T
+ECHO_N
+ECHO_C
+DEFS
+mandir
+localedir
+libdir
+psdir
+pdfdir
+dvidir
+htmldir
+infodir
+docdir
+oldincludedir
+includedir
+localstatedir
+sharedstatedir
+sysconfdir
+datadir
+datarootdir
+libexecdir
+sbindir
+bindir
+program_transform_name
+prefix
+exec_prefix
+PACKAGE_URL
+PACKAGE_BUGREPORT
+PACKAGE_STRING
+PACKAGE_VERSION
+PACKAGE_TARNAME
+PACKAGE_NAME
+PATH_SEPARATOR
+SHELL'
ac_subst_files=''
+ac_user_opts='
+enable_option_checking
+enable_layout
+with_apr
+with_apr_util
+with_openssl
+with_gssapi
+'
ac_precious_vars='build_alias
host_alias
target_alias
@@ -715,6 +730,8 @@ CPP'
# Initialize some variables set by options.
ac_init_help=
ac_init_version=false
+ac_unrecognized_opts=
+ac_unrecognized_sep=
# The variables have the same names as the options, with
# dashes changed to underlines.
cache_file=/dev/null
@@ -770,8 +787,9 @@ do
fi
case $ac_option in
- *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
- *) ac_optarg=yes ;;
+ *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
+ *=) ac_optarg= ;;
+ *) ac_optarg=yes ;;
esac
# Accept the important Cygnus configure options, so we can diagnose typos.
@@ -813,13 +831,20 @@ do
datarootdir=$ac_optarg ;;
-disable-* | --disable-*)
- ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+ ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
# Reject names that are not valid shell variable names.
- expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null &&
- { echo "$as_me: error: invalid feature name: $ac_feature" >&2
- { (exit 1); exit 1; }; }
- ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'`
- eval enable_$ac_feature=no ;;
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid feature name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"enable_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval enable_$ac_useropt=no ;;
-docdir | --docdir | --docdi | --doc | --do)
ac_prev=docdir ;;
@@ -832,13 +857,20 @@ do
dvidir=$ac_optarg ;;
-enable-* | --enable-*)
- ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+ ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
# Reject names that are not valid shell variable names.
- expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null &&
- { echo "$as_me: error: invalid feature name: $ac_feature" >&2
- { (exit 1); exit 1; }; }
- ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'`
- eval enable_$ac_feature=\$ac_optarg ;;
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid feature name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"enable_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval enable_$ac_useropt=\$ac_optarg ;;
-exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
| --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
@@ -1029,22 +1061,36 @@ do
ac_init_version=: ;;
-with-* | --with-*)
- ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+ ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
# Reject names that are not valid shell variable names.
- expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null &&
- { echo "$as_me: error: invalid package name: $ac_package" >&2
- { (exit 1); exit 1; }; }
- ac_package=`echo $ac_package | sed 's/[-.]/_/g'`
- eval with_$ac_package=\$ac_optarg ;;
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid package name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"with_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval with_$ac_useropt=\$ac_optarg ;;
-without-* | --without-*)
- ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+ ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
# Reject names that are not valid shell variable names.
- expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null &&
- { echo "$as_me: error: invalid package name: $ac_package" >&2
- { (exit 1); exit 1; }; }
- ac_package=`echo $ac_package | sed 's/[-.]/_/g'`
- eval with_$ac_package=no ;;
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid package name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"with_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval with_$ac_useropt=no ;;
--x)
# Obsolete; use --with-x.
@@ -1064,26 +1110,26 @@ do
| --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
x_libraries=$ac_optarg ;;
- -*) { echo "$as_me: error: unrecognized option: $ac_option
-Try \`$0 --help' for more information." >&2
- { (exit 1); exit 1; }; }
+ -*) as_fn_error $? "unrecognized option: \`$ac_option'
+Try \`$0 --help' for more information"
;;
*=*)
ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
# Reject names that are not valid shell variable names.
- expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
- { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
- { (exit 1); exit 1; }; }
+ case $ac_envvar in #(
+ '' | [0-9]* | *[!_$as_cr_alnum]* )
+ as_fn_error $? "invalid variable name: \`$ac_envvar'" ;;
+ esac
eval $ac_envvar=\$ac_optarg
export $ac_envvar ;;
*)
# FIXME: should be removed in autoconf 3.0.
- echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+ $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
- echo "$as_me: WARNING: invalid host type: $ac_option" >&2
- : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
+ $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+ : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}"
;;
esac
@@ -1091,23 +1137,36 @@ done
if test -n "$ac_prev"; then
ac_option=--`echo $ac_prev | sed 's/_/-/g'`
- { echo "$as_me: error: missing argument to $ac_option" >&2
- { (exit 1); exit 1; }; }
+ as_fn_error $? "missing argument to $ac_option"
+fi
+
+if test -n "$ac_unrecognized_opts"; then
+ case $enable_option_checking in
+ no) ;;
+ fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;;
+ *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
+ esac
fi
-# Be sure to have absolute directory names.
+# Check all directory arguments for consistency.
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
datadir sysconfdir sharedstatedir localstatedir includedir \
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
libdir localedir mandir
do
eval ac_val=\$$ac_var
+ # Remove trailing slashes.
+ case $ac_val in
+ */ )
+ ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
+ eval $ac_var=\$ac_val;;
+ esac
+ # Be sure to have absolute directory names.
case $ac_val in
[\\/$]* | ?:[\\/]* ) continue;;
NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
esac
- { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
- { (exit 1); exit 1; }; }
+ as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val"
done
# There might be people who depend on the old broken behavior: `$host'
@@ -1121,8 +1180,6 @@ target=$target_alias
if test "x$host_alias" != x; then
if test "x$build_alias" = x; then
cross_compiling=maybe
- echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
- If a cross compiler is detected then cross compile mode will be used." >&2
elif test "x$build_alias" != "x$host_alias"; then
cross_compiling=yes
fi
@@ -1137,23 +1194,21 @@ test "$silent" = yes && exec 6>/dev/null
ac_pwd=`pwd` && test -n "$ac_pwd" &&
ac_ls_di=`ls -di .` &&
ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
- { echo "$as_me: error: Working directory cannot be determined" >&2
- { (exit 1); exit 1; }; }
+ as_fn_error $? "working directory cannot be determined"
test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
- { echo "$as_me: error: pwd does not report name of working directory" >&2
- { (exit 1); exit 1; }; }
+ as_fn_error $? "pwd does not report name of working directory"
# Find the source files, if location was not specified.
if test -z "$srcdir"; then
ac_srcdir_defaulted=yes
# Try the directory containing this script, then the parent directory.
- ac_confdir=`$as_dirname -- "$0" ||
-$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$0" : 'X\(//\)[^/]' \| \
- X"$0" : 'X\(//\)$' \| \
- X"$0" : 'X\(/\)' \| . 2>/dev/null ||
-echo X"$0" |
+ ac_confdir=`$as_dirname -- "$as_myself" ||
+$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_myself" : 'X\(//\)[^/]' \| \
+ X"$as_myself" : 'X\(//\)$' \| \
+ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_myself" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
@@ -1180,13 +1235,11 @@ else
fi
if test ! -r "$srcdir/$ac_unique_file"; then
test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
- { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
- { (exit 1); exit 1; }; }
+ as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir"
fi
ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
ac_abs_confdir=`(
- cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2
- { (exit 1); exit 1; }; }
+ cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg"
pwd)`
# When building in place, set srcdir=.
if test "$ac_abs_confdir" = "$ac_pwd"; then
@@ -1226,7 +1279,7 @@ Configuration:
--help=short display options specific to this package
--help=recursive display the short help of all the included packages
-V, --version display version information and exit
- -q, --quiet, --silent do not print \`checking...' messages
+ -q, --quiet, --silent do not print \`checking ...' messages
--cache-file=FILE cache test results in FILE [disabled]
-C, --config-cache alias for \`--cache-file=config.cache'
-n, --no-create do not create output files
@@ -1234,9 +1287,9 @@ Configuration:
Installation directories:
--prefix=PREFIX install architecture-independent files in PREFIX
- [$ac_default_prefix]
+ [$ac_default_prefix]
--exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
- [PREFIX]
+ [PREFIX]
By default, \`make install' will install all the files in
\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
@@ -1246,25 +1299,25 @@ for instance \`--prefix=\$HOME'.
For better control, use the options below.
Fine tuning of the installation directories:
- --bindir=DIR user executables [EPREFIX/bin]
- --sbindir=DIR system admin executables [EPREFIX/sbin]
- --libexecdir=DIR program executables [EPREFIX/libexec]
- --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
- --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
- --localstatedir=DIR modifiable single-machine data [PREFIX/var]
- --libdir=DIR object code libraries [EPREFIX/lib]
- --includedir=DIR C header files [PREFIX/include]
- --oldincludedir=DIR C header files for non-gcc [/usr/include]
- --datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
- --datadir=DIR read-only architecture-independent data [DATAROOTDIR]
- --infodir=DIR info documentation [DATAROOTDIR/info]
- --localedir=DIR locale-dependent data [DATAROOTDIR/locale]
- --mandir=DIR man documentation [DATAROOTDIR/man]
- --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE]
- --htmldir=DIR html documentation [DOCDIR]
- --dvidir=DIR dvi documentation [DOCDIR]
- --pdfdir=DIR pdf documentation [DOCDIR]
- --psdir=DIR ps documentation [DOCDIR]
+ --bindir=DIR user executables [EPREFIX/bin]
+ --sbindir=DIR system admin executables [EPREFIX/sbin]
+ --libexecdir=DIR program executables [EPREFIX/libexec]
+ --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
+ --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
+ --localstatedir=DIR modifiable single-machine data [PREFIX/var]
+ --libdir=DIR object code libraries [EPREFIX/lib]
+ --includedir=DIR C header files [PREFIX/include]
+ --oldincludedir=DIR C header files for non-gcc [/usr/include]
+ --datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
+ --datadir=DIR read-only architecture-independent data [DATAROOTDIR]
+ --infodir=DIR info documentation [DATAROOTDIR/info]
+ --localedir=DIR locale-dependent data [DATAROOTDIR/locale]
+ --mandir=DIR man documentation [DATAROOTDIR/man]
+ --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE]
+ --htmldir=DIR html documentation [DOCDIR]
+ --dvidir=DIR dvi documentation [DOCDIR]
+ --pdfdir=DIR pdf documentation [DOCDIR]
+ --psdir=DIR ps documentation [DOCDIR]
_ACEOF
cat <<\_ACEOF
@@ -1281,6 +1334,7 @@ if test -n "$ac_init_help"; then
cat <<\_ACEOF
Optional Features:
+ --disable-option-checking ignore unrecognized --enable/--with options
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--enable-layout=LAYOUT
@@ -1293,6 +1347,8 @@ Optional Packages:
--with-apr-util=PATH prefix for installed APU or the full path to
apu-config
--with-openssl=PATH Path to OpenSSL (eg. /usr/local/ssl)
+ --with-gssapi=PATH build with GSSAPI support; needs krb5-config in
+ PATH/bin (eg. /usr/lib/mit)
Some influential environment variables:
CC C compiler command
@@ -1300,13 +1356,14 @@ Some influential environment variables:
LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
nonstandard directory <lib dir>
LIBS libraries to pass to the linker, e.g. -l<library>
- CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
+ CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
you have headers in a nonstandard directory <include dir>
CPP C preprocessor
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
+Report bugs to the package provider.
_ACEOF
ac_status=$?
fi
@@ -1314,15 +1371,17 @@ fi
if test "$ac_init_help" = "recursive"; then
# If there are subdirs, report their specific --help.
for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
- test -d "$ac_dir" || continue
+ test -d "$ac_dir" ||
+ { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } ||
+ continue
ac_builddir=.
case "$ac_dir" in
.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
*)
- ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+ ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
# A ".." for each directory in $ac_dir_suffix.
- ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'`
+ ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
case $ac_top_builddir_sub in
"") ac_top_builddir_sub=. ac_top_build_prefix= ;;
*) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
@@ -1358,7 +1417,7 @@ ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
echo &&
$SHELL "$ac_srcdir/configure" --help=recursive
else
- echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+ $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
fi || ac_status=$?
cd "$ac_pwd" || { ac_status=$?; break; }
done
@@ -1368,21 +1427,305 @@ test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
configure
-generated by GNU Autoconf 2.61
+generated by GNU Autoconf 2.69
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+Copyright (C) 2012 Free Software Foundation, Inc.
This configure script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it.
_ACEOF
exit
fi
+
+## ------------------------ ##
+## Autoconf initialization. ##
+## ------------------------ ##
+
+# ac_fn_c_try_compile LINENO
+# --------------------------
+# Try to compile conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_compile ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ rm -f conftest.$ac_objext
+ if { { ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_compile") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_compile
+
+# ac_fn_c_try_cpp LINENO
+# ----------------------
+# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_cpp ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if { { ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } > conftest.i && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_cpp
+
+# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists, giving a warning if it cannot be compiled using
+# the include files in INCLUDES and setting the cache variable VAR
+# accordingly.
+ac_fn_c_check_header_mongrel ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if eval \${$3+:} false; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+ # Is the header compilable?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
+$as_echo_n "checking $2 usability... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_header_compiler=yes
+else
+ ac_header_compiler=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
+$as_echo_n "checking $2 presence... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <$2>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+ ac_header_preproc=yes
+else
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #((
+ yes:no: )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+ ;;
+ no:yes:* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+ ;;
+esac
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ eval "$3=\$ac_header_compiler"
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+fi
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_header_mongrel
+
+# ac_fn_c_try_run LINENO
+# ----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
+# that executables *can* be run.
+ac_fn_c_try_run ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
+ { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: program exited with status $ac_status" >&5
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=$ac_status
+fi
+ rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_run
+
+# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists and can be compiled using the include files in
+# INCLUDES, setting the cache variable VAR accordingly.
+ac_fn_c_check_header_compile ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ eval "$3=yes"
+else
+ eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_header_compile
+
+# ac_fn_c_try_link LINENO
+# -----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_link ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ rm -f conftest.$ac_objext conftest$ac_exeext
+ if { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ test -x conftest$ac_exeext
+ }; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
+ # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
+ # interfere with the next link command; also delete a directory that is
+ # left behind by Apple's compiler. We do this before executing the actions.
+ rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_link
cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by $as_me, which was
-generated by GNU Autoconf 2.61. Invocation command line was
+generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -1418,8 +1761,8 @@ for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
- echo "PATH: $as_dir"
-done
+ $as_echo "PATH: $as_dir"
+ done
IFS=$as_save_IFS
} >&5
@@ -1453,12 +1796,12 @@ do
| -silent | --silent | --silen | --sile | --sil)
continue ;;
*\'*)
- ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
esac
case $ac_pass in
- 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
+ 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;;
2)
- ac_configure_args1="$ac_configure_args1 '$ac_arg'"
+ as_fn_append ac_configure_args1 " '$ac_arg'"
if test $ac_must_keep_next = true; then
ac_must_keep_next=false # Got value, back to normal.
else
@@ -1474,13 +1817,13 @@ do
-* ) ac_must_keep_next=true ;;
esac
fi
- ac_configure_args="$ac_configure_args '$ac_arg'"
+ as_fn_append ac_configure_args " '$ac_arg'"
;;
esac
done
done
-$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
-$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
+{ ac_configure_args0=; unset ac_configure_args0;}
+{ ac_configure_args1=; unset ac_configure_args1;}
# When interrupted or exit'd, cleanup temporary files, and complete
# config.log. We remove comments because anyway the quotes in there
@@ -1492,11 +1835,9 @@ trap 'exit_status=$?
{
echo
- cat <<\_ASBOX
-## ---------------- ##
+ $as_echo "## ---------------- ##
## Cache variables. ##
-## ---------------- ##
-_ASBOX
+## ---------------- ##"
echo
# The following way of writing the cache mishandles newlines in values,
(
@@ -1505,12 +1846,13 @@ _ASBOX
case $ac_val in #(
*${as_nl}*)
case $ac_var in #(
- *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
-echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
+ *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
esac
case $ac_var in #(
_ | IFS | as_nl) ;; #(
- *) $as_unset $ac_var ;;
+ BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+ *) { eval $ac_var=; unset $ac_var;} ;;
esac ;;
esac
done
@@ -1529,128 +1871,136 @@ echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
)
echo
- cat <<\_ASBOX
-## ----------------- ##
+ $as_echo "## ----------------- ##
## Output variables. ##
-## ----------------- ##
-_ASBOX
+## ----------------- ##"
echo
for ac_var in $ac_subst_vars
do
eval ac_val=\$$ac_var
case $ac_val in
- *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
esac
- echo "$ac_var='\''$ac_val'\''"
+ $as_echo "$ac_var='\''$ac_val'\''"
done | sort
echo
if test -n "$ac_subst_files"; then
- cat <<\_ASBOX
-## ------------------- ##
+ $as_echo "## ------------------- ##
## File substitutions. ##
-## ------------------- ##
-_ASBOX
+## ------------------- ##"
echo
for ac_var in $ac_subst_files
do
eval ac_val=\$$ac_var
case $ac_val in
- *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
esac
- echo "$ac_var='\''$ac_val'\''"
+ $as_echo "$ac_var='\''$ac_val'\''"
done | sort
echo
fi
if test -s confdefs.h; then
- cat <<\_ASBOX
-## ----------- ##
+ $as_echo "## ----------- ##
## confdefs.h. ##
-## ----------- ##
-_ASBOX
+## ----------- ##"
echo
cat confdefs.h
echo
fi
test "$ac_signal" != 0 &&
- echo "$as_me: caught signal $ac_signal"
- echo "$as_me: exit $exit_status"
+ $as_echo "$as_me: caught signal $ac_signal"
+ $as_echo "$as_me: exit $exit_status"
} >&5
rm -f core *.core core.conftest.* &&
rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
exit $exit_status
' 0
for ac_signal in 1 2 13 15; do
- trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
+ trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal
done
ac_signal=0
# confdefs.h avoids OS command line length limits that DEFS can exceed.
rm -f -r conftest* confdefs.h
+$as_echo "/* confdefs.h */" > confdefs.h
+
# Predefined preprocessor variables.
cat >>confdefs.h <<_ACEOF
#define PACKAGE_NAME "$PACKAGE_NAME"
_ACEOF
-
cat >>confdefs.h <<_ACEOF
#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
_ACEOF
-
cat >>confdefs.h <<_ACEOF
#define PACKAGE_VERSION "$PACKAGE_VERSION"
_ACEOF
-
cat >>confdefs.h <<_ACEOF
#define PACKAGE_STRING "$PACKAGE_STRING"
_ACEOF
-
cat >>confdefs.h <<_ACEOF
#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
_ACEOF
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_URL "$PACKAGE_URL"
+_ACEOF
+
# Let the site file select an alternate cache file if it wants to.
-# Prefer explicitly selected file to automatically selected ones.
+# Prefer an explicitly selected file to automatically selected ones.
+ac_site_file1=NONE
+ac_site_file2=NONE
if test -n "$CONFIG_SITE"; then
- set x "$CONFIG_SITE"
+ # We do not want a PATH search for config.site.
+ case $CONFIG_SITE in #((
+ -*) ac_site_file1=./$CONFIG_SITE;;
+ */*) ac_site_file1=$CONFIG_SITE;;
+ *) ac_site_file1=./$CONFIG_SITE;;
+ esac
elif test "x$prefix" != xNONE; then
- set x "$prefix/share/config.site" "$prefix/etc/config.site"
+ ac_site_file1=$prefix/share/config.site
+ ac_site_file2=$prefix/etc/config.site
else
- set x "$ac_default_prefix/share/config.site" \
- "$ac_default_prefix/etc/config.site"
+ ac_site_file1=$ac_default_prefix/share/config.site
+ ac_site_file2=$ac_default_prefix/etc/config.site
fi
-shift
-for ac_site_file
+for ac_site_file in "$ac_site_file1" "$ac_site_file2"
do
- if test -r "$ac_site_file"; then
- { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
-echo "$as_me: loading site script $ac_site_file" >&6;}
+ test "x$ac_site_file" = xNONE && continue
+ if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
+$as_echo "$as_me: loading site script $ac_site_file" >&6;}
sed 's/^/| /' "$ac_site_file" >&5
- . "$ac_site_file"
+ . "$ac_site_file" \
+ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "failed to load site script $ac_site_file
+See \`config.log' for more details" "$LINENO" 5; }
fi
done
if test -r "$cache_file"; then
- # Some versions of bash will fail to source /dev/null (special
- # files actually), so we avoid doing that.
- if test -f "$cache_file"; then
- { echo "$as_me:$LINENO: loading cache $cache_file" >&5
-echo "$as_me: loading cache $cache_file" >&6;}
+ # Some versions of bash will fail to source /dev/null (special files
+ # actually), so we avoid doing that. DJGPP emulates it as a regular file.
+ if test /dev/null != "$cache_file" && test -f "$cache_file"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
+$as_echo "$as_me: loading cache $cache_file" >&6;}
case $cache_file in
[\\/]* | ?:[\\/]* ) . "$cache_file";;
*) . "./$cache_file";;
esac
fi
else
- { echo "$as_me:$LINENO: creating cache $cache_file" >&5
-echo "$as_me: creating cache $cache_file" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5
+$as_echo "$as_me: creating cache $cache_file" >&6;}
>$cache_file
fi
@@ -1664,60 +2014,56 @@ for ac_var in $ac_precious_vars; do
eval ac_new_val=\$ac_env_${ac_var}_value
case $ac_old_set,$ac_new_set in
set,)
- { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
-echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
ac_cache_corrupted=: ;;
,set)
- { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
-echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
ac_cache_corrupted=: ;;
,);;
*)
if test "x$ac_old_val" != "x$ac_new_val"; then
- { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
-echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
- { echo "$as_me:$LINENO: former value: $ac_old_val" >&5
-echo "$as_me: former value: $ac_old_val" >&2;}
- { echo "$as_me:$LINENO: current value: $ac_new_val" >&5
-echo "$as_me: current value: $ac_new_val" >&2;}
- ac_cache_corrupted=:
+ # differences in whitespace do not lead to failure.
+ ac_old_val_w=`echo x $ac_old_val`
+ ac_new_val_w=`echo x $ac_new_val`
+ if test "$ac_old_val_w" != "$ac_new_val_w"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5
+$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+ ac_cache_corrupted=:
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
+$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
+ eval $ac_var=\$ac_old_val
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5
+$as_echo "$as_me: former value: \`$ac_old_val'" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5
+$as_echo "$as_me: current value: \`$ac_new_val'" >&2;}
fi;;
esac
# Pass precious variables to config.status.
if test "$ac_new_set" = set; then
case $ac_new_val in
- *\'*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+ *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
*) ac_arg=$ac_var=$ac_new_val ;;
esac
case " $ac_configure_args " in
*" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
- *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+ *) as_fn_append ac_configure_args " '$ac_arg'" ;;
esac
fi
done
if $ac_cache_corrupted; then
- { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
-echo "$as_me: error: changes in the environment can compromise the build" >&2;}
- { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
-echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
- { (exit 1); exit 1; }; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
+$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+ as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
fi
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+## -------------------- ##
+## Main body of script. ##
+## -------------------- ##
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
@@ -1744,9 +2090,7 @@ for ac_dir in build "$srcdir"/build; do
fi
done
if test -z "$ac_aux_dir"; then
- { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in build \"$srcdir\"/build" >&5
-echo "$as_me: error: cannot find install-sh or install.sh in build \"$srcdir\"/build" >&2;}
- { (exit 1); exit 1; }; }
+ as_fn_error $? "cannot find install-sh, install.sh, or shtool in build \"$srcdir\"/build" "$LINENO" 5
fi
# These three variables are undocumented and unsupported,
@@ -1844,7 +2188,7 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
# Check whether --enable-layout was given.
-if test "${enable_layout+set}" = set; then
+if test "${enable_layout+set}" = set; then :
enableval=$enable_layout;
LAYOUT=$enableval
@@ -1914,10 +2258,10 @@ fi
-{ echo "$as_me:$LINENO: checking for chosen layout" >&5
-echo $ECHO_N "checking for chosen layout... $ECHO_C" >&6; }
-{ echo "$as_me:$LINENO: result: $layout_name" >&5
-echo "${ECHO_T}$layout_name" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for chosen layout" >&5
+$as_echo_n "checking for chosen layout... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $layout_name" >&5
+$as_echo "$layout_name" >&6; }
@@ -2035,9 +2379,7 @@ do
eval ac_val=$`echo $ac_var`
case $ac_val in
[\\/$]* | ?:[\\/]* | NONE | '' ) ;;
- *) { { echo "$as_me:$LINENO: error: expected an absolute path for --$ac_var: $ac_val" >&5
-echo "$as_me: error: expected an absolute path for --$ac_var: $ac_val" >&2;}
- { (exit 1); exit 1; }; };;
+ *) as_fn_error $? "expected an absolute path for --$ac_var: $ac_val" "$LINENO" 5;;
esac
done
@@ -2129,10 +2471,10 @@ arg="${ap_cur}"
nl='
'
- { echo "$as_me:$LINENO: checking for working mkdir -p" >&5
-echo $ECHO_N "checking for working mkdir -p... $ECHO_C" >&6; }
-if test "${ac_cv_mkdir_p+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working mkdir -p" >&5
+$as_echo_n "checking for working mkdir -p... " >&6; }
+if ${ac_cv_mkdir_p+:} false; then :
+ $as_echo_n "(cached) " >&6
else
test -d conftestdir && rm -rf conftestdir
@@ -2145,8 +2487,8 @@ else
rm -rf conftestdir
fi
-{ echo "$as_me:$LINENO: result: $ac_cv_mkdir_p" >&5
-echo "${ECHO_T}$ac_cv_mkdir_p" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_mkdir_p" >&5
+$as_echo "$ac_cv_mkdir_p" >&6; }
if test "$ac_cv_mkdir_p" = "yes"; then
mkdir_p="mkdir -p"
else
@@ -2159,35 +2501,27 @@ echo "${ECHO_T}$ac_cv_mkdir_p" >&6; }
# Make sure we can run config.sub.
$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
- { { echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5
-echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;}
- { (exit 1); exit 1; }; }
-
-{ echo "$as_me:$LINENO: checking build system type" >&5
-echo $ECHO_N "checking build system type... $ECHO_C" >&6; }
-if test "${ac_cv_build+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
+ as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
+$as_echo_n "checking build system type... " >&6; }
+if ${ac_cv_build+:} false; then :
+ $as_echo_n "(cached) " >&6
else
ac_build_alias=$build_alias
test "x$ac_build_alias" = x &&
ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
test "x$ac_build_alias" = x &&
- { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
-echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
- { (exit 1); exit 1; }; }
+ as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5
ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
- { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5
-echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;}
- { (exit 1); exit 1; }; }
+ as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
fi
-{ echo "$as_me:$LINENO: result: $ac_cv_build" >&5
-echo "${ECHO_T}$ac_cv_build" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
+$as_echo "$ac_cv_build" >&6; }
case $ac_cv_build in
*-*-*) ;;
-*) { { echo "$as_me:$LINENO: error: invalid value of canonical build" >&5
-echo "$as_me: error: invalid value of canonical build" >&2;}
- { (exit 1); exit 1; }; };;
+*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;;
esac
build=$ac_cv_build
ac_save_IFS=$IFS; IFS='-'
@@ -2203,28 +2537,24 @@ IFS=$ac_save_IFS
case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
-{ echo "$as_me:$LINENO: checking host system type" >&5
-echo $ECHO_N "checking host system type... $ECHO_C" >&6; }
-if test "${ac_cv_host+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
+$as_echo_n "checking host system type... " >&6; }
+if ${ac_cv_host+:} false; then :
+ $as_echo_n "(cached) " >&6
else
if test "x$host_alias" = x; then
ac_cv_host=$ac_cv_build
else
ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
- { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5
-echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;}
- { (exit 1); exit 1; }; }
+ as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
fi
fi
-{ echo "$as_me:$LINENO: result: $ac_cv_host" >&5
-echo "${ECHO_T}$ac_cv_host" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5
+$as_echo "$ac_cv_host" >&6; }
case $ac_cv_host in
*-*-*) ;;
-*) { { echo "$as_me:$LINENO: error: invalid value of canonical host" >&5
-echo "$as_me: error: invalid value of canonical host" >&2;}
- { (exit 1); exit 1; }; };;
+*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;;
esac
host=$ac_cv_host
ac_save_IFS=$IFS; IFS='-'
@@ -2240,28 +2570,24 @@ IFS=$ac_save_IFS
case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
-{ echo "$as_me:$LINENO: checking target system type" >&5
-echo $ECHO_N "checking target system type... $ECHO_C" >&6; }
-if test "${ac_cv_target+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5
+$as_echo_n "checking target system type... " >&6; }
+if ${ac_cv_target+:} false; then :
+ $as_echo_n "(cached) " >&6
else
if test "x$target_alias" = x; then
ac_cv_target=$ac_cv_host
else
ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` ||
- { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $target_alias failed" >&5
-echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $target_alias failed" >&2;}
- { (exit 1); exit 1; }; }
+ as_fn_error $? "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5
fi
fi
-{ echo "$as_me:$LINENO: result: $ac_cv_target" >&5
-echo "${ECHO_T}$ac_cv_target" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5
+$as_echo "$ac_cv_target" >&6; }
case $ac_cv_target in
*-*-*) ;;
-*) { { echo "$as_me:$LINENO: error: invalid value of canonical target" >&5
-echo "$as_me: error: invalid value of canonical target" >&2;}
- { (exit 1); exit 1; }; };;
+*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;;
esac
target=$ac_cv_target
ac_save_IFS=$IFS; IFS='-'
@@ -2284,6 +2610,7 @@ test -n "$target_alias" &&
NONENONEs,x,x, &&
program_prefix=${target_alias}-
+
orig_prefix="$prefix"
echo $ac_n "${nl}Configuring Apache Portable Runtime library...${nl}"
@@ -2313,16 +2640,14 @@ echo $ac_n "${nl}Configuring Apache Portable Runtime library...${nl}"
esac
done
- { echo "$as_me:$LINENO: checking for APR" >&5
-echo $ECHO_N "checking for APR... $ECHO_C" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for APR" >&5
+$as_echo_n "checking for APR... " >&6; }
# Check whether --with-apr was given.
-if test "${with_apr+set}" = set; then
+if test "${with_apr+set}" = set; then :
withval=$with_apr;
if test "$withval" = "no" || test "$withval" = "yes"; then
- { { echo "$as_me:$LINENO: error: --with-apr requires a directory or file to be provided" >&5
-echo "$as_me: error: --with-apr requires a directory or file to be provided" >&2;}
- { (exit 1); exit 1; }; }
+ as_fn_error $? "--with-apr requires a directory or file to be provided" "$LINENO" 5
fi
for apr_temp_apr_config_file in $apr_temp_acceptable_apr_config
@@ -2344,9 +2669,7 @@ echo "$as_me: error: --with-apr requires a directory or file to be provided" >&2
fi
if test "$apr_found" != "yes"; then
- { { echo "$as_me:$LINENO: error: the --with-apr parameter is incorrect. It must specify an install prefix, a build directory, or an apr-config file." >&5
-echo "$as_me: error: the --with-apr parameter is incorrect. It must specify an install prefix, a build directory, or an apr-config file." >&2;}
- { (exit 1); exit 1; }; }
+ as_fn_error $? "the --with-apr parameter is incorrect. It must specify an install prefix, a build directory, or an apr-config file." "$LINENO" 5
fi
else
@@ -2377,9 +2700,7 @@ else
apr_bundled_major="`sed -n '/#define.*APR_MAJOR_VERSION/s/^[^0-9]*\([0-9]*\).*$/\1/p' \""$srcdir/apr"/include/apr_version.h\"`"
case $apr_bundled_major in
"")
- { { echo "$as_me:$LINENO: error: failed to find major version of bundled APR" >&5
-echo "$as_me: error: failed to find major version of bundled APR" >&2;}
- { (exit 1); exit 1; }; }
+ as_fn_error $? "failed to find major version of bundled APR" "$LINENO" 5
;;
0)
apr_temp_apr_config_file="apr-config"
@@ -2398,14 +2719,12 @@ echo "$as_me: error: failed to find major version of bundled APR" >&2;}
fi
- { echo "$as_me:$LINENO: result: $apr_found" >&5
-echo "${ECHO_T}$apr_found" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $apr_found" >&5
+$as_echo "$apr_found" >&6; }
if test "$apr_found" = "no"; then
- { { echo "$as_me:$LINENO: error: APR not found. Please read the documentation." >&5
-echo "$as_me: error: APR not found. Please read the documentation." >&2;}
- { (exit 1); exit 1; }; }
+ as_fn_error $? "APR not found. Please read the documentation." "$LINENO" 5
fi
if test "$apr_found" = "reconfig"; then
@@ -2438,12 +2757,13 @@ _ACEOF
case $ac_val in #(
*${as_nl}*)
case $ac_var in #(
- *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
-echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
+ *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
esac
case $ac_var in #(
_ | IFS | as_nl) ;; #(
- *) $as_unset $ac_var ;;
+ BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+ *) { eval $ac_var=; unset $ac_var;} ;;
esac ;;
esac
done
@@ -2451,8 +2771,8 @@ echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
(set) 2>&1 |
case $as_nl`(ac_space=' '; set) 2>&1` in #(
*${as_nl}ac_space=\ *)
- # `set' does not quote correctly, so add quotes (double-quote
- # substitution turns \\\\ into \\, and sed turns \\ into \).
+ # `set' does not quote correctly, so add quotes: double-quote
+ # substitution turns \\\\ into \\, and sed turns \\ into \.
sed -n \
"s/'/'\\\\''/g;
s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
@@ -2474,13 +2794,24 @@ echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
:end' >>confcache
if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
if test -w "$cache_file"; then
- test "x$cache_file" != "x/dev/null" &&
- { echo "$as_me:$LINENO: updating cache $cache_file" >&5
-echo "$as_me: updating cache $cache_file" >&6;}
- cat confcache >$cache_file
+ if test "x$cache_file" != "x/dev/null"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
+$as_echo "$as_me: updating cache $cache_file" >&6;}
+ if test ! -f "$cache_file" || test -h "$cache_file"; then
+ cat confcache >"$cache_file"
+ else
+ case $cache_file in #(
+ */* | ?:*)
+ mv -f confcache "$cache_file"$$ &&
+ mv -f "$cache_file"$$ "$cache_file" ;; #(
+ *)
+ mv -f confcache "$cache_file" ;;
+ esac
+ fi
+ fi
else
- { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5
-echo "$as_me: not updating unwritable cache $cache_file" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
+$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
fi
fi
rm -f confcache
@@ -2535,19 +2866,19 @@ rm -f confcache
# grab any updates from the sub-package
if test -r "$cache_file"; then
- # Some versions of bash will fail to source /dev/null (special
- # files actually), so we avoid doing that.
- if test -f "$cache_file"; then
- { echo "$as_me:$LINENO: loading cache $cache_file" >&5
-echo "$as_me: loading cache $cache_file" >&6;}
+ # Some versions of bash will fail to source /dev/null (special files
+ # actually), so we avoid doing that. DJGPP emulates it as a regular file.
+ if test /dev/null != "$cache_file" && test -f "$cache_file"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
+$as_echo "$as_me: loading cache $cache_file" >&6;}
case $cache_file in
[\\/]* | ?:[\\/]* ) . "$cache_file";;
*) . "./$cache_file";;
esac
fi
else
- { echo "$as_me:$LINENO: creating cache $cache_file" >&5
-echo "$as_me: creating cache $cache_file" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5
+$as_echo "$as_me: creating cache $cache_file" >&6;}
>$cache_file
fi
@@ -2705,16 +3036,14 @@ else
esac
done
- { echo "$as_me:$LINENO: checking for APR-util" >&5
-echo $ECHO_N "checking for APR-util... $ECHO_C" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for APR-util" >&5
+$as_echo_n "checking for APR-util... " >&6; }
# Check whether --with-apr-util was given.
-if test "${with_apr_util+set}" = set; then
+if test "${with_apr_util+set}" = set; then :
withval=$with_apr_util;
if test "$withval" = "no" || test "$withval" = "yes"; then
- { { echo "$as_me:$LINENO: error: --with-apr-util requires a directory or file to be provided" >&5
-echo "$as_me: error: --with-apr-util requires a directory or file to be provided" >&2;}
- { (exit 1); exit 1; }; }
+ as_fn_error $? "--with-apr-util requires a directory or file to be provided" "$LINENO" 5
fi
for apu_temp_apu_config_file in $apu_temp_acceptable_apu_config
@@ -2736,9 +3065,7 @@ echo "$as_me: error: --with-apr-util requires a directory or file to be provided
fi
if test "$apu_found" != "yes"; then
- { { echo "$as_me:$LINENO: error: the --with-apr-util parameter is incorrect. It must specify an install prefix, a build directory, or an apu-config file." >&5
-echo "$as_me: error: the --with-apr-util parameter is incorrect. It must specify an install prefix, a build directory, or an apu-config file." >&2;}
- { (exit 1); exit 1; }; }
+ as_fn_error $? "the --with-apr-util parameter is incorrect. It must specify an install prefix, a build directory, or an apu-config file." "$LINENO" 5
fi
else
@@ -2769,9 +3096,7 @@ else
apu_bundled_major="`sed -n '/#define.*APU_MAJOR_VERSION/s/^[^0-9]*\([0-9]*\).*$/\1/p' \""$srcdir/apr-util"/include/apu_version.h\"`"
case $apu_bundled_major in
"")
- { { echo "$as_me:$LINENO: error: failed to find major version of bundled APU" >&5
-echo "$as_me: error: failed to find major version of bundled APU" >&2;}
- { (exit 1); exit 1; }; }
+ as_fn_error $? "failed to find major version of bundled APU" "$LINENO" 5
;;
0)
apu_temp_apu_config_file="apu-config"
@@ -2790,28 +3115,22 @@ echo "$as_me: error: failed to find major version of bundled APU" >&2;}
fi
- { echo "$as_me:$LINENO: result: $apu_found" >&5
-echo "${ECHO_T}$apu_found" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $apu_found" >&5
+$as_echo "$apu_found" >&6; }
if test "$apu_found" = "no"; then
- { { echo "$as_me:$LINENO: error: APR-util not found. Please read the documentation." >&5
-echo "$as_me: error: APR-util not found. Please read the documentation." >&2;}
- { (exit 1); exit 1; }; }
+ as_fn_error $? "APR-util not found. Please read the documentation." "$LINENO" 5
fi
# Catch some misconfigurations:
case ${apr_found}.${apu_found} in
reconfig.yes)
- { { echo "$as_me:$LINENO: error: Cannot use an external APR-util with the bundled APR" >&5
-echo "$as_me: error: Cannot use an external APR-util with the bundled APR" >&2;}
- { (exit 1); exit 1; }; }
+ as_fn_error $? "Cannot use an external APR-util with the bundled APR" "$LINENO" 5
;;
yes.reconfig)
- { { echo "$as_me:$LINENO: error: Cannot use an external APR with the bundled APR-util" >&5
-echo "$as_me: error: Cannot use an external APR with the bundled APR-util" >&2;}
- { (exit 1); exit 1; }; }
+ as_fn_error $? "Cannot use an external APR with the bundled APR-util" "$LINENO" 5
;;
esac
@@ -2845,12 +3164,13 @@ _ACEOF
case $ac_val in #(
*${as_nl}*)
case $ac_var in #(
- *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
-echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
+ *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
esac
case $ac_var in #(
_ | IFS | as_nl) ;; #(
- *) $as_unset $ac_var ;;
+ BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+ *) { eval $ac_var=; unset $ac_var;} ;;
esac ;;
esac
done
@@ -2858,8 +3178,8 @@ echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
(set) 2>&1 |
case $as_nl`(ac_space=' '; set) 2>&1` in #(
*${as_nl}ac_space=\ *)
- # `set' does not quote correctly, so add quotes (double-quote
- # substitution turns \\\\ into \\, and sed turns \\ into \).
+ # `set' does not quote correctly, so add quotes: double-quote
+ # substitution turns \\\\ into \\, and sed turns \\ into \.
sed -n \
"s/'/'\\\\''/g;
s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
@@ -2881,13 +3201,24 @@ echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
:end' >>confcache
if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
if test -w "$cache_file"; then
- test "x$cache_file" != "x/dev/null" &&
- { echo "$as_me:$LINENO: updating cache $cache_file" >&5
-echo "$as_me: updating cache $cache_file" >&6;}
- cat confcache >$cache_file
+ if test "x$cache_file" != "x/dev/null"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
+$as_echo "$as_me: updating cache $cache_file" >&6;}
+ if test ! -f "$cache_file" || test -h "$cache_file"; then
+ cat confcache >"$cache_file"
+ else
+ case $cache_file in #(
+ */* | ?:*)
+ mv -f confcache "$cache_file"$$ &&
+ mv -f "$cache_file"$$ "$cache_file" ;; #(
+ *)
+ mv -f confcache "$cache_file" ;;
+ esac
+ fi
+ fi
else
- { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5
-echo "$as_me: not updating unwritable cache $cache_file" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
+$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
fi
fi
rm -f confcache
@@ -2942,19 +3273,19 @@ rm -f confcache
# grab any updates from the sub-package
if test -r "$cache_file"; then
- # Some versions of bash will fail to source /dev/null (special
- # files actually), so we avoid doing that.
- if test -f "$cache_file"; then
- { echo "$as_me:$LINENO: loading cache $cache_file" >&5
-echo "$as_me: loading cache $cache_file" >&6;}
+ # Some versions of bash will fail to source /dev/null (special files
+ # actually), so we avoid doing that. DJGPP emulates it as a regular file.
+ if test /dev/null != "$cache_file" && test -f "$cache_file"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
+$as_echo "$as_me: loading cache $cache_file" >&6;}
case $cache_file in
[\\/]* | ?:[\\/]* ) . "$cache_file";;
*) . "./$cache_file";;
esac
fi
else
- { echo "$as_me:$LINENO: creating cache $cache_file" >&5
-echo "$as_me: creating cache $cache_file" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5
+$as_echo "$as_me: creating cache $cache_file" >&6;}
>$cache_file
fi
@@ -3003,10 +3334,10 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
set dummy ${ac_tool_prefix}gcc; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
@@ -3016,25 +3347,25 @@ for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="${ac_tool_prefix}gcc"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
-done
+ done
IFS=$as_save_IFS
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
- { echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
fi
@@ -3043,10 +3374,10 @@ if test -z "$ac_cv_prog_CC"; then
ac_ct_CC=$CC
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_CC"; then
ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
@@ -3056,25 +3387,25 @@ for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_CC="gcc"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
-done
+ done
IFS=$as_save_IFS
fi
fi
ac_ct_CC=$ac_cv_prog_ac_ct_CC
if test -n "$ac_ct_CC"; then
- { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-echo "${ECHO_T}$ac_ct_CC" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
fi
if test "x$ac_ct_CC" = x; then
@@ -3082,12 +3413,8 @@ fi
else
case $cross_compiling:$ac_tool_warned in
yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
CC=$ac_ct_CC
@@ -3100,10 +3427,10 @@ if test -z "$CC"; then
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
set dummy ${ac_tool_prefix}cc; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
@@ -3113,25 +3440,25 @@ for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="${ac_tool_prefix}cc"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
-done
+ done
IFS=$as_save_IFS
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
- { echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
fi
@@ -3140,10 +3467,10 @@ fi
if test -z "$CC"; then
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
@@ -3154,18 +3481,18 @@ for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
ac_prog_rejected=yes
continue
fi
ac_cv_prog_CC="cc"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
-done
+ done
IFS=$as_save_IFS
if test $ac_prog_rejected = yes; then
@@ -3184,11 +3511,11 @@ fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
- { echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
fi
@@ -3199,10 +3526,10 @@ if test -z "$CC"; then
do
# Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
@@ -3212,25 +3539,25 @@ for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
-done
+ done
IFS=$as_save_IFS
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
- { echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
fi
@@ -3243,10 +3570,10 @@ if test -z "$CC"; then
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_CC"; then
ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
@@ -3256,25 +3583,25 @@ for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_CC="$ac_prog"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
-done
+ done
IFS=$as_save_IFS
fi
fi
ac_ct_CC=$ac_cv_prog_ac_ct_CC
if test -n "$ac_ct_CC"; then
- { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-echo "${ECHO_T}$ac_ct_CC" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
fi
@@ -3286,12 +3613,8 @@ done
else
case $cross_compiling:$ac_tool_warned in
yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
CC=$ac_ct_CC
@@ -3301,51 +3624,37 @@ fi
fi
-test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
-See \`config.log' for more details." >&5
-echo "$as_me: error: no acceptable C compiler found in \$PATH
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }
+test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "no acceptable C compiler found in \$PATH
+See \`config.log' for more details" "$LINENO" 5; }
# Provide some information about the compiler.
-echo "$as_me:$LINENO: checking for C compiler version" >&5
-ac_compiler=`set X $ac_compile; echo $2`
-{ (ac_try="$ac_compiler --version >&5"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_compiler --version >&5") 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }
-{ (ac_try="$ac_compiler -v >&5"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_compiler -v >&5") 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }
-{ (ac_try="$ac_compiler -V >&5"
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+for ac_option in --version -v -V -qversion; do
+ { { ac_try="$ac_compiler $ac_option >&5"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_compiler -V >&5") 2>&5
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_compiler $ac_option >&5") 2>conftest.err
ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }
+ if test -s conftest.err; then
+ sed '10a\
+... rest of stderr output deleted ...
+ 10q' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ fi
+ rm -f conftest.er1 conftest.err
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+done
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
@@ -3357,42 +3666,38 @@ main ()
}
_ACEOF
ac_clean_files_save=$ac_clean_files
-ac_clean_files="$ac_clean_files a.out a.exe b.out"
+ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
# Try to create an executable without -o first, disregard a.out.
# It will help us diagnose broken compilers, and finding out an intuition
# of exeext.
-{ echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
-echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6; }
-ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
-#
-# List of possible output files, starting from the most likely.
-# The algorithm is not robust to junk in `.', hence go to wildcards (a.*)
-# only as a last resort. b.out is created by i960 compilers.
-ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out'
-#
-# The IRIX 6 linker writes into existing files which may not be
-# executable, retaining their permissions. Remove them first so a
-# subsequent execution test works.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
+$as_echo_n "checking whether the C compiler works... " >&6; }
+ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+
+# The possible output files:
+ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"
+
ac_rmfiles=
for ac_file in $ac_files
do
case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;;
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
* ) ac_rmfiles="$ac_rmfiles $ac_file";;
esac
done
rm -f $ac_rmfiles
-if { (ac_try="$ac_link_default"
+if { { ac_try="$ac_link_default"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
(eval "$ac_link_default") 2>&5
ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; then
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then :
# Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
# in a Makefile. We should not override ac_cv_exeext if it was cached,
@@ -3402,14 +3707,14 @@ for ac_file in $ac_files ''
do
test -f "$ac_file" || continue
case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj )
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )
;;
[ab].out )
# We found the default executable, but exeext='' is most
# certainly right.
break;;
*.* )
- if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
+ if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
then :; else
ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
fi
@@ -3428,78 +3733,41 @@ test "$ac_cv_exeext" = no && ac_cv_exeext=
else
ac_file=''
fi
-
-{ echo "$as_me:$LINENO: result: $ac_file" >&5
-echo "${ECHO_T}$ac_file" >&6; }
-if test -z "$ac_file"; then
- echo "$as_me: failed program was:" >&5
+if test -z "$ac_file"; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
-See \`config.log' for more details." >&5
-echo "$as_me: error: C compiler cannot create executables
-See \`config.log' for more details." >&2;}
- { (exit 77); exit 77; }; }
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "C compiler cannot create executables
+See \`config.log' for more details" "$LINENO" 5; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
fi
-
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
+$as_echo_n "checking for C compiler default output file name... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
+$as_echo "$ac_file" >&6; }
ac_exeext=$ac_cv_exeext
-# Check that the compiler produces executables we can run. If not, either
-# the compiler is broken, or we cross compile.
-{ echo "$as_me:$LINENO: checking whether the C compiler works" >&5
-echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6; }
-# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
-# If not cross compiling, check that we can run a simple program.
-if test "$cross_compiling" != yes; then
- if { ac_try='./$ac_file'
- { (case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_try") 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- cross_compiling=no
- else
- if test "$cross_compiling" = maybe; then
- cross_compiling=yes
- else
- { { echo "$as_me:$LINENO: error: cannot run C compiled programs.
-If you meant to cross compile, use \`--host'.
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot run C compiled programs.
-If you meant to cross compile, use \`--host'.
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }
- fi
- fi
-fi
-{ echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
-
-rm -f a.out a.exe conftest$ac_cv_exeext b.out
+rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
ac_clean_files=$ac_clean_files_save
-# Check that the compiler produces executables we can run. If not, either
-# the compiler is broken, or we cross compile.
-{ echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
-echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; }
-{ echo "$as_me:$LINENO: result: $cross_compiling" >&5
-echo "${ECHO_T}$cross_compiling" >&6; }
-
-{ echo "$as_me:$LINENO: checking for suffix of executables" >&5
-echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; }
-if { (ac_try="$ac_link"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
+$as_echo_n "checking for suffix of executables... " >&6; }
+if { { ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
(eval "$ac_link") 2>&5
ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; then
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then :
# If both `conftest.exe' and `conftest' are `present' (well, observable)
# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
# work properly (i.e., refer to `conftest.exe'), while it won't with
@@ -3507,37 +3775,90 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
for ac_file in conftest.exe conftest conftest.*; do
test -f "$ac_file" || continue
case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;;
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
*.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
break;;
* ) break;;
esac
done
else
- { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details" "$LINENO" 5; }
fi
-
-rm -f conftest$ac_cv_exeext
-{ echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
-echo "${ECHO_T}$ac_cv_exeext" >&6; }
+rm -f conftest conftest$ac_cv_exeext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
+$as_echo "$ac_cv_exeext" >&6; }
rm -f conftest.$ac_ext
EXEEXT=$ac_cv_exeext
ac_exeext=$EXEEXT
-{ echo "$as_me:$LINENO: checking for suffix of object files" >&5
-echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; }
-if test "${ac_cv_objext+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdio.h>
+int
+main ()
+{
+FILE *f = fopen ("conftest.out", "w");
+ return ferror (f) || fclose (f) != 0;
+
+ ;
+ return 0;
+}
_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ac_clean_files="$ac_clean_files conftest.out"
+# Check that the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
+$as_echo_n "checking whether we are cross compiling... " >&6; }
+if test "$cross_compiling" != yes; then
+ { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+ if { ac_try='./conftest$ac_cv_exeext'
+ { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }; then
+ cross_compiling=no
+ else
+ if test "$cross_compiling" = maybe; then
+ cross_compiling=yes
+ else
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
+$as_echo "$cross_compiling" >&6; }
+
+rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
+ac_clean_files=$ac_clean_files_save
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
+$as_echo_n "checking for suffix of object files... " >&6; }
+if ${ac_cv_objext+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
@@ -3549,51 +3870,46 @@ main ()
}
_ACEOF
rm -f conftest.o conftest.obj
-if { (ac_try="$ac_compile"
+if { { ac_try="$ac_compile"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
(eval "$ac_compile") 2>&5
ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; then
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then :
for ac_file in conftest.o conftest.obj conftest.*; do
test -f "$ac_file" || continue;
case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;;
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;
*) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
break;;
esac
done
else
- echo "$as_me: failed program was:" >&5
+ $as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute suffix of object files: cannot compile
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot compute suffix of object files: cannot compile
+See \`config.log' for more details" "$LINENO" 5; }
fi
-
rm -f conftest.$ac_cv_objext conftest.$ac_ext
fi
-{ echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
-echo "${ECHO_T}$ac_cv_objext" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5
+$as_echo "$ac_cv_objext" >&6; }
OBJEXT=$ac_cv_objext
ac_objext=$OBJEXT
-{ echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
-echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; }
-if test "${ac_cv_c_compiler_gnu+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
+$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
+if ${ac_cv_c_compiler_gnu+:} false; then :
+ $as_echo_n "(cached) " >&6
else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
@@ -3607,54 +3923,34 @@ main ()
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
+if ac_fn_c_try_compile "$LINENO"; then :
ac_compiler_gnu=yes
else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_compiler_gnu=no
+ ac_compiler_gnu=no
fi
-
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_cv_c_compiler_gnu=$ac_compiler_gnu
fi
-{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
-echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; }
-GCC=`test $ac_compiler_gnu = yes && echo yes`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
+$as_echo "$ac_cv_c_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+ GCC=yes
+else
+ GCC=
+fi
ac_test_CFLAGS=${CFLAGS+set}
ac_save_CFLAGS=$CFLAGS
-{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
-echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; }
-if test "${ac_cv_prog_cc_g+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
+$as_echo_n "checking whether $CC accepts -g... " >&6; }
+if ${ac_cv_prog_cc_g+:} false; then :
+ $as_echo_n "(cached) " >&6
else
ac_save_c_werror_flag=$ac_c_werror_flag
ac_c_werror_flag=yes
ac_cv_prog_cc_g=no
CFLAGS="-g"
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
@@ -3665,34 +3961,11 @@ main ()
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
+if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_prog_cc_g=yes
else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- CFLAGS=""
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ CFLAGS=""
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
@@ -3703,35 +3976,12 @@ main ()
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- :
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+if ac_fn_c_try_compile "$LINENO"; then :
- ac_c_werror_flag=$ac_save_c_werror_flag
+else
+ ac_c_werror_flag=$ac_save_c_werror_flag
CFLAGS="-g"
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
@@ -3742,42 +3992,18 @@ main ()
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
+if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_prog_cc_g=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
fi
-
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
-
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
-
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_c_werror_flag=$ac_save_c_werror_flag
fi
-{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
-echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
+$as_echo "$ac_cv_prog_cc_g" >&6; }
if test "$ac_test_CFLAGS" = set; then
CFLAGS=$ac_save_CFLAGS
elif test $ac_cv_prog_cc_g = yes; then
@@ -3793,23 +4019,18 @@ else
CFLAGS=
fi
fi
-{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5
-echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; }
-if test "${ac_cv_prog_cc_c89+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
+$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
+if ${ac_cv_prog_cc_c89+:} false; then :
+ $as_echo_n "(cached) " >&6
else
ac_cv_prog_cc_c89=no
ac_save_CC=$CC
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <stdarg.h>
#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
+struct stat;
/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
struct buf { int x; };
FILE * (*rcsopen) (struct buf *, struct stat *, int);
@@ -3861,31 +4082,9 @@ for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
-Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
do
CC="$ac_save_CC $ac_arg"
- rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
+ if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_prog_cc_c89=$ac_arg
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
fi
-
rm -f core conftest.err conftest.$ac_objext
test "x$ac_cv_prog_cc_c89" != "xno" && break
done
@@ -3896,17 +4095,19 @@ fi
# AC_CACHE_VAL
case "x$ac_cv_prog_cc_c89" in
x)
- { echo "$as_me:$LINENO: result: none needed" >&5
-echo "${ECHO_T}none needed" >&6; } ;;
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
+$as_echo "none needed" >&6; } ;;
xno)
- { echo "$as_me:$LINENO: result: unsupported" >&5
-echo "${ECHO_T}unsupported" >&6; } ;;
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
+$as_echo "unsupported" >&6; } ;;
*)
CC="$CC $ac_cv_prog_cc_c89"
- { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5
-echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;;
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
+$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
esac
+if test "x$ac_cv_prog_cc_c89" != xno; then :
+fi
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
@@ -3919,15 +4120,15 @@ ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
-{ echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
-echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
+$as_echo_n "checking how to run the C preprocessor... " >&6; }
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
fi
if test -z "$CPP"; then
- if test "${ac_cv_prog_CPP+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
+ if ${ac_cv_prog_CPP+:} false; then :
+ $as_echo_n "(cached) " >&6
else
# Double quotes because CPP needs to be expanded
for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
@@ -3941,11 +4142,7 @@ do
# <limits.h> exists even on freestanding compilers.
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp. "Syntax error" is here to catch this case.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#ifdef __STDC__
# include <limits.h>
@@ -3954,76 +4151,34 @@ cat >>conftest.$ac_ext <<_ACEOF
#endif
Syntax error
_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.err
- }; then
- :
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+if ac_fn_c_try_cpp "$LINENO"; then :
+else
# Broken: fails on valid input.
continue
fi
-
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
# OK, works on sane cases. Now check whether nonexistent headers
# can be detected and how.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <ac_nonexistent.h>
_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.err
- }; then
+if ac_fn_c_try_cpp "$LINENO"; then :
# Broken: success on invalid input.
continue
else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
# Passes both tests.
ac_preproc_ok=:
break
fi
-
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
done
# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
break
fi
@@ -4035,8 +4190,8 @@ fi
else
ac_cv_prog_CPP=$CPP
fi
-{ echo "$as_me:$LINENO: result: $CPP" >&5
-echo "${ECHO_T}$CPP" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
+$as_echo "$CPP" >&6; }
ac_preproc_ok=false
for ac_c_preproc_warn_flag in '' yes
do
@@ -4046,11 +4201,7 @@ do
# <limits.h> exists even on freestanding compilers.
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp. "Syntax error" is here to catch this case.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#ifdef __STDC__
# include <limits.h>
@@ -4059,83 +4210,40 @@ cat >>conftest.$ac_ext <<_ACEOF
#endif
Syntax error
_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.err
- }; then
- :
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+if ac_fn_c_try_cpp "$LINENO"; then :
+else
# Broken: fails on valid input.
continue
fi
-
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
# OK, works on sane cases. Now check whether nonexistent headers
# can be detected and how.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <ac_nonexistent.h>
_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.err
- }; then
+if ac_fn_c_try_cpp "$LINENO"; then :
# Broken: success on invalid input.
continue
else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
# Passes both tests.
ac_preproc_ok=:
break
fi
-
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
done
# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then
- :
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+
else
- { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details." >&5
-echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details" "$LINENO" 5; }
fi
ac_ext=c
@@ -4157,22 +4265,23 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# OS/2's system install, which has a completely different semantic
# ./install, which can be erroneously created by make from ./install.sh.
-{ echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
-echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; }
+# Reject install programs that cannot install multiple files.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5
+$as_echo_n "checking for a BSD-compatible install... " >&6; }
if test -z "$INSTALL"; then
-if test "${ac_cv_path_install+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
+if ${ac_cv_path_install+:} false; then :
+ $as_echo_n "(cached) " >&6
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
- # Account for people who put trailing slashes in PATH elements.
-case $as_dir/ in
- ./ | .// | /cC/* | \
+ # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in #((
+ ./ | .// | /[cC]/* | \
/etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
- ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
+ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \
/usr/ucb/* ) ;;
*)
# OSF1 and SCO ODT 3.0 have their own names for install.
@@ -4180,7 +4289,7 @@ case $as_dir/ in
# by default.
for ac_prog in ginstall scoinst install; do
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
if test $ac_prog = install &&
grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
# AIX install. It has an incompatible calling convention.
@@ -4190,17 +4299,29 @@ case $as_dir/ in
# program-specific install script used by HP pwplus--don't use.
:
else
- ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
- break 3
+ rm -rf conftest.one conftest.two conftest.dir
+ echo one > conftest.one
+ echo two > conftest.two
+ mkdir conftest.dir
+ if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" &&
+ test -s conftest.one && test -s conftest.two &&
+ test -s conftest.dir/conftest.one &&
+ test -s conftest.dir/conftest.two
+ then
+ ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+ break 3
+ fi
fi
fi
done
done
;;
esac
-done
+
+ done
IFS=$as_save_IFS
+rm -rf conftest.one conftest.two conftest.dir
fi
if test "${ac_cv_path_install+set}" = set; then
@@ -4213,8 +4334,8 @@ fi
INSTALL=$ac_install_sh
fi
fi
-{ echo "$as_me:$LINENO: result: $INSTALL" >&5
-echo "${ECHO_T}$INSTALL" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5
+$as_echo "$INSTALL" >&6; }
# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
# It thinks the first close brace ends the variable substitution.
@@ -4249,19 +4370,15 @@ SERF_DOTTED_VERSION="`$get_version all $version_hdr SERF`"
# Check whether --with-openssl was given.
-if test "${with_openssl+set}" = set; then
+if test "${with_openssl+set}" = set; then :
withval=$with_openssl;
if test "$withval" = "yes"; then
- { { echo "$as_me:$LINENO: error: --with-openssl requires a path" >&5
-echo "$as_me: error: --with-openssl requires a path" >&2;}
- { (exit 1); exit 1; }; }
+ as_fn_error $? "--with-openssl requires a path" "$LINENO" 5
else
openssl_prefix=$withval
if test "x$openssl_prefix" != "x" -a ! -d "$openssl_prefix"; then
- { { echo "$as_me:$LINENO: error: '--with-openssl requires a path to a directory'" >&5
-echo "$as_me: error: '--with-openssl requires a path to a directory'" >&2;}
- { (exit 1); exit 1; }; }
+ as_fn_error $? "'--with-openssl requires a path to a directory'" "$LINENO" 5
fi
@@ -4379,45 +4496,40 @@ fi
-{ echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5
-echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; }
-if test "${ac_cv_path_GREP+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- # Extract the first word of "grep ggrep" to use in msg output
-if test -z "$GREP"; then
-set dummy grep ggrep; ac_prog_name=$2
-if test "${ac_cv_path_GREP+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
+$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
+if ${ac_cv_path_GREP+:} false; then :
+ $as_echo_n "(cached) " >&6
else
+ if test -z "$GREP"; then
ac_path_GREP_found=false
-# Loop through the user's path and test for each of PROGNAME-LIST
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
- for ac_prog in grep ggrep; do
- for ac_exec_ext in '' $ac_executable_extensions; do
- ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
- { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
- # Check for GNU ac_path_GREP and select it if it is found.
+ for ac_prog in grep ggrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
+ as_fn_executable_p "$ac_path_GREP" || continue
+# Check for GNU ac_path_GREP and select it if it is found.
# Check for GNU $ac_path_GREP
case `"$ac_path_GREP" --version 2>&1` in
*GNU*)
ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
*)
ac_count=0
- echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
+ $as_echo_n 0123456789 >"conftest.in"
while :
do
cat "conftest.in" "conftest.in" >"conftest.tmp"
mv "conftest.tmp" "conftest.in"
cp "conftest.in" "conftest.nl"
- echo 'GREP' >> "conftest.nl"
+ $as_echo 'GREP' >> "conftest.nl"
"$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
- ac_count=`expr $ac_count + 1`
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
if test $ac_count -gt ${ac_path_GREP_max-0}; then
# Best one so far, save it but keep looking for a better one
ac_cv_path_GREP="$ac_path_GREP"
@@ -4429,77 +4541,61 @@ case `"$ac_path_GREP" --version 2>&1` in
rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
esac
-
- $ac_path_GREP_found && break 3
+ $ac_path_GREP_found && break 3
+ done
+ done
done
-done
-
-done
IFS=$as_save_IFS
-
-
-fi
-
-GREP="$ac_cv_path_GREP"
-if test -z "$GREP"; then
- { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
-echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
- { (exit 1); exit 1; }; }
-fi
-
+ if test -z "$ac_cv_path_GREP"; then
+ as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+ fi
else
ac_cv_path_GREP=$GREP
fi
-
fi
-{ echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5
-echo "${ECHO_T}$ac_cv_path_GREP" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
+$as_echo "$ac_cv_path_GREP" >&6; }
GREP="$ac_cv_path_GREP"
-{ echo "$as_me:$LINENO: checking for egrep" >&5
-echo $ECHO_N "checking for egrep... $ECHO_C" >&6; }
-if test "${ac_cv_path_EGREP+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
+$as_echo_n "checking for egrep... " >&6; }
+if ${ac_cv_path_EGREP+:} false; then :
+ $as_echo_n "(cached) " >&6
else
if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
then ac_cv_path_EGREP="$GREP -E"
else
- # Extract the first word of "egrep" to use in msg output
-if test -z "$EGREP"; then
-set dummy egrep; ac_prog_name=$2
-if test "${ac_cv_path_EGREP+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+ if test -z "$EGREP"; then
ac_path_EGREP_found=false
-# Loop through the user's path and test for each of PROGNAME-LIST
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
- for ac_prog in egrep; do
- for ac_exec_ext in '' $ac_executable_extensions; do
- ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
- { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
- # Check for GNU ac_path_EGREP and select it if it is found.
+ for ac_prog in egrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
+ as_fn_executable_p "$ac_path_EGREP" || continue
+# Check for GNU ac_path_EGREP and select it if it is found.
# Check for GNU $ac_path_EGREP
case `"$ac_path_EGREP" --version 2>&1` in
*GNU*)
ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
*)
ac_count=0
- echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
+ $as_echo_n 0123456789 >"conftest.in"
while :
do
cat "conftest.in" "conftest.in" >"conftest.tmp"
mv "conftest.tmp" "conftest.in"
cp "conftest.in" "conftest.nl"
- echo 'EGREP' >> "conftest.nl"
+ $as_echo 'EGREP' >> "conftest.nl"
"$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
- ac_count=`expr $ac_count + 1`
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
if test $ac_count -gt ${ac_path_EGREP_max-0}; then
# Best one so far, save it but keep looking for a better one
ac_cv_path_EGREP="$ac_path_EGREP"
@@ -4511,46 +4607,31 @@ case `"$ac_path_EGREP" --version 2>&1` in
rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
esac
-
- $ac_path_EGREP_found && break 3
+ $ac_path_EGREP_found && break 3
+ done
+ done
done
-done
-
-done
IFS=$as_save_IFS
-
-
-fi
-
-EGREP="$ac_cv_path_EGREP"
-if test -z "$EGREP"; then
- { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
-echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
- { (exit 1); exit 1; }; }
-fi
-
+ if test -z "$ac_cv_path_EGREP"; then
+ as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+ fi
else
ac_cv_path_EGREP=$EGREP
fi
-
fi
fi
-{ echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5
-echo "${ECHO_T}$ac_cv_path_EGREP" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
+$as_echo "$ac_cv_path_EGREP" >&6; }
EGREP="$ac_cv_path_EGREP"
-{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5
-echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; }
-if test "${ac_cv_header_stdc+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
+$as_echo_n "checking for ANSI C header files... " >&6; }
+if ${ac_cv_header_stdc+:} false; then :
+ $as_echo_n "(cached) " >&6
else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <stdlib.h>
#include <stdarg.h>
@@ -4565,85 +4646,53 @@ main ()
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
+if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_header_stdc=yes
else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_header_stdc=no
+ ac_cv_header_stdc=no
fi
-
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
if test $ac_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <string.h>
_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- $EGREP "memchr" >/dev/null 2>&1; then
- :
+ $EGREP "memchr" >/dev/null 2>&1; then :
+
else
ac_cv_header_stdc=no
fi
-rm -f -r conftest*
+rm -f conftest*
fi
if test $ac_cv_header_stdc = yes; then
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <stdlib.h>
_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- $EGREP "free" >/dev/null 2>&1; then
- :
+ $EGREP "free" >/dev/null 2>&1; then :
+
else
ac_cv_header_stdc=no
fi
-rm -f -r conftest*
+rm -f conftest*
fi
if test $ac_cv_header_stdc = yes; then
# /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
- if test "$cross_compiling" = yes; then
+ if test "$cross_compiling" = yes; then :
:
else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <ctype.h>
#include <stdlib.h>
@@ -4670,266 +4719,197 @@ main ()
return 0;
}
_ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
- { (case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_try") 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- :
-else
- echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+if ac_fn_c_try_run "$LINENO"; then :
-( exit $ac_status )
-ac_cv_header_stdc=no
+else
+ ac_cv_header_stdc=no
fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
-
fi
fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
-echo "${ECHO_T}$ac_cv_header_stdc" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
+$as_echo "$ac_cv_header_stdc" >&6; }
if test $ac_cv_header_stdc = yes; then
-cat >>confdefs.h <<\_ACEOF
-#define STDC_HEADERS 1
-_ACEOF
+$as_echo "#define STDC_HEADERS 1" >>confdefs.h
fi
# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+ inttypes.h stdint.h unistd.h
+do :
+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
+"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+fi
+done
+ac_fn_c_check_header_mongrel "$LINENO" "openssl/opensslv.h" "ac_cv_header_openssl_opensslv_h" "$ac_includes_default"
+if test "x$ac_cv_header_openssl_opensslv_h" = xyes; then :
+else
+ as_fn_error $? "We require OpenSSL; try --with-openssl" "$LINENO" 5
+fi
-for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
- inttypes.h stdint.h unistd.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-{ echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
+# Check whether --with-gssapi was given.
+if test "${with_gssapi+set}" = set; then :
+ withval=$with_gssapi;
+ if test "$withval" = "yes"; then
+ as_fn_error $? "--with-gssapi requires a path" "$LINENO" 5
+ else
+ gssapi_prefix=$withval/
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- eval "$as_ac_Header=yes"
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+ if test "x$gssapi_prefix" != "x" -a ! -d "$gssapi_prefix"; then
+ as_fn_error $? "'--with-gssapi requires a path to a directory'" "$LINENO" 5
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for krb5-config" >&5
+$as_echo_n "checking for krb5-config... " >&6; }
+ if test -x "$gssapi_prefix/bin/krb5-config"; then
+ krb5conf=$gssapi_prefix/bin/krb5-config
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $krb5conf" >&5
+$as_echo "$krb5conf" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gssapi support in krb5-config" >&5
+$as_echo_n "checking for gssapi support in krb5-config... " >&6; }
+ if "$krb5conf" | grep gssapi > /dev/null; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ GSSAPI_confopts=gssapi
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ GSSAPI_confopts=
+ fi
+ GSSAPI_cflags=`"$krb5conf" --cflags $GSSAPI_confopts`
+ GSSAPI_libs=`"$krb5conf" --libs $GSSAPI_confopts`
+ if test -z "$GSSAPI_confopts"; then
+ case "${host_os}" in
+ solaris*)
+ GSSAPI_cflags="$GSSAPI_cflags -I/usr/include/gssapi"
+ GSSAPI_libs="$GSSAPI_libs -lgss"
+ ;;
+ esac
+ fi
- eval "$as_ac_Header=no"
-fi
+ if test "x$CFLAGS" = "x"; then
+ test "x$silent" != "xyes" && echo " setting CFLAGS to \""$GSSAPI_cflags"\""
+ CFLAGS=""$GSSAPI_cflags""
+ else
+ apr_addto_bugger=""$GSSAPI_cflags""
+ for i in $apr_addto_bugger; do
+ apr_addto_duplicate="0"
+ for j in $CFLAGS; do
+ if test "x$i" = "x$j"; then
+ apr_addto_duplicate="1"
+ break
+ fi
+ done
+ if test $apr_addto_duplicate = "0"; then
+ test "x$silent" != "xyes" && echo " adding \"$i\" to CFLAGS"
+ CFLAGS="$CFLAGS $i"
+ fi
+ done
+ fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
- { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-fi
+ if test "x$CFLAGS" = "x"; then
+ test "x$silent" != "xyes" && echo " setting CFLAGS to \"-DSERF_HAVE_GSSAPI\""
+ CFLAGS="-DSERF_HAVE_GSSAPI"
+ else
+ apr_addto_bugger="-DSERF_HAVE_GSSAPI"
+ for i in $apr_addto_bugger; do
+ apr_addto_duplicate="0"
+ for j in $CFLAGS; do
+ if test "x$i" = "x$j"; then
+ apr_addto_duplicate="1"
+ break
+ fi
+ done
+ if test $apr_addto_duplicate = "0"; then
+ test "x$silent" != "xyes" && echo " adding \"$i\" to CFLAGS"
+ CFLAGS="$CFLAGS $i"
+ fi
+ done
+ fi
-done
+ if test "x$LDFLAGS" = "x"; then
+ test "x$silent" != "xyes" && echo " setting LDFLAGS to \""$GSSAPI_libs"\""
+ LDFLAGS=""$GSSAPI_libs""
+ else
+ apr_addto_bugger=""$GSSAPI_libs""
+ for i in $apr_addto_bugger; do
+ apr_addto_duplicate="0"
+ for j in $LDFLAGS; do
+ if test "x$i" = "x$j"; then
+ apr_addto_duplicate="1"
+ break
+ fi
+ done
+ if test $apr_addto_duplicate = "0"; then
+ test "x$silent" != "xyes" && echo " adding \"$i\" to LDFLAGS"
+ LDFLAGS="$LDFLAGS $i"
+ fi
+ done
+ fi
-if test "${ac_cv_header_openssl_opensslv_h+set}" = set; then
- { echo "$as_me:$LINENO: checking for openssl/opensslv.h" >&5
-echo $ECHO_N "checking for openssl/opensslv.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_openssl_opensslv_h+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_openssl_opensslv_h" >&5
-echo "${ECHO_T}$ac_cv_header_openssl_opensslv_h" >&6; }
-else
- # Is the header compilable?
-{ echo "$as_me:$LINENO: checking openssl/opensslv.h usability" >&5
-echo $ECHO_N "checking openssl/opensslv.h usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gssapi works" >&5
+$as_echo_n "checking if gssapi works... " >&6; }
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-$ac_includes_default
-#include <openssl/opensslv.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_header_compiler=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-# Is the header present?
-{ echo "$as_me:$LINENO: checking openssl/opensslv.h presence" >&5
-echo $ECHO_N "checking openssl/opensslv.h presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <openssl/opensslv.h>
+#include <gssapi.h>
+int main()
+{gss_init_sec_context(NULL, NULL, NULL, NULL, NULL, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL);}
_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.err
- }; then
- ac_header_preproc=yes
+if ac_fn_c_try_link "$LINENO"; then :
+ lib_gssapi="yes"
else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { echo "$as_me:$LINENO: WARNING: openssl/opensslv.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: openssl/opensslv.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: openssl/opensslv.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: openssl/opensslv.h: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { echo "$as_me:$LINENO: WARNING: openssl/opensslv.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: openssl/opensslv.h: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: openssl/opensslv.h: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: openssl/opensslv.h: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: openssl/opensslv.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: openssl/opensslv.h: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: openssl/opensslv.h: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: openssl/opensslv.h: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: openssl/opensslv.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: openssl/opensslv.h: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: openssl/opensslv.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: openssl/opensslv.h: in the future, the compiler will take precedence" >&2;}
+ lib_gssapi="no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ if test "$lib_gssapi" = "yes"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ as_fn_error $? "cannot find GSSAPI (Kerberos)" "$LINENO" 5
+ fi
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: --with-gssapi specified but krb5-config not found" >&5
+$as_echo "$as_me: WARNING: --with-gssapi specified but krb5-config not found" >&2;}
+ fi
- ;;
-esac
-{ echo "$as_me:$LINENO: checking for openssl/opensslv.h" >&5
-echo $ECHO_N "checking for openssl/opensslv.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_openssl_opensslv_h+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_cv_header_openssl_opensslv_h=$ac_header_preproc
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_openssl_opensslv_h" >&5
-echo "${ECHO_T}$ac_cv_header_openssl_opensslv_h" >&6; }
+ fi
fi
-if test $ac_cv_header_openssl_opensslv_h = yes; then
- :
-else
- { { echo "$as_me:$LINENO: error: We require OpenSSL; try --with-openssl" >&5
-echo "$as_me: error: We require OpenSSL; try --with-openssl" >&2;}
- { (exit 1); exit 1; }; }
-fi
-{ echo "$as_me:$LINENO: checking for library containing fabs" >&5
-echo $ECHO_N "checking for library containing fabs... $ECHO_C" >&6; }
-if test "${ac_cv_search_fabs+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing fabs" >&5
+$as_echo_n "checking for library containing fabs... " >&6; }
+if ${ac_cv_search_fabs+:} false; then :
+ $as_echo_n "(cached) " >&6
else
ac_func_search_save_LIBS=$LIBS
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
@@ -4954,50 +4934,27 @@ for ac_lib in '' m; do
ac_res=-l$ac_lib
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
fi
- rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext &&
- $as_test_x conftest$ac_exeext; then
+ if ac_fn_c_try_link "$LINENO"; then :
ac_cv_search_fabs=$ac_res
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext
- if test "${ac_cv_search_fabs+set}" = set; then
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext
+ if ${ac_cv_search_fabs+:} false; then :
break
fi
done
-if test "${ac_cv_search_fabs+set}" = set; then
- :
+if ${ac_cv_search_fabs+:} false; then :
+
else
ac_cv_search_fabs=no
fi
rm conftest.$ac_ext
LIBS=$ac_func_search_save_LIBS
fi
-{ echo "$as_me:$LINENO: result: $ac_cv_search_fabs" >&5
-echo "${ECHO_T}$ac_cv_search_fabs" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_fabs" >&5
+$as_echo "$ac_cv_search_fabs" >&6; }
ac_res=$ac_cv_search_fabs
-if test "$ac_res" != no; then
+if test "$ac_res" != no; then :
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
fi
@@ -5219,12 +5176,13 @@ _ACEOF
case $ac_val in #(
*${as_nl}*)
case $ac_var in #(
- *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
-echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
+ *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
esac
case $ac_var in #(
_ | IFS | as_nl) ;; #(
- *) $as_unset $ac_var ;;
+ BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+ *) { eval $ac_var=; unset $ac_var;} ;;
esac ;;
esac
done
@@ -5232,8 +5190,8 @@ echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
(set) 2>&1 |
case $as_nl`(ac_space=' '; set) 2>&1` in #(
*${as_nl}ac_space=\ *)
- # `set' does not quote correctly, so add quotes (double-quote
- # substitution turns \\\\ into \\, and sed turns \\ into \).
+ # `set' does not quote correctly, so add quotes: double-quote
+ # substitution turns \\\\ into \\, and sed turns \\ into \.
sed -n \
"s/'/'\\\\''/g;
s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
@@ -5255,13 +5213,24 @@ echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
:end' >>confcache
if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
if test -w "$cache_file"; then
- test "x$cache_file" != "x/dev/null" &&
- { echo "$as_me:$LINENO: updating cache $cache_file" >&5
-echo "$as_me: updating cache $cache_file" >&6;}
- cat confcache >$cache_file
+ if test "x$cache_file" != "x/dev/null"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
+$as_echo "$as_me: updating cache $cache_file" >&6;}
+ if test ! -f "$cache_file" || test -h "$cache_file"; then
+ cat confcache >"$cache_file"
+ else
+ case $cache_file in #(
+ */* | ?:*)
+ mv -f confcache "$cache_file"$$ &&
+ mv -f "$cache_file"$$ "$cache_file" ;; #(
+ *)
+ mv -f confcache "$cache_file" ;;
+ esac
+ fi
+ fi
else
- { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5
-echo "$as_me: not updating unwritable cache $cache_file" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
+$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
fi
fi
rm -f confcache
@@ -5278,6 +5247,12 @@ test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
# take arguments), then branch to the quote section. Otherwise,
# look for a macro that doesn't take arguments.
ac_script='
+:mline
+/\\$/{
+ N
+ s,\\\n,,
+ b mline
+}
t clear
:clear
s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g
@@ -5304,14 +5279,15 @@ DEFS=`sed -n "$ac_script" confdefs.h`
ac_libobjs=
ac_ltlibobjs=
+U=
for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
# 1. Remove the extension, and $U if already installed.
ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
- ac_i=`echo "$ac_i" | sed "$ac_script"`
+ ac_i=`$as_echo "$ac_i" | sed "$ac_script"`
# 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR
# will be set to the directory where LIBOBJS objects are built.
- ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext"
- ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo'
+ as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext"
+ as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo'
done
LIBOBJS=$ac_libobjs
@@ -5319,12 +5295,14 @@ LTLIBOBJS=$ac_ltlibobjs
-: ${CONFIG_STATUS=./config.status}
+: "${CONFIG_STATUS=./config.status}"
+ac_write_fail=0
ac_clean_files_save=$ac_clean_files
ac_clean_files="$ac_clean_files $CONFIG_STATUS"
-{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
-echo "$as_me: creating $CONFIG_STATUS" >&6;}
-cat >$CONFIG_STATUS <<_ACEOF
+{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5
+$as_echo "$as_me: creating $CONFIG_STATUS" >&6;}
+as_write_fail=0
+cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1
#! $SHELL
# Generated by $as_me.
# Run this file to recreate the current configuration.
@@ -5334,59 +5312,79 @@ cat >$CONFIG_STATUS <<_ACEOF
debug=false
ac_cs_recheck=false
ac_cs_silent=false
-SHELL=\${CONFIG_SHELL-$SHELL}
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
-## --------------------- ##
-## M4sh Initialization. ##
-## --------------------- ##
+SHELL=\${CONFIG_SHELL-$SHELL}
+export SHELL
+_ASEOF
+cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
# Be more Bourne compatible
DUALCASE=1; export DUALCASE # for MKS sh
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
emulate sh
NULLCMD=:
- # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
# is contrary to our usage. Disable this feature.
alias -g '${1+"$@"}'='"$@"'
setopt NO_GLOB_SUBST
else
- case `(set -o) 2>/dev/null` in
- *posix*) set -o posix ;;
+ case `(set -o) 2>/dev/null` in #(
+ *posix*) :
+ set -o posix ;; #(
+ *) :
+ ;;
esac
-
fi
-
-
-# PATH needs CR
-# Avoid depending upon Character Ranges.
-as_cr_letters='abcdefghijklmnopqrstuvwxyz'
-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-as_cr_Letters=$as_cr_letters$as_cr_LETTERS
-as_cr_digits='0123456789'
-as_cr_alnum=$as_cr_Letters$as_cr_digits
-
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
- echo "#! /bin/sh" >conf$$.sh
- echo "exit 0" >>conf$$.sh
- chmod +x conf$$.sh
- if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
- PATH_SEPARATOR=';'
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='print -r --'
+ as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='printf %s\n'
+ as_echo_n='printf %s'
+else
+ if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+ as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+ as_echo_n='/usr/ucb/echo -n'
else
- PATH_SEPARATOR=:
+ as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+ as_echo_n_body='eval
+ arg=$1;
+ case $arg in #(
+ *"$as_nl"*)
+ expr "X$arg" : "X\\(.*\\)$as_nl";
+ arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+ esac;
+ expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+ '
+ export as_echo_n_body
+ as_echo_n='sh -c $as_echo_n_body as_echo'
fi
- rm -f conf$$.sh
+ export as_echo_body
+ as_echo='sh -c $as_echo_body as_echo'
fi
-# Support unset when possible.
-if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
- as_unset=unset
-else
- as_unset=false
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ PATH_SEPARATOR=:
+ (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+ (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+ PATH_SEPARATOR=';'
+ }
fi
@@ -5395,20 +5393,19 @@ fi
# there to prevent editors from complaining about space-tab.
# (If _AS_PATH_WALK were called with IFS unset, it would disable word
# splitting by setting IFS to empty value.)
-as_nl='
-'
IFS=" "" $as_nl"
# Find who we are. Look in the path if we contain no directory separator.
-case $0 in
+as_myself=
+case $0 in #((
*[\\/]* ) as_myself=$0 ;;
*) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
- test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-done
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+ done
IFS=$as_save_IFS
;;
@@ -5419,32 +5416,111 @@ if test "x$as_myself" = x; then
as_myself=$0
fi
if test ! -f "$as_myself"; then
- echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
- { (exit 1); exit 1; }
+ $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ exit 1
fi
-# Work around bugs in pre-3.0 UWIN ksh.
-for as_var in ENV MAIL MAILPATH
-do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there. '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
done
PS1='$ '
PS2='> '
PS4='+ '
# NLS nuisances.
-for as_var in \
- LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
- LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
- LC_TELEPHONE LC_TIME
-do
- if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
- eval $as_var=C; export $as_var
- else
- ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# CDPATH.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with STATUS, using 1 if that was 0.
+as_fn_error ()
+{
+ as_status=$1; test $as_status -eq 0 && as_status=1
+ if test "$4"; then
+ as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
fi
-done
+ $as_echo "$as_me: error: $2" >&2
+ as_fn_exit $as_status
+} # as_fn_error
+
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+ return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+ set +e
+ as_fn_set_status $1
+ exit $1
+} # as_fn_exit
+
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+ { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+ eval 'as_fn_append ()
+ {
+ eval $1+=\$2
+ }'
+else
+ as_fn_append ()
+ {
+ eval $1=\$$1\$2
+ }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+ eval 'as_fn_arith ()
+ {
+ as_val=$(( $* ))
+ }'
+else
+ as_fn_arith ()
+ {
+ as_val=`expr "$@" || test $? -eq 1`
+ }
+fi # as_fn_arith
+
-# Required to use basename.
if expr a : '\(a\)' >/dev/null 2>&1 &&
test "X`expr 00001 : '.*\(...\)'`" = X001; then
as_expr=expr
@@ -5458,13 +5534,17 @@ else
as_basename=false
fi
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
-# Name of the executable.
as_me=`$as_basename -- "$0" ||
$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
X"$0" : 'X\(//\)$' \| \
X"$0" : 'X\(/\)' \| . 2>/dev/null ||
-echo X/"$0" |
+$as_echo X/"$0" |
sed '/^.*\/\([^/][^/]*\)\/*$/{
s//\1/
q
@@ -5479,131 +5559,118 @@ echo X/"$0" |
}
s/.*/./; q'`
-# CDPATH.
-$as_unset CDPATH
-
-
-
- as_lineno_1=$LINENO
- as_lineno_2=$LINENO
- test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
-
- # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
- # uniformly replaced by the line number. The first 'sed' inserts a
- # line-number line after each line using $LINENO; the second 'sed'
- # does the real work. The second script uses 'N' to pair each
- # line-number line with the line containing $LINENO, and appends
- # trailing '-' during substitution so that $LINENO is not a special
- # case at line end.
- # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
- # scripts with optimization help from Paolo Bonzini. Blame Lee
- # E. McMahon (1931-1989) for sed's syntax. :-)
- sed -n '
- p
- /[$]LINENO/=
- ' <$as_myself |
- sed '
- s/[$]LINENO.*/&-/
- t lineno
- b
- :lineno
- N
- :loop
- s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
- t loop
- s/-\n.*//
- ' >$as_me.lineno &&
- chmod +x "$as_me.lineno" ||
- { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
- { (exit 1); exit 1; }; }
-
- # Don't try to exec as it changes $[0], causing all sort of problems
- # (the dirname of $[0] is not the place where we might find the
- # original and so on. Autoconf is especially sensitive to this).
- . "./$as_me.lineno"
- # Exit status is that of the last command.
- exit
-}
-
-
-if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
- as_dirname=dirname
-else
- as_dirname=false
-fi
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
ECHO_C= ECHO_N= ECHO_T=
-case `echo -n x` in
+case `echo -n x` in #(((((
-n*)
- case `echo 'x\c'` in
+ case `echo 'xy\c'` in
*c*) ECHO_T=' ';; # ECHO_T is single tab character.
- *) ECHO_C='\c';;
+ xy) ECHO_C='\c';;
+ *) echo `echo ksh88 bug on AIX 6.1` > /dev/null
+ ECHO_T=' ';;
esac;;
*)
ECHO_N='-n';;
esac
-if expr a : '\(a\)' >/dev/null 2>&1 &&
- test "X`expr 00001 : '.*\(...\)'`" = X001; then
- as_expr=expr
-else
- as_expr=false
-fi
-
rm -f conf$$ conf$$.exe conf$$.file
if test -d conf$$.dir; then
rm -f conf$$.dir/conf$$.file
else
rm -f conf$$.dir
- mkdir conf$$.dir
-fi
-echo >conf$$.file
-if ln -s conf$$.file conf$$ 2>/dev/null; then
- as_ln_s='ln -s'
- # ... but there are two gotchas:
- # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
- # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
- # In both cases, we have to default to `cp -p'.
- ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
- as_ln_s='cp -p'
-elif ln conf$$.file conf$$ 2>/dev/null; then
- as_ln_s=ln
+ mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+ if ln -s conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+ # In both cases, we have to default to `cp -pR'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ as_ln_s='cp -pR'
+ elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+ else
+ as_ln_s='cp -pR'
+ fi
else
- as_ln_s='cp -p'
+ as_ln_s='cp -pR'
fi
rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
rmdir conf$$.dir 2>/dev/null
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+ case $as_dir in #(
+ -*) as_dir=./$as_dir;;
+ esac
+ test -d "$as_dir" || eval $as_mkdir_p || {
+ as_dirs=
+ while :; do
+ case $as_dir in #(
+ *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+ *) as_qdir=$as_dir;;
+ esac
+ as_dirs="'$as_qdir' $as_dirs"
+ as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ test -d "$as_dir" && break
+ done
+ test -z "$as_dirs" || eval "mkdir $as_dirs"
+ } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
if mkdir -p . 2>/dev/null; then
- as_mkdir_p=:
+ as_mkdir_p='mkdir -p "$as_dir"'
else
test -d ./-p && rmdir ./-p
as_mkdir_p=false
fi
-if test -x / >/dev/null 2>&1; then
- as_test_x='test -x'
-else
- if ls -dL / >/dev/null 2>&1; then
- as_ls_L_option=L
- else
- as_ls_L_option=
- fi
- as_test_x='
- eval sh -c '\''
- if test -d "$1"; then
- test -d "$1/.";
- else
- case $1 in
- -*)set "./$1";;
- esac;
- case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
- ???[sx]*):;;*)false;;esac;fi
- '\'' sh
- '
-fi
-as_executable_p=$as_test_x
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+ test -f "$1" && test -x "$1"
+} # as_fn_executable_p
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
# Sed expression to map a string onto a valid CPP name.
as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
@@ -5613,13 +5680,19 @@ as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
exec 6>&1
+## ----------------------------------- ##
+## Main body of $CONFIG_STATUS script. ##
+## ----------------------------------- ##
+_ASEOF
+test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1
-# Save the log message, to keep $[0] and so on meaningful, and to
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# Save the log message, to keep $0 and so on meaningful, and to
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by $as_me, which was
-generated by GNU Autoconf 2.61. Invocation command line was
+generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
CONFIG_HEADERS = $CONFIG_HEADERS
@@ -5632,27 +5705,36 @@ on `(hostname || uname -n) 2>/dev/null | sed 1q`
_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF
+case $ac_config_files in *"
+"*) set x $ac_config_files; shift; ac_config_files=$*;;
+esac
+
+
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
# Files that config.status was made for.
config_files="$ac_config_files"
config_commands="$ac_config_commands"
_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
ac_cs_usage="\
-\`$as_me' instantiates files from templates according to the
-current configuration.
+\`$as_me' instantiates files and other configuration actions
+from templates according to the current configuration. Unless the files
+and actions are specified as TAGs, all are instantiated by default.
-Usage: $0 [OPTIONS] [FILE]...
+Usage: $0 [OPTION]... [TAG]...
-h, --help print this help, then exit
-V, --version print version number and configuration settings, then exit
- -q, --quiet do not print progress messages
+ --config print configuration, then exit
+ -q, --quiet, --silent
+ do not print progress messages
-d, --debug don't remove temporary files
--recheck update $as_me by reconfiguring in the same conditions
- --file=FILE[:TEMPLATE]
- instantiate the configuration file FILE
+ --file=FILE[:TEMPLATE]
+ instantiate the configuration file FILE
Configuration files:
$config_files
@@ -5660,36 +5742,42 @@ $config_files
Configuration commands:
$config_commands
-Report bugs to <bug-autoconf@gnu.org>."
+Report bugs to the package provider."
_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
config.status
-configured by $0, generated by GNU Autoconf 2.61,
- with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
+configured by $0, generated by GNU Autoconf 2.69,
+ with options \\"\$ac_cs_config\\"
-Copyright (C) 2006 Free Software Foundation, Inc.
+Copyright (C) 2012 Free Software Foundation, Inc.
This config.status script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it."
ac_pwd='$ac_pwd'
srcdir='$srcdir'
INSTALL='$INSTALL'
+test -n "\$AWK" || AWK=awk
_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
-# If no file are specified by the user, then we need to provide default
-# value. By we need to know if files were specified by the user.
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# The default lists apply if the user does not specify any file.
ac_need_defaults=:
while test $# != 0
do
case $1 in
- --*=*)
+ --*=?*)
ac_option=`expr "X$1" : 'X\([^=]*\)='`
ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
ac_shift=:
;;
+ --*=)
+ ac_option=`expr "X$1" : 'X\([^=]*\)='`
+ ac_optarg=
+ ac_shift=:
+ ;;
*)
ac_option=$1
ac_optarg=$2
@@ -5702,25 +5790,30 @@ do
-recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
ac_cs_recheck=: ;;
--version | --versio | --versi | --vers | --ver | --ve | --v | -V )
- echo "$ac_cs_version"; exit ;;
+ $as_echo "$ac_cs_version"; exit ;;
+ --config | --confi | --conf | --con | --co | --c )
+ $as_echo "$ac_cs_config"; exit ;;
--debug | --debu | --deb | --de | --d | -d )
debug=: ;;
--file | --fil | --fi | --f )
$ac_shift
- CONFIG_FILES="$CONFIG_FILES $ac_optarg"
+ case $ac_optarg in
+ *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ '') as_fn_error $? "missing file argument" ;;
+ esac
+ as_fn_append CONFIG_FILES " '$ac_optarg'"
ac_need_defaults=false;;
--he | --h | --help | --hel | -h )
- echo "$ac_cs_usage"; exit ;;
+ $as_echo "$ac_cs_usage"; exit ;;
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil | --si | --s)
ac_cs_silent=: ;;
# This is an error.
- -*) { echo "$as_me: error: unrecognized option: $1
-Try \`$0 --help' for more information." >&2
- { (exit 1); exit 1; }; } ;;
+ -*) as_fn_error $? "unrecognized option: \`$1'
+Try \`$0 --help' for more information." ;;
- *) ac_config_targets="$ac_config_targets $1"
+ *) as_fn_append ac_config_targets " $1"
ac_need_defaults=false ;;
esac
@@ -5735,30 +5828,32 @@ if $ac_cs_silent; then
fi
_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
if \$ac_cs_recheck; then
- echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
- CONFIG_SHELL=$SHELL
+ set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+ shift
+ \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
+ CONFIG_SHELL='$SHELL'
export CONFIG_SHELL
- exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+ exec "\$@"
fi
_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
exec 5>>config.log
{
echo
sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
## Running $as_me. ##
_ASBOX
- echo "$ac_log"
+ $as_echo "$ac_log"
} >&5
_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# Handling of arguments.
for ac_config_target in $ac_config_targets
@@ -5768,9 +5863,7 @@ do
"serf.pc") CONFIG_FILES="$CONFIG_FILES serf.pc" ;;
"mkdir-vpath") CONFIG_COMMANDS="$CONFIG_COMMANDS mkdir-vpath" ;;
- *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
-echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
- { (exit 1); exit 1; }; };;
+ *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
esac
done
@@ -5792,197 +5885,194 @@ fi
# after its creation but before its name has been assigned to `$tmp'.
$debug ||
{
- tmp=
+ tmp= ac_tmp=
trap 'exit_status=$?
- { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
+ : "${ac_tmp:=$tmp}"
+ { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status
' 0
- trap '{ (exit 1); exit 1; }' 1 2 13 15
+ trap 'as_fn_exit 1' 1 2 13 15
}
# Create a (secure) tmp directory for tmp files.
{
tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
- test -n "$tmp" && test -d "$tmp"
+ test -d "$tmp"
} ||
{
tmp=./conf$$-$RANDOM
(umask 077 && mkdir "$tmp")
-} ||
-{
- echo "$me: cannot create a temporary directory in ." >&2
- { (exit 1); exit 1; }
-}
-
-#
-# Set up the sed scripts for CONFIG_FILES section.
-#
+} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5
+ac_tmp=$tmp
-# No need to generate the scripts if there are no CONFIG_FILES.
-# This happens for instance when ./config.status config.h
+# Set up the scripts for CONFIG_FILES section.
+# No need to generate them if there are no CONFIG_FILES.
+# This happens for instance with `./config.status config.h'.
if test -n "$CONFIG_FILES"; then
-_ACEOF
+ac_cr=`echo X | tr X '\015'`
+# On cygwin, bash can eat \r inside `` if the user requested igncr.
+# But we know of no other shell where ac_cr would be empty at this
+# point, so we can use a bashism as a fallback.
+if test "x$ac_cr" = x; then
+ eval ac_cr=\$\'\\r\'
+fi
+ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
+if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
+ ac_cs_awk_cr='\\r'
+else
+ ac_cs_awk_cr=$ac_cr
+fi
+
+echo 'BEGIN {' >"$ac_tmp/subs1.awk" &&
+_ACEOF
+{
+ echo "cat >conf$$subs.awk <<_ACEOF" &&
+ echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
+ echo "_ACEOF"
+} >conf$$subs.sh ||
+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'`
ac_delim='%!_!# '
for ac_last_try in false false false false false :; do
- cat >conf$$subs.sed <<_ACEOF
-SHELL!$SHELL$ac_delim
-PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim
-PACKAGE_NAME!$PACKAGE_NAME$ac_delim
-PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim
-PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim
-PACKAGE_STRING!$PACKAGE_STRING$ac_delim
-PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim
-exec_prefix!$exec_prefix$ac_delim
-prefix!$prefix$ac_delim
-program_transform_name!$program_transform_name$ac_delim
-bindir!$bindir$ac_delim
-sbindir!$sbindir$ac_delim
-libexecdir!$libexecdir$ac_delim
-datarootdir!$datarootdir$ac_delim
-datadir!$datadir$ac_delim
-sysconfdir!$sysconfdir$ac_delim
-sharedstatedir!$sharedstatedir$ac_delim
-localstatedir!$localstatedir$ac_delim
-includedir!$includedir$ac_delim
-oldincludedir!$oldincludedir$ac_delim
-docdir!$docdir$ac_delim
-infodir!$infodir$ac_delim
-htmldir!$htmldir$ac_delim
-dvidir!$dvidir$ac_delim
-pdfdir!$pdfdir$ac_delim
-psdir!$psdir$ac_delim
-libdir!$libdir$ac_delim
-localedir!$localedir$ac_delim
-mandir!$mandir$ac_delim
-DEFS!$DEFS$ac_delim
-ECHO_C!$ECHO_C$ac_delim
-ECHO_N!$ECHO_N$ac_delim
-ECHO_T!$ECHO_T$ac_delim
-LIBS!$LIBS$ac_delim
-build_alias!$build_alias$ac_delim
-host_alias!$host_alias$ac_delim
-target_alias!$target_alias$ac_delim
-mkdir_p!$mkdir_p$ac_delim
-build!$build$ac_delim
-build_cpu!$build_cpu$ac_delim
-build_vendor!$build_vendor$ac_delim
-build_os!$build_os$ac_delim
-host!$host$ac_delim
-host_cpu!$host_cpu$ac_delim
-host_vendor!$host_vendor$ac_delim
-host_os!$host_os$ac_delim
-target!$target$ac_delim
-target_cpu!$target_cpu$ac_delim
-target_vendor!$target_vendor$ac_delim
-target_os!$target_os$ac_delim
-LTFLAGS!$LTFLAGS$ac_delim
-APR_LIBTOOL!$APR_LIBTOOL$ac_delim
-APR_BINDIR!$APR_BINDIR$ac_delim
-APR_INCLUDES!$APR_INCLUDES$ac_delim
-APR_VERSION!$APR_VERSION$ac_delim
-APR_CONFIG!$APR_CONFIG$ac_delim
-APU_BINDIR!$APU_BINDIR$ac_delim
-APU_INCLUDES!$APU_INCLUDES$ac_delim
-APU_VERSION!$APU_VERSION$ac_delim
-APU_CONFIG!$APU_CONFIG$ac_delim
-CC!$CC$ac_delim
-CFLAGS!$CFLAGS$ac_delim
-LDFLAGS!$LDFLAGS$ac_delim
-CPPFLAGS!$CPPFLAGS$ac_delim
-ac_ct_CC!$ac_ct_CC$ac_delim
-EXEEXT!$EXEEXT$ac_delim
-OBJEXT!$OBJEXT$ac_delim
-CPP!$CPP$ac_delim
-INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim
-INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim
-INSTALL_DATA!$INSTALL_DATA$ac_delim
-SERF_MAJOR_VERSION!$SERF_MAJOR_VERSION$ac_delim
-SERF_DOTTED_VERSION!$SERF_DOTTED_VERSION$ac_delim
-SERF_BUILD_SRCLIB_DIRS!$SERF_BUILD_SRCLIB_DIRS$ac_delim
-SERF_CLEAN_SRCLIB_DIRS!$SERF_CLEAN_SRCLIB_DIRS$ac_delim
-GREP!$GREP$ac_delim
-EGREP!$EGREP$ac_delim
-SERF_LIBS!$SERF_LIBS$ac_delim
-EXTRA_CPPFLAGS!$EXTRA_CPPFLAGS$ac_delim
-EXTRA_CFLAGS!$EXTRA_CFLAGS$ac_delim
-EXTRA_CXXFLAGS!$EXTRA_CXXFLAGS$ac_delim
-EXTRA_LDFLAGS!$EXTRA_LDFLAGS$ac_delim
-EXTRA_LIBS!$EXTRA_LIBS$ac_delim
-EXTRA_INCLUDES!$EXTRA_INCLUDES$ac_delim
-LIBOBJS!$LIBOBJS$ac_delim
-LTLIBOBJS!$LTLIBOBJS$ac_delim
-_ACEOF
+ . ./conf$$subs.sh ||
+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
- if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 86; then
+ ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
+ if test $ac_delim_n = $ac_delim_num; then
break
elif $ac_last_try; then
- { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
-echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
- { (exit 1); exit 1; }; }
+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
else
ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
fi
done
+rm -f conf$$subs.sh
-ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed`
-if test -n "$ac_eof"; then
- ac_eof=`echo "$ac_eof" | sort -nru | sed 1q`
- ac_eof=`expr $ac_eof + 1`
-fi
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&
+_ACEOF
+sed -n '
+h
+s/^/S["/; s/!.*/"]=/
+p
+g
+s/^[^!]*!//
+:repl
+t repl
+s/'"$ac_delim"'$//
+t delim
+:nl
+h
+s/\(.\{148\}\)..*/\1/
+t more1
+s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
+p
+n
+b repl
+:more1
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t nl
+:delim
+h
+s/\(.\{148\}\)..*/\1/
+t more2
+s/["\\]/\\&/g; s/^/"/; s/$/"/
+p
+b
+:more2
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t delim
+' <conf$$subs.awk | sed '
+/^[^""]/{
+ N
+ s/\n//
+}
+' >>$CONFIG_STATUS || ac_write_fail=1
+rm -f conf$$subs.awk
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+_ACAWK
+cat >>"\$ac_tmp/subs1.awk" <<_ACAWK &&
+ for (key in S) S_is_set[key] = 1
+ FS = ""
+
+}
+{
+ line = $ 0
+ nfields = split(line, field, "@")
+ substed = 0
+ len = length(field[1])
+ for (i = 2; i < nfields; i++) {
+ key = field[i]
+ keylen = length(key)
+ if (S_is_set[key]) {
+ value = S[key]
+ line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3)
+ len += length(value) + length(field[++i])
+ substed = 1
+ } else
+ len += 1 + keylen
+ }
+
+ print line
+}
-cat >>$CONFIG_STATUS <<_ACEOF
-cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof
-/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end
+_ACAWK
_ACEOF
-sed '
-s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g
-s/^/s,@/; s/!/@,|#_!!_#|/
-:n
-t n
-s/'"$ac_delim"'$/,g/; t
-s/$/\\/; p
-N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n
-' >>$CONFIG_STATUS <conf$$subs.sed
-rm -f conf$$subs.sed
-cat >>$CONFIG_STATUS <<_ACEOF
-:end
-s/|#_!!_#|//g
-CEOF$ac_eof
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
+ sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
+else
+ cat
+fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \
+ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5
_ACEOF
-
-# VPATH may cause trouble with some makes, so we remove $(srcdir),
-# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
+# VPATH may cause trouble with some makes, so we remove sole $(srcdir),
+# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and
# trailing colons and then remove the whole line if VPATH becomes empty
# (actually we leave an empty line to preserve line numbers).
if test "x$srcdir" = x.; then
- ac_vpsub='/^[ ]*VPATH[ ]*=/{
-s/:*\$(srcdir):*/:/
-s/:*\${srcdir}:*/:/
-s/:*@srcdir@:*/:/
-s/^\([^=]*=[ ]*\):*/\1/
+ ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{
+h
+s///
+s/^/:/
+s/[ ]*$/:/
+s/:\$(srcdir):/:/g
+s/:\${srcdir}:/:/g
+s/:@srcdir@:/:/g
+s/^:*//
s/:*$//
+x
+s/\(=[ ]*\).*/\1/
+G
+s/\n//
s/^[^=]*=[ ]*$//
}'
fi
-cat >>$CONFIG_STATUS <<\_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
fi # test -n "$CONFIG_FILES"
-for ac_tag in :F $CONFIG_FILES :C $CONFIG_COMMANDS
+eval set X " :F $CONFIG_FILES :C $CONFIG_COMMANDS"
+shift
+for ac_tag
do
case $ac_tag in
:[FHLC]) ac_mode=$ac_tag; continue;;
esac
case $ac_mode$ac_tag in
:[FHL]*:*);;
- :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5
-echo "$as_me: error: Invalid tag $ac_tag." >&2;}
- { (exit 1); exit 1; }; };;
+ :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;;
:[FH]-) ac_tag=-:-;;
:[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
esac
@@ -6001,7 +6091,7 @@ echo "$as_me: error: Invalid tag $ac_tag." >&2;}
for ac_f
do
case $ac_f in
- -) ac_f="$tmp/stdin";;
+ -) ac_f="$ac_tmp/stdin";;
*) # Look for the file first in the build tree, then in the source tree
# (if the path is not absolute). The absolute path cannot be DOS-style,
# because $ac_f cannot contain `:'.
@@ -6010,26 +6100,34 @@ echo "$as_me: error: Invalid tag $ac_tag." >&2;}
[\\/$]*) false;;
*) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
esac ||
- { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5
-echo "$as_me: error: cannot find input file: $ac_f" >&2;}
- { (exit 1); exit 1; }; };;
+ as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;;
esac
- ac_file_inputs="$ac_file_inputs $ac_f"
+ case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
+ as_fn_append ac_file_inputs " '$ac_f'"
done
# Let's still pretend it is `configure' which instantiates (i.e., don't
# use $as_me), people would be surprised to read:
# /* config.h. Generated by config.status. */
- configure_input="Generated from "`IFS=:
- echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure."
+ configure_input='Generated from '`
+ $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g'
+ `' by configure.'
if test x"$ac_file" != x-; then
configure_input="$ac_file. $configure_input"
- { echo "$as_me:$LINENO: creating $ac_file" >&5
-echo "$as_me: creating $ac_file" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5
+$as_echo "$as_me: creating $ac_file" >&6;}
fi
+ # Neutralize special characters interpreted by sed in replacement strings.
+ case $configure_input in #(
+ *\&* | *\|* | *\\* )
+ ac_sed_conf_input=`$as_echo "$configure_input" |
+ sed 's/[\\\\&|]/\\\\&/g'`;; #(
+ *) ac_sed_conf_input=$configure_input;;
+ esac
case $ac_tag in
- *:-:* | *:-) cat >"$tmp/stdin";;
+ *:-:* | *:-) cat >"$ac_tmp/stdin" \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
esac
;;
esac
@@ -6039,42 +6137,7 @@ $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$ac_file" : 'X\(//\)[^/]' \| \
X"$ac_file" : 'X\(//\)$' \| \
X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
-echo X"$ac_file" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
- s//\1/
- q
- }
- /^X\(\/\/\)[^/].*/{
- s//\1/
- q
- }
- /^X\(\/\/\)$/{
- s//\1/
- q
- }
- /^X\(\/\).*/{
- s//\1/
- q
- }
- s/.*/./; q'`
- { as_dir="$ac_dir"
- case $as_dir in #(
- -*) as_dir=./$as_dir;;
- esac
- test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
- as_dirs=
- while :; do
- case $as_dir in #(
- *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #(
- *) as_qdir=$as_dir;;
- esac
- as_dirs="'$as_qdir' $as_dirs"
- as_dir=`$as_dirname -- "$as_dir" ||
-$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$as_dir" : 'X\(//\)[^/]' \| \
- X"$as_dir" : 'X\(//\)$' \| \
- X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
-echo X"$as_dir" |
+$as_echo X"$ac_file" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
@@ -6092,20 +6155,15 @@ echo X"$as_dir" |
q
}
s/.*/./; q'`
- test -d "$as_dir" && break
- done
- test -z "$as_dirs" || eval "mkdir $as_dirs"
- } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
-echo "$as_me: error: cannot create directory $as_dir" >&2;}
- { (exit 1); exit 1; }; }; }
+ as_dir="$ac_dir"; as_fn_mkdir_p
ac_builddir=.
case "$ac_dir" in
.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
*)
- ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+ ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
# A ".." for each directory in $ac_dir_suffix.
- ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'`
+ ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
case $ac_top_builddir_sub in
"") ac_top_builddir_sub=. ac_top_build_prefix= ;;
*) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
@@ -6145,12 +6203,12 @@ ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
esac
_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# If the template does not know about datarootdir, expand it.
# FIXME: This hack should be removed a few years after 2.60.
ac_datarootdir_hack=; ac_datarootdir_seen=
-
-case `sed -n '/datarootdir/ {
+ac_sed_dataroot='
+/datarootdir/ {
p
q
}
@@ -6158,36 +6216,37 @@ case `sed -n '/datarootdir/ {
/@docdir@/p
/@infodir@/p
/@localedir@/p
-/@mandir@/p
-' $ac_file_inputs` in
+/@mandir@/p'
+case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
*datarootdir*) ac_datarootdir_seen=yes;;
*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
- { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
-echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
+$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_datarootdir_hack='
s&@datadir@&$datadir&g
s&@docdir@&$docdir&g
s&@infodir@&$infodir&g
s&@localedir@&$localedir&g
s&@mandir@&$mandir&g
- s&\\\${datarootdir}&$datarootdir&g' ;;
+ s&\\\${datarootdir}&$datarootdir&g' ;;
esac
_ACEOF
# Neutralize VPATH when `$srcdir' = `.'.
# Shell code in configure.ac might set extrasub.
# FIXME: do we really want to maintain this feature?
-cat >>$CONFIG_STATUS <<_ACEOF
- sed "$ac_vpsub
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_sed_extra="$ac_vpsub
$extrasub
_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
:t
/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
-s&@configure_input@&$configure_input&;t t
+s|@configure_input@|$ac_sed_conf_input|;t t
s&@top_builddir@&$ac_top_builddir_sub&;t t
+s&@top_build_prefix@&$ac_top_build_prefix&;t t
s&@srcdir@&$ac_srcdir&;t t
s&@abs_srcdir@&$ac_abs_srcdir&;t t
s&@top_srcdir@&$ac_top_srcdir&;t t
@@ -6197,26 +6256,30 @@ s&@abs_builddir@&$ac_abs_builddir&;t t
s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
s&@INSTALL@&$ac_INSTALL&;t t
$ac_datarootdir_hack
-" $ac_file_inputs | sed -f "$tmp/subs-1.sed" >$tmp/out
+"
+eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \
+ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5
test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
- { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
- { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
- { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir'
-which seems to be undefined. Please make sure it is defined." >&5
-echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
-which seems to be undefined. Please make sure it is defined." >&2;}
-
- rm -f "$tmp/stdin"
+ { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } &&
+ { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \
+ "$ac_tmp/out"`; test -z "$ac_out"; } &&
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined. Please make sure it is defined" >&5
+$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined. Please make sure it is defined" >&2;}
+
+ rm -f "$ac_tmp/stdin"
case $ac_file in
- -) cat "$tmp/out"; rm -f "$tmp/out";;
- *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;;
- esac
+ -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";;
+ *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";;
+ esac \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5
;;
- :C) { echo "$as_me:$LINENO: executing $ac_file commands" >&5
-echo "$as_me: executing $ac_file commands" >&6;}
+ :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5
+$as_echo "$as_me: executing $ac_file commands" >&6;}
;;
esac
@@ -6228,11 +6291,13 @@ echo "$as_me: executing $ac_file commands" >&6;}
done # for ac_tag
-{ (exit 0); exit 0; }
+as_fn_exit 0
_ACEOF
-chmod +x $CONFIG_STATUS
ac_clean_files=$ac_clean_files_save
+test $ac_write_fail = 0 ||
+ as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5
+
# configure is writing to config.log, and then calls config.status.
# config.status does its own redirection, appending to config.log.
@@ -6252,6 +6317,10 @@ if test "$no_create" != yes; then
exec 5>>config.log
# Use ||, not &&, to avoid exiting from the if with $? = 1, which
# would make configure fail if this is the last instruction.
- $ac_cs_success || { (exit 1); exit 1; }
+ $ac_cs_success || as_fn_exit 1
+fi
+if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
+$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
fi
diff --git a/configure.in b/configure.in
index ffd5acd..41fcfc5 100644
--- a/configure.in
+++ b/configure.in
@@ -194,6 +194,64 @@ dnl Look for OpenSSL
AC_CHECK_HEADER([openssl/opensslv.h], [],
[AC_MSG_ERROR([We require OpenSSL; try --with-openssl])])
+dnl Look for Kerberos 5 for GSSAPI
+AC_ARG_WITH(gssapi,
+ APR_HELP_STRING([--with-gssapi=PATH],[build with GSSAPI support; needs krb5-config in PATH/bin (eg. /usr/lib/mit)]),
+[
+ if test "$withval" = "yes"; then
+ AC_MSG_ERROR([--with-gssapi requires a path])
+ else
+ gssapi_prefix=$withval/
+
+ if test "x$gssapi_prefix" != "x" -a ! -d "$gssapi_prefix"; then
+ AC_MSG_ERROR('--with-gssapi requires a path to a directory')
+ fi
+ AC_MSG_CHECKING([for krb5-config])
+ if test -x "$gssapi_prefix/bin/krb5-config"; then
+ krb5conf=$gssapi_prefix/bin/krb5-config
+ AC_MSG_RESULT([$krb5conf])
+ AC_MSG_CHECKING([for gssapi support in krb5-config])
+ if "$krb5conf" | grep gssapi > /dev/null; then
+ AC_MSG_RESULT([yes])
+ GSSAPI_confopts=gssapi
+ else
+ AC_MSG_RESULT([no])
+ GSSAPI_confopts=
+ fi
+ GSSAPI_cflags=`"$krb5conf" --cflags $GSSAPI_confopts`
+ GSSAPI_libs=`"$krb5conf" --libs $GSSAPI_confopts`
+ if test -z "$GSSAPI_confopts"; then
+ case "${host_os}" in
+ solaris*)
+ GSSAPI_cflags="$GSSAPI_cflags -I/usr/include/gssapi"
+ GSSAPI_libs="$GSSAPI_libs -lgss"
+ ;;
+ esac
+ fi
+ APR_ADDTO(CFLAGS, "$GSSAPI_cflags")
+ APR_ADDTO(CFLAGS, [-DSERF_HAVE_GSSAPI])
+ APR_ADDTO(LDFLAGS, "$GSSAPI_libs")
+ AC_MSG_CHECKING([if gssapi works])
+ AC_LINK_IFELSE([AC_LANG_SOURCE([[
+#include <gssapi.h>
+int main()
+{gss_init_sec_context(NULL, NULL, NULL, NULL, NULL, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL);}]])],
+ lib_gssapi="yes", lib_gssapi="no")
+ if test "$lib_gssapi" = "yes"; then
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ AC_MSG_ERROR([cannot find GSSAPI (Kerberos)])
+ fi
+ else
+ AC_MSG_RESULT([no])
+ AC_MSG_WARN([--with-gssapi specified but krb5-config not found])
+ fi
+
+ fi
+])
+
+
dnl CuTest requires libm on Solaris
AC_SEARCH_LIBS(fabs, m)
diff --git a/context.c b/context.c
index d4aa220..81f4826 100644
--- a/context.c
+++ b/context.c
@@ -149,6 +149,12 @@ serf_context_t *serf_context_create_ex(
else {
/* build the pollset with a (default) number of connections */
serf_pollset_t *ps = apr_pcalloc(pool, sizeof(*ps));
+
+ /* ### TODO: As of APR 1.4.x apr_pollset_create_ex can return a status
+ ### other than APR_SUCCESS, so we should handle it.
+ ### Probably move creation of the pollset to later when we have
+ ### the possibility of returning status to the caller.
+ */
#ifdef BROKEN_WSAPOLL
/* APR 1.4.x switched to using WSAPoll() on Win32, but it does not
* properly handle errors on a non-blocking sockets (such as
@@ -283,6 +289,11 @@ apr_status_t serf_context_run(
if ((status = apr_pollset_poll(ps->pollset, duration, &num,
&desc)) != APR_SUCCESS) {
+ /* EINTR indicates a handled signal happened during the poll call,
+ ignore, the application can safely retry. */
+ if (APR_STATUS_IS_EINTR(status))
+ return APR_SUCCESS;
+
/* ### do we still need to dispatch stuff here?
### look at the potential return codes. map to our defined
### return values? ...
@@ -354,6 +365,14 @@ const char *serf_error_string(apr_status_t errcode)
return "An error occurred during decompression";
case SERF_ERROR_BAD_HTTP_RESPONSE:
return "The server sent an improper HTTP response";
+ case SERF_ERROR_TRUNCATED_HTTP_RESPONSE:
+ return "The server sent a truncated HTTP response body.";
+ case SERF_ERROR_ABORTED_CONNECTION:
+ return "The server unexpectedly closed the connection.";
+ case SERF_ERROR_SSL_COMM_FAILED:
+ return "An error occurred during SSL communication";
+ case SERF_ERROR_SSL_CERT_FAILED:
+ return "An SSL certificate related error occurred ";
case SERF_ERROR_AUTHN_FAILED:
return "An error occurred during authentication";
case SERF_ERROR_AUTHN_NOT_SUPPORTED:
@@ -362,7 +381,9 @@ const char *serf_error_string(apr_status_t errcode)
return "An authentication attribute is missing";
case SERF_ERROR_AUTHN_INITALIZATION_FAILED:
return "Initialization of an authentication type failed";
-
+ case SERF_ERROR_SSLTUNNEL_SETUP_FAILED:
+ return "The proxy server returned an error while setting up the "\
+ "SSL tunnel.";
default:
return NULL;
}
diff --git a/outgoing.c b/outgoing.c
index 53fac0a..2c63e96 100644
--- a/outgoing.c
+++ b/outgoing.c
@@ -29,8 +29,10 @@ static apr_status_t clean_skt(void *data)
apr_status_t status = APR_SUCCESS;
if (conn->skt) {
+ serf__log_skt(SOCK_VERBOSE, __FILE__, conn->skt, "cleanup - ");
status = apr_socket_close(conn->skt);
conn->skt = NULL;
+ serf__log_nopref(SOCK_VERBOSE, "closed socket, status %d\n", status);
}
return status;
@@ -71,6 +73,8 @@ static apr_status_t clean_conn(void *data)
{
serf_connection_t *conn = data;
+ serf__log(CONN_VERBOSE, __FILE__, "cleaning up connection 0x%x\n",
+ conn);
serf_connection_close(conn);
return APR_SUCCESS;
@@ -103,15 +107,19 @@ apr_status_t serf__conn_update_pollset(serf_connection_t *conn)
/* Now put it back in with the correct read/write values. */
desc.reqevents = APR_POLLHUP | APR_POLLERR;
- if (conn->requests) {
+ if (conn->requests &&
+ conn->state != SERF_CONN_INIT) {
/* If there are any outstanding events, then we want to read. */
/* ### not true. we only want to read IF we have sent some data */
desc.reqevents |= APR_POLLIN;
- /* If the connection has unwritten data, or there are any requests
- * that still have buckets to write out, then we want to write.
+ /* If the connection is not closing down and
+ * has unwritten data or
+ * there are any requests that still have buckets to write out,
+ * then we want to write.
*/
- if (conn->vec_len)
+ if (conn->vec_len &&
+ conn->state != SERF_CONN_CLOSING)
desc.reqevents |= APR_POLLOUT;
else {
serf_request_t *request = conn->requests;
@@ -180,7 +188,6 @@ apr_status_t serf__open_connections(serf_context_t *ctx)
serf_connection_t *conn = GET_CONN(ctx, i);
apr_status_t status;
apr_socket_t *skt;
- apr_sockaddr_t *serv_addr;
conn->seen_in_pollset = 0;
@@ -199,18 +206,15 @@ apr_status_t serf__open_connections(serf_context_t *ctx)
apr_pool_clear(conn->skt_pool);
apr_pool_cleanup_register(conn->skt_pool, conn, clean_skt, clean_skt);
- /* Do we have to connect to a proxy server? */
- if (ctx->proxy_address)
- serv_addr = ctx->proxy_address;
- else
- serv_addr = conn->address;
-
- if ((status = apr_socket_create(&skt, serv_addr->family,
- SOCK_STREAM,
+ status = apr_socket_create(&skt, conn->address->family,
+ SOCK_STREAM,
#if APR_MAJOR_VERSION > 0
- APR_PROTO_TCP,
+ APR_PROTO_TCP,
#endif
- conn->skt_pool)) != APR_SUCCESS)
+ conn->skt_pool);
+ serf__log(SOCK_VERBOSE, __FILE__,
+ "created socket for conn 0x%x, status %d\n", conn, status);
+ if (status != APR_SUCCESS)
return status;
/* Set the socket to be non-blocking */
@@ -225,11 +229,18 @@ apr_status_t serf__open_connections(serf_context_t *ctx)
/* Configured. Store it into the connection now. */
conn->skt = skt;
+ /* Remember time when we started connecting to server to calculate
+ network latency. */
+ conn->connect_time = apr_time_now();
+
/* Now that the socket is set up, let's connect it. This should
* return immediately.
*/
- if ((status = apr_socket_connect(skt,
- serv_addr)) != APR_SUCCESS) {
+ status = apr_socket_connect(skt, conn->address);
+ serf__log_skt(SOCK_VERBOSE, __FILE__, skt,
+ "connected socket for conn 0x%x, status %d\n",
+ conn, status);
+ if (status != APR_SUCCESS) {
if (!APR_STATUS_IS_EINPROGRESS(status))
return status;
}
@@ -256,6 +267,7 @@ apr_status_t serf__open_connections(serf_context_t *ctx)
serf__ssltunnel_connect(conn);
else
conn->state = SERF_CONN_CONNECTED;
+
}
return APR_SUCCESS;
@@ -266,14 +278,8 @@ static apr_status_t no_more_writes(serf_connection_t *conn,
{
/* Note that we should hold new requests until we open our new socket. */
conn->state = SERF_CONN_CLOSING;
-
- /* We can take the *next* request in our list and assume it hasn't
- * been written yet and 'save' it for the new socket.
- */
- conn->hold_requests = request->next;
- conn->hold_requests_tail = conn->requests_tail;
- request->next = NULL;
- conn->requests_tail = request;
+ serf__log(CONN_VERBOSE, __FILE__, "stop writing on conn 0x%x\n",
+ conn);
/* Clear our iovec. */
conn->vec_len = 0;
@@ -411,27 +417,22 @@ static apr_status_t reset_connection(serf_connection_t *conn,
{
serf_context_t *ctx = conn->ctx;
apr_status_t status;
- serf_request_t *old_reqs, *held_reqs, *held_reqs_tail;
+ serf_request_t *old_reqs;
conn->probable_keepalive_limit = conn->completed_responses;
conn->completed_requests = 0;
conn->completed_responses = 0;
old_reqs = conn->requests;
- held_reqs = conn->hold_requests;
- held_reqs_tail = conn->hold_requests_tail;
-
- if (conn->state == SERF_CONN_CLOSING) {
- conn->hold_requests = NULL;
- conn->hold_requests_tail = NULL;
- }
conn->requests = NULL;
conn->requests_tail = NULL;
+ /* Handle all outstanding requests. These have either not been written yet,
+ or have been written but the expected reply wasn't received yet. */
while (old_reqs) {
/* If we haven't started to write the connection, bring it over
- * unchanged to our new socket. Otherwise, call the cancel function.
+ * unchanged to our new socket.
*/
if (requeue_requests && !old_reqs->written) {
serf_request_t *req = old_reqs;
@@ -440,23 +441,19 @@ static apr_status_t reset_connection(serf_connection_t *conn,
link_requests(&conn->requests, &conn->requests_tail, req);
}
else {
+ /* Request has been consumed, or we don't want to requeue the
+ request. Either way, inform the application that the request
+ is cancelled. */
cancel_request(old_reqs, &old_reqs, requeue_requests);
}
}
- if (conn->requests_tail) {
- conn->requests_tail->next = held_reqs;
- }
- else {
- conn->requests = held_reqs;
- }
- if (held_reqs_tail) {
- conn->requests_tail = held_reqs_tail;
- }
-
+ /* Requests queue has been prepared for a new socket, close the old one. */
if (conn->skt != NULL) {
remove_connection(ctx, conn);
status = apr_socket_close(conn->skt);
+ serf__log_skt(SOCK_VERBOSE, __FILE__, conn->skt,
+ "closed socket, status %d\n", status);
if (conn->closed != NULL) {
handle_conn_closed(conn, status);
}
@@ -477,6 +474,8 @@ static apr_status_t reset_connection(serf_connection_t *conn,
conn->ctx->dirty_pollset = 1;
conn->state = SERF_CONN_INIT;
+ serf__log(CONN_VERBOSE, __FILE__, "reset connection 0x%x\n", conn);
+
conn->status = APR_SUCCESS;
/* Let our context know that we've 'reset' the socket already. */
@@ -493,15 +492,24 @@ static apr_status_t socket_writev(serf_connection_t *conn)
status = apr_socket_sendv(conn->skt, conn->vec,
conn->vec_len, &written);
+ if (status && !APR_STATUS_IS_EAGAIN(status))
+ serf__log_skt(SOCK_VERBOSE, __FILE__, conn->skt,
+ "socket_sendv error %d\n", status);
/* did we write everything? */
if (written) {
apr_size_t len = 0;
int i;
+ serf__log_skt(SOCK_MSG_VERBOSE, __FILE__, conn->skt,
+ "--- socket_sendv:\n");
+
for (i = 0; i < conn->vec_len; i++) {
len += conn->vec[i].iov_len;
if (written < len) {
+ serf__log_nopref(SOCK_MSG_VERBOSE, "%.*s",
+ conn->vec[i].iov_len - (len - written),
+ conn->vec[i].iov_base);
if (i) {
memmove(conn->vec, &conn->vec[i],
sizeof(struct iovec) * (conn->vec_len - i));
@@ -510,11 +518,15 @@ static apr_status_t socket_writev(serf_connection_t *conn)
conn->vec[0].iov_base = (char *)conn->vec[0].iov_base + (conn->vec[0].iov_len - (len - written));
conn->vec[0].iov_len = len - written;
break;
+ } else {
+ serf__log_nopref(SOCK_MSG_VERBOSE, "%.*s",
+ conn->vec[i].iov_len, conn->vec[i].iov_base);
}
}
if (len == written) {
conn->vec_len = 0;
}
+ serf__log_nopref(SOCK_MSG_VERBOSE, "-(%d)-\n", written);
/* Log progress information */
serf__context_progress_delta(conn->ctx, 0, written);
@@ -582,6 +594,10 @@ static apr_status_t prepare_conn_streams(serf_connection_t *conn,
{
apr_status_t status;
+ if (conn->stream == NULL) {
+ conn->latency = apr_time_now() - conn->connect_time;
+ }
+
/* Do we need a SSL tunnel first? */
if (conn->state == SERF_CONN_CONNECTED) {
/* If the connection does not have an associated bucket, then
@@ -667,7 +683,9 @@ static apr_status_t write_to_connection(serf_connection_t *conn)
*/
if (APR_STATUS_IS_EAGAIN(status))
return APR_SUCCESS;
- if (APR_STATUS_IS_EPIPE(status))
+ if (APR_STATUS_IS_EPIPE(status) ||
+ APR_STATUS_IS_ECONNRESET(status) ||
+ APR_STATUS_IS_ECONNABORTED(status))
return no_more_writes(conn, request);
if (status)
return status;
@@ -762,7 +780,8 @@ static apr_status_t write_to_connection(serf_connection_t *conn)
return APR_SUCCESS;
if (APR_STATUS_IS_EPIPE(status))
return no_more_writes(conn, request);
- if (APR_STATUS_IS_ECONNRESET(status)) {
+ if (APR_STATUS_IS_ECONNRESET(status) ||
+ APR_STATUS_IS_ECONNABORTED(status)) {
return no_more_writes(conn, request);
}
if (status)
@@ -929,31 +948,38 @@ static apr_status_t read_from_connection(serf_connection_t *conn)
* 2) Doing the initial SSL handshake - we'll get EAGAIN
* as the SSL buckets will hide the handshake from us
* but not return any data.
+ * 3) When the server sends us an SSL alert.
*
* In these cases, we should not receive any actual user data.
*
- * If we see an EOF (due to an expired timeout), we'll reset the
+ * 4) When the server sends a error response, like 408 Request timeout.
+ * This response should be passed to the application.
+ *
+ * If we see an EOF (due to either an expired timeout or the server
+ * sending the SSL 'close notify' shutdown alert), we'll reset the
* connection and open a new one.
*/
if (request->req_bkt || !request->written) {
const char *data;
apr_size_t len;
- status = serf_bucket_read(conn->stream, SERF_READ_ALL_AVAIL,
- &data, &len);
+ status = serf_bucket_peek(conn->stream, &data, &len);
- if (!status && len) {
- status = APR_EGENERAL;
- }
- else if (APR_STATUS_IS_EOF(status)) {
+ if (APR_STATUS_IS_EOF(status)) {
reset_connection(conn, 1);
status = APR_SUCCESS;
+ goto error;
}
- else if (APR_STATUS_IS_EAGAIN(status)) {
+ else if (APR_STATUS_IS_EAGAIN(status) && !len) {
status = APR_SUCCESS;
+ goto error;
+ } else if (status && !APR_STATUS_IS_EAGAIN(status)) {
+ /* Read error */
+ goto error;
}
- goto error;
+ /* Unexpected response from the server */
+
}
/* If the request doesn't have a response bucket, then call the
@@ -969,12 +995,21 @@ static apr_status_t read_from_connection(serf_connection_t *conn)
status = handle_response(request, tmppool);
/* Some systems will not generate a HUP poll event so we have to
- * handle the ECONNRESET issue here.
+ * handle the ECONNRESET issue and ECONNABORT here.
*/
if (APR_STATUS_IS_ECONNRESET(status) ||
+ APR_STATUS_IS_ECONNABORTED(status) ||
status == SERF_ERROR_REQUEST_LOST) {
- reset_connection(conn, 1);
- status = APR_SUCCESS;
+ /* If the connection had ever been good, be optimistic & try again.
+ * If it has never tried again (incl. a retry), fail.
+ */
+ if (conn->completed_responses) {
+ reset_connection(conn, 1);
+ status = APR_SUCCESS;
+ }
+ else if (status == SERF_ERROR_REQUEST_LOST) {
+ status = SERF_ERROR_ABORTED_CONNECTION;
+ }
goto error;
}
@@ -1001,9 +1036,11 @@ static apr_status_t read_from_connection(serf_connection_t *conn)
goto error;
}
- /* The request has been fully-delivered, and the response has
- * been fully-read. Remove it from our queue and loop to read
- * another response.
+ /* The response has been fully-read, so that means the request has
+ * either been fully-delivered (most likely), or that we don't need to
+ * write the rest of it anymore, e.g. when a 408 Request timeout was
+ $ received.
+ * Remove it from our queue and loop to read another response.
*/
conn->requests = request->next;
@@ -1081,8 +1118,13 @@ apr_status_t serf__process_connection(serf_connection_t *conn,
if ((events & APR_POLLHUP) != 0) {
/* The connection got reset by the server. On Windows this can happen
when all data is read, so just cleanup the connection and open
- a new one. */
- return reset_connection(conn, 1);
+ a new one.
+ If we haven't had any successful responses on this connection,
+ then error out as it is likely a server issue. */
+ if (conn->completed_responses) {
+ return reset_connection(conn, 1);
+ }
+ return SERF_ERROR_ABORTED_CONNECTION;
}
if ((events & APR_POLLERR) != 0) {
/* We might be talking to a buggy HTTP server that doesn't
@@ -1117,7 +1159,8 @@ serf_connection_t *serf_connection_create(
conn->ctx = ctx;
conn->status = APR_SUCCESS;
- conn->address = address;
+ /* Ignore server address if proxy was specified. */
+ conn->address = ctx->proxy_address ? ctx->proxy_address : address;
conn->setup = setup;
conn->setup_baton = setup_baton;
conn->closed = closed;
@@ -1131,6 +1174,7 @@ serf_connection_t *serf_connection_create(
conn->baton.u.conn = conn;
conn->hit_eof = 0;
conn->state = SERF_CONN_INIT;
+ conn->latency = -1; /* unknown */
/* Create a subpool for our connection. */
apr_pool_create(&conn->skt_pool, conn->pool);
@@ -1141,6 +1185,9 @@ serf_connection_t *serf_connection_create(
/* Add the connection to the context. */
*(serf_connection_t **)apr_array_push(ctx->conns) = conn;
+ serf__log(CONN_VERBOSE, __FILE__, "created connection 0x%x\n",
+ conn);
+
return conn;
}
@@ -1154,16 +1201,24 @@ apr_status_t serf_connection_create2(
void *closed_baton,
apr_pool_t *pool)
{
- apr_status_t status;
+ apr_status_t status = APR_SUCCESS;
serf_connection_t *c;
- apr_sockaddr_t *host_address;
+ apr_sockaddr_t *host_address = NULL;
- /* Parse the url, store the address of the server. */
- status = apr_sockaddr_info_get(&host_address,
- host_info.hostname,
- APR_UNSPEC, host_info.port, 0, pool);
- if (status)
- return status;
+ /* Set the port number explicitly, needed to create the socket later. */
+ if (!host_info.port) {
+ host_info.port = apr_uri_port_of_scheme(host_info.scheme);
+ }
+
+ /* Only lookup the address of the server if no proxy server was
+ configured. */
+ if (!ctx->proxy_address) {
+ status = apr_sockaddr_info_get(&host_address,
+ host_info.hostname,
+ APR_UNSPEC, host_info.port, 0, pool);
+ if (status)
+ return status;
+ }
c = serf_connection_create(ctx, host_address, setup, setup_baton,
closed, closed_baton, pool);
@@ -1203,6 +1258,9 @@ apr_status_t serf_connection_close(
if (conn->skt != NULL) {
remove_connection(ctx, conn);
status = apr_socket_close(conn->skt);
+ serf__log_skt(SOCK_VERBOSE, __FILE__, conn->skt,
+ "closed socket, status %d\n",
+ status);
if (conn->closed != NULL) {
handle_conn_closed(conn, status);
}
@@ -1213,6 +1271,8 @@ apr_status_t serf_connection_close(
conn->stream = NULL;
}
+ destroy_ostream(conn);
+
/* Remove the connection from the context. We don't want to
* deal with it any more.
*/
@@ -1225,6 +1285,9 @@ apr_status_t serf_connection_close(
}
--ctx->conns->nelts;
+ serf__log(CONN_VERBOSE, __FILE__, "closed connection 0x%x\n",
+ conn);
+
/* Found the connection. Closed it. All done. */
return APR_SUCCESS;
}
@@ -1240,6 +1303,15 @@ void serf_connection_set_max_outstanding_requests(
serf_connection_t *conn,
unsigned int max_requests)
{
+ if (max_requests == 0)
+ serf__log_skt(CONN_VERBOSE, __FILE__, conn->skt,
+ "Set max. nr. of outstanding requests for this "
+ "connection to unlimited.\n");
+ else
+ serf__log_skt(CONN_VERBOSE, __FILE__, conn->skt,
+ "Limit max. nr. of outstanding requests for this "
+ "connection to %u.\n", max_requests);
+
conn->max_outstanding_requests = max_requests;
}
@@ -1279,16 +1351,11 @@ serf_request_t *serf_connection_request_create(
request->next = NULL;
/* Link the request to the end of the request chain. */
- if (conn->state == SERF_CONN_CLOSING) {
- link_requests(&conn->hold_requests, &conn->hold_requests_tail, request);
- }
- else {
- link_requests(&conn->requests, &conn->requests_tail, request);
-
- /* Ensure our pollset becomes writable in context run */
- conn->ctx->dirty_pollset = 1;
- conn->dirty_conn = 1;
- }
+ link_requests(&conn->requests, &conn->requests_tail, request);
+
+ /* Ensure our pollset becomes writable in context run */
+ conn->ctx->dirty_pollset = 1;
+ conn->dirty_conn = 1;
return request;
}
@@ -1314,14 +1381,8 @@ serf_request_t *serf_connection_priority_request_create(
request->written = 0;
request->next = NULL;
- /* Link the new request after the last written request, but before all
- upcoming requests. */
- if (conn->state == SERF_CONN_CLOSING) {
- iter = conn->hold_requests;
- }
- else {
- iter = conn->requests;
- }
+ /* Link the new request after the last written request. */
+ iter = conn->requests;
prev = NULL;
/* Find a request that has data which needs to be delivered. */
@@ -1341,19 +1402,12 @@ serf_request_t *serf_connection_priority_request_create(
prev->next = request;
} else {
request->next = iter;
- if (conn->state == SERF_CONN_CLOSING) {
- conn->hold_requests = request;
- }
- else {
- conn->requests = request;
- }
+ conn->requests = request;
}
- if (conn->state != SERF_CONN_CLOSING) {
- /* Ensure our pollset becomes writable in context run */
- conn->ctx->dirty_pollset = 1;
- conn->dirty_conn = 1;
- }
+ /* Ensure our pollset becomes writable in context run */
+ conn->ctx->dirty_pollset = 1;
+ conn->dirty_conn = 1;
return request;
}
@@ -1364,6 +1418,13 @@ apr_status_t serf_request_cancel(serf_request_t *request)
return cancel_request(request, &request->conn->requests, 0);
}
+apr_status_t serf_request_is_written(serf_request_t *request)
+{
+ if (request->written && !request->req_bkt)
+ return APR_SUCCESS;
+
+ return APR_EBUSY;
+}
apr_pool_t *serf_request_get_pool(const serf_request_t *request)
{
@@ -1419,13 +1480,26 @@ serf_bucket_t *serf_request_bucket_request_create(
/* Setup server authorization headers */
if (ctx->authn_info.scheme)
- ctx->authn_info.scheme->setup_request_func(401, conn, method, uri,
+ ctx->authn_info.scheme->setup_request_func(HOST, 0, conn, request,
+ method, uri,
hdrs_bkt);
/* Setup proxy authorization headers */
if (ctx->proxy_authn_info.scheme)
- ctx->proxy_authn_info.scheme->setup_request_func(407, conn, method,
- uri, hdrs_bkt);
+ ctx->proxy_authn_info.scheme->setup_request_func(PROXY, 0, conn,
+ request,
+ method, uri, hdrs_bkt);
return req_bkt;
}
+
+apr_interval_time_t serf_connection_get_latency(serf_connection_t *conn)
+{
+ if (conn->ctx->proxy_address) {
+ /* Detecting network latency for proxied connection is not implemented
+ yet. */
+ return -1;
+ }
+
+ return conn->latency;
+}
diff --git a/serf.h b/serf.h
index 6428e08..04202ee 100644
--- a/serf.h
+++ b/serf.h
@@ -82,6 +82,21 @@ typedef struct serf_request_t serf_request_t;
* http-compliant syntax. */
#define SERF_ERROR_BAD_HTTP_RESPONSE (APR_OS_START_USERERR + \
SERF_ERROR_RANGE + 5)
+/* The server sent less data than what was announced. */
+#define SERF_ERROR_TRUNCATED_HTTP_RESPONSE (APR_OS_START_USERERR + \
+ SERF_ERROR_RANGE + 6)
+/* The proxy server returned an error while setting up the SSL tunnel. */
+#define SERF_ERROR_SSLTUNNEL_SETUP_FAILED (APR_OS_START_USERERR + \
+ SERF_ERROR_RANGE + 7)
+/* The server unexpectedly closed the connection prematurely. */
+#define SERF_ERROR_ABORTED_CONNECTION (APR_OS_START_USERERR + \
+ SERF_ERROR_RANGE + 8)
+
+/* SSL certificates related errors */
+#define SERF_ERROR_SSL_CERT_FAILED (APR_OS_START_USERERR + SERF_ERROR_RANGE + 70)
+
+/* SSL communications related errors */
+#define SERF_ERROR_SSL_COMM_FAILED (APR_OS_START_USERERR + SERF_ERROR_RANGE + 71)
/* General authentication related errors */
#define SERF_ERROR_AUTHN_FAILED (APR_OS_START_USERERR + SERF_ERROR_RANGE + 90)
@@ -99,7 +114,8 @@ typedef struct serf_request_t serf_request_t;
/* This macro groups errors potentially raised when reading a http response. */
#define SERF_BAD_RESPONSE_ERROR(status) ((status) \
&& ((SERF_ERROR_DECOMPRESSION_FAILED == (status)) \
- ||(SERF_ERROR_BAD_HTTP_RESPONSE == (status))))
+ ||(SERF_ERROR_BAD_HTTP_RESPONSE == (status)) \
+ ||(SERF_ERROR_TRUNCATED_HTTP_RESPONSE == (status))))
/**
* Return a string that describes the specified error code.
@@ -366,9 +382,10 @@ typedef apr_status_t (*serf_credentials_callback_t)(
/**
* Create a new connection associated with the @a ctx serf context.
*
- * A connection will be created to (eventually) connect to the address
- * specified by @a address. The address must live at least as long as
- * @a pool (thus, as long as the connection object).
+ * If no proxy server is configured, a connection will be created to
+ * (eventually) connect to the address specified by @a address. The address must
+ * live at least as long as @a pool (thus, as long as the connection object).
+ * If a proxy server is configured, @address will be ignored.
*
* The connection object will be allocated within @a pool. Clearing or
* destroying this pool will close the connection, and terminate any
@@ -556,6 +573,20 @@ serf_request_t *serf_connection_priority_request_create(
serf_request_setup_t setup,
void *setup_baton);
+
+/** Returns detected network latency for the @a conn connection. Negative
+ * value means that latency is unknwon.
+ */
+apr_interval_time_t serf_connection_get_latency(serf_connection_t *conn);
+
+/** Check if a @a request has been completely written.
+ *
+ * Returns APR_SUCCESS if the request was written completely on the connection.
+ * Returns APR_EBUSY if the request is not yet or partially written.
+ */
+apr_status_t serf_request_is_written(
+ serf_request_t *request);
+
/**
* Cancel the request specified by the @a request object.
*
@@ -1030,8 +1061,8 @@ void serf_debug__bucket_alloc_check(
/* Version info */
#define SERF_MAJOR_VERSION 1
-#define SERF_MINOR_VERSION 1
-#define SERF_PATCH_VERSION 0
+#define SERF_MINOR_VERSION 2
+#define SERF_PATCH_VERSION 1
/* Version number string */
#define SERF_VERSION_STRING APR_STRINGIFY(SERF_MAJOR_VERSION) "." \
diff --git a/serf.mak b/serf.mak
index 4dd6057..cd083a0 100644
--- a/serf.mak
+++ b/serf.mak
@@ -122,6 +122,7 @@ LIB32_OBJS= \
"$(INTDIR)\outgoing.obj" \
"$(INTDIR)\request_buckets.obj" \
"$(INTDIR)\response_buckets.obj" \
+ "$(INTDIR)\response_body_buckets.obj" \
"$(INTDIR)\simple_buckets.obj" \
"$(INTDIR)\socket_buckets.obj" \
"$(INTDIR)\ssl_buckets.obj" \
@@ -146,22 +147,23 @@ TEST_OBJS = \
"$(INTDIR)\test_buckets.obj" \
"$(INTDIR)\test_ssl.obj" \
"$(INTDIR)\test_server.obj" \
+ "$(INTDIR)\test_sslserver.obj" \
TEST_LIBS = user32.lib advapi32.lib gdi32.lib ws2_32.lib
-ALL: INTDIR $(STATIC_LIB) TESTS
+ALL: $(INTDIR) $(STATIC_LIB) TESTS
CLEAN:
-@erase /q "$(INTDIR)" >nul
-INTDIR:
+$(INTDIR):
-@if not exist "$(INTDIR)/$(NULL)" mkdir "$(INTDIR)"
TESTS: $(STATIC_LIB) $(INTDIR)\serf_response.exe $(INTDIR)\serf_get.exe \
$(INTDIR)\serf_request.exe $(INTDIR)\test_all.exe
-CHECK: INTDIR TESTS
+CHECK: $(INTDIR) TESTS
$(INTDIR)\serf_response.exe test\testcases\simple.response
$(INTDIR)\serf_response.exe test\testcases\chunked-empty.response
$(INTDIR)\serf_response.exe test\testcases\chunked.response
@@ -169,7 +171,7 @@ CHECK: INTDIR TESTS
$(INTDIR)\serf_response.exe test\testcases\deflate.response
$(INTDIR)\test_all.exe
-"$(STATIC_LIB)": INTDIR $(LIB32_OBJS)
+"$(STATIC_LIB)": $(INTDIR) $(LIB32_OBJS)
$(LIB32) -lib @<<
$(LIB32_FLAGS) $(LIB32_OBJS) $(SYS_LIBS) /OUT:$@
<<
diff --git a/serf_bucket_types.h b/serf_bucket_types.h
index 428600a..4d83d02 100644
--- a/serf_bucket_types.h
+++ b/serf_bucket_types.h
@@ -85,6 +85,8 @@ serf_bucket_t *serf_bucket_response_create(
#define SERF_HTTP_VERSION(major, minor) ((major) * 1000 + (minor))
#define SERF_HTTP_11 SERF_HTTP_VERSION(1, 1)
#define SERF_HTTP_10 SERF_HTTP_VERSION(1, 0)
+#define SERF_HTTP_VERSION_MAJOR(shv) ((int)shv / 1000)
+#define SERF_HTTP_VERSION_MINOR(shv) ((int)shv % 1000)
typedef struct {
int version;
@@ -129,6 +131,16 @@ void serf_bucket_response_set_head(
/* ==================================================================== */
+extern const serf_bucket_type_t serf_bucket_type_response_body;
+#define SERF_BUCKET_IS_RESPONSE_BODY(b) SERF_BUCKET_CHECK((b), response_body)
+
+serf_bucket_t *serf_bucket_response_body_create(
+ serf_bucket_t *stream,
+ apr_uint64_t limit,
+ serf_bucket_alloc_t *allocator);
+
+/* ==================================================================== */
+
extern const serf_bucket_type_t serf_bucket_type_bwtp_frame;
#define SERF_BUCKET_IS_BWTP_FRAME(b) SERF_BUCKET_CHECK((b), bwtp_frame)
@@ -471,6 +483,7 @@ serf_bucket_t *serf_bucket_limit_create(
#define SERF_SSL_CERT_UNKNOWNCA 4
#define SERF_SSL_CERT_SELF_SIGNED 8
#define SERF_SSL_CERT_UNKNOWN_FAILURE 16
+#define SERF_SSL_CERT_REVOKED 32
extern const serf_bucket_type_t serf_bucket_type_ssl_encrypt;
#define SERF_BUCKET_IS_SSL_ENCRYPT(b) SERF_BUCKET_CHECK((b), ssl_encrypt)
@@ -599,6 +612,15 @@ apr_status_t serf_ssl_trust_cert(
serf_ssl_context_t *ssl_ctx,
serf_ssl_certificate_t *cert);
+/**
+ * Enable or disable SSL compression on a SSL session.
+ * @a enabled = 1 to enable compression, 0 to disable compression.
+ * Default = disabled.
+ */
+apr_status_t serf_ssl_use_compression(
+ serf_ssl_context_t *ssl_ctx,
+ int enabled);
+
serf_bucket_t *serf_bucket_ssl_encrypt_create(
serf_bucket_t *stream,
serf_ssl_context_t *ssl_context,
diff --git a/serf_private.h b/serf_private.h
index 59e4db7..867d74e 100644
--- a/serf_private.h
+++ b/serf_private.h
@@ -30,6 +30,16 @@
#define SERF_IO_CONN (2)
#define SERF_IO_LISTENER (3)
+/* Internal logging facilities, set flag to 1 to enable console logging for
+ the selected component. */
+#define SSL_VERBOSE 0
+#define SSL_MSG_VERBOSE 0 /* logs decrypted requests and responses. */
+#define SOCK_VERBOSE 0
+#define SOCK_MSG_VERBOSE 0 /* logs bytes received from or written to a socket. */
+#define CONN_VERBOSE 0
+#define AUTH_VERBOSE 0
+
+
typedef struct serf__authn_scheme_t serf__authn_scheme_t;
typedef struct serf_io_baton_t {
@@ -67,6 +77,13 @@ struct serf_request_t {
int written;
int priority;
+ /* This baton is currently only used for digest authentication, which
+ needs access to the uri of the request in the response handler.
+ If serf_request_t is replaced by a serf_http_request_t in the future,
+ which knows about uri and method and such, this baton won't be needed
+ anymore. */
+ void *auth_baton;
+
struct serf_request_t *next;
};
@@ -203,12 +220,6 @@ struct serf_connection_t {
serf_request_t *requests;
serf_request_t *requests_tail;
- /* The list of requests we're holding on to because we're going to
- * reset the connection soon.
- */
- serf_request_t *hold_requests;
- serf_request_t *hold_requests_tail;
-
struct iovec vec[IOV_MAX];
int vec_len;
@@ -228,10 +239,30 @@ struct serf_connection_t {
/* connection and authentication scheme specific information */
void *authn_baton;
void *proxy_authn_baton;
+
+ /* Time marker when connection begins. */
+ apr_time_t connect_time;
+
+ /* Calculated connection latency. Negative value if latency is unknown. */
+ apr_interval_time_t latency;
};
+/*** Internal bucket functions ***/
+
+/** Transform a response_bucket in-place into an aggregate bucket. Restore the
+ status line and all headers, not just the body.
+
+ This can only be used when we haven't started reading the body of the
+ response yet.
+
+ Keep internal for now, probably only useful within serf.
+ */
+apr_status_t serf_response_full_become_aggregate(serf_bucket_t *bucket);
+
/*** Authentication handler declarations ***/
+typedef enum { PROXY, HOST } peer_t;
+
/**
* For each authentication scheme we need a handler function of type
* serf__auth_handler_func_t. This function will be called when an
@@ -273,8 +304,10 @@ typedef apr_status_t
* authentication headers (if needed).
*/
typedef apr_status_t
-(*serf__setup_request_func_t)(int code,
+(*serf__setup_request_func_t)(peer_t peer,
+ int code,
serf_connection_t *conn,
+ serf_request_t *request,
const char *method,
const char *uri,
serf_bucket_t *hdrs_bkt);
@@ -285,7 +318,8 @@ typedef apr_status_t
* (if needed).
*/
typedef apr_status_t
-(*serf__validate_response_func_t)(int code,
+(*serf__validate_response_func_t)(peer_t peer,
+ int code,
serf_connection_t *conn,
serf_request_t *request,
serf_bucket_t *response,
@@ -350,4 +384,20 @@ apr_status_t serf__conn_update_pollset(serf_connection_t *conn);
/* from ssltunnel.c */
apr_status_t serf__ssltunnel_connect(serf_connection_t *conn);
+
+/** Logging functions. Use one of the [COMP]_VERBOSE flags to enable specific
+ logging.
+ **/
+
+/* Logs a standard event, with filename & timestamp header */
+void serf__log(int verbose_flag, const char *filename, const char *fmt, ...);
+
+/* Logs a standard event, but without prefix. This is useful to build up
+ log lines in parts. */
+void serf__log_nopref(int verbose_flag, const char *fmt, ...);
+
+/* Logs a socket event, add local and remote ip address:port */
+void serf__log_skt(int verbose_flag, const char *filename, apr_socket_t *skt,
+ const char *fmt, ...);
+
#endif
diff --git a/serfmake b/serfmake
index 3ced654..f310a0e 100755
--- a/serfmake
+++ b/serfmake
@@ -36,6 +36,7 @@ LIB_FILES = [
('buckets', 'mmap_buckets'),
('buckets', 'socket_buckets'),
('buckets', 'response_buckets'),
+ ('buckets', 'response_body_buckets'),
('buckets', 'headers_buckets'),
('buckets', 'allocator'),
('buckets', 'dechunk_buckets'),
@@ -59,6 +60,7 @@ TEST_DEPS = [
('test', 'test_buckets'),
('test', 'test_ssl'),
('test/server', 'test_server'),
+ ('test/server', 'test_sslserver'),
]
TEST_HDR_FILES = [
@@ -124,9 +126,12 @@ def usage():
print('\tinstall\tInstalls serf into PREFIX')
print('\tclean\tCleans')
print('Options:')
- print('\t--with-apr=PATH\tprefix for installed APR and APR-util')
- print('\t\t\t(needs apr-1-config and apu-1-config; will look in PATH)')
- print('\t--prefix=PATH\tinstall serf into PATH (default: /usr/local)')
+ print('\t--with-apr=PATH\t\tprefix for installed APR and APR-util')
+ print('\t\t\t\t(needs apr-1-config and apu-1-config; will look in PATH)')
+ print('\t--with-gssapi=PATH\tbuild serf with GSSAPI support')
+ print('\t\t\t\t(needs krb5-config; will look in PATH/bin)')
+
+ print('\t--prefix=PATH\t\tinstall serf into PATH (default: /usr/local)')
print('Quick guide:')
print('\tserfmake --prefix=/usr/local/serf --with-apr=/usr/local/apr install')
sys.exit(1)
@@ -140,6 +145,7 @@ def cmd_build(param):
def cmd_install(param):
builder = Builder(param)
+ builder.build_target(File('.', PCFILE, 'pc'), False)
### should be called .install_all()
builder.install_target(File('.', LIBNAME, 'la'), False)
@@ -186,6 +192,7 @@ def cmd_clean(param):
class Builder(object):
def __init__(self, params):
+ # use apr option if set
if 'apr' in params:
self.apr = APRConfig(params['apr'])
self.apu = APUConfig(params['apr'])
@@ -193,6 +200,12 @@ class Builder(object):
self.apr = APRConfig(None)
self.apu = APUConfig(None)
+ # build with gssapi if option is set
+ if 'gssapi' in params:
+ self.gssapi = GSSAPIConfig(params['gssapi'])
+ else:
+ self.gssapi = None
+
try:
self.prefix = params['prefix']
except:
@@ -228,6 +241,10 @@ class Builder(object):
+ ' ' + self.apr.get_value(None, '--libs') \
+ ' -lz'
self.SSL_LIBS = '-lssl -lcrypto'
+ if self.gssapi:
+ self.LIBS += ' ' + self.gssapi.get_value(None, '--libs gssapi')
+ self.CFLAGS += ' ' + self.gssapi.get_value('CFLAGS', '--cflags gssapi')\
+ + ' -DSERF_HAVE_GSSAPI -g'
self.MODE = 644
@@ -420,6 +437,10 @@ class APUConfig(ConfigScript):
script_name = 'apu-1-config'
+class GSSAPIConfig(ConfigScript):
+ script_name = 'krb5-config'
+
+
class CommandLine(object):
"""Simple helper to invoke a system command when called."""
diff --git a/ssltunnel.c b/ssltunnel.c
index 6803266..a038ae5 100644
--- a/ssltunnel.c
+++ b/ssltunnel.c
@@ -91,21 +91,30 @@ static apr_status_t handle_response(serf_request_t *request,
return status;
}
- /* Body is supposed to be empty. */
- if (sl.code == 200) {
+ /* RFC 2817: Any successful (2xx) response to a CONNECT request indicates
+ that the proxy has established a connection to the requested host and
+ port, and has switched to tunneling the current connection to that server
+ connection.
+ */
+ if (sl.code >= 200 && sl.code < 300) {
request->conn->state = SERF_CONN_CONNECTED;
+ /* Body is supposed to be empty. */
apr_pool_destroy(ctx->pool);
serf_bucket_destroy(request->conn->ssltunnel_ostream);
request->conn->stream = NULL;
ctx = NULL;
+ serf__log(CONN_VERBOSE, __FILE__,
+ "successfully set up ssl tunnel on connection 0x%x\n",
+ request->conn);
+
return APR_EOF;
}
- /* Authentication failure and 200 Ok are handled at this point,
+ /* Authentication failure and 2xx Ok are handled at this point,
the rest are errors. */
- return APR_EGENERAL; /* TODO: better error code */
+ return SERF_ERROR_SSLTUNNEL_SETUP_FAILED;
}
/* Prepare the CONNECT request. */
@@ -163,6 +172,8 @@ apr_status_t serf__ssltunnel_connect(serf_connection_t *conn)
ctx);
conn->state = SERF_CONN_SETUP_SSLTUNNEL;
+ serf__log(CONN_VERBOSE, __FILE__,
+ "setting up ssl tunnel on connection 0x%x\n", conn);
return APR_SUCCESS;
}
diff --git a/test/CuTest.c b/test/CuTest.c
index 315f59f..377d396 100644
--- a/test/CuTest.c
+++ b/test/CuTest.c
@@ -205,13 +205,14 @@ void CuAssert_Line(CuTest* tc, const char* file, int line, const char* message,
CuFail_Line(tc, file, line, NULL, message);
}
-void CuAssertStrEquals_LineMsg(CuTest* tc, const char* file, int line, const char* message,
- const char* expected, const char* actual)
+void CuAssertStrnEquals_LineMsg(CuTest* tc, const char* file, int line, const char* message,
+ const char* expected, size_t explen,
+ const char* actual)
{
CuString string;
if ((expected == NULL && actual == NULL) ||
(expected != NULL && actual != NULL &&
- strcmp(expected, actual) == 0))
+ strncmp(expected, actual, explen) == 0))
{
return;
}
@@ -230,6 +231,12 @@ void CuAssertStrEquals_LineMsg(CuTest* tc, const char* file, int line, const cha
CuFailInternal(tc, file, line, &string);
}
+void CuAssertStrEquals_LineMsg(CuTest* tc, const char* file, int line, const char* message,
+ const char* expected, const char* actual)
+{
+ CuAssertStrnEquals_LineMsg(tc, file, line, message, expected, strlen(expected), actual);
+}
+
void CuAssertIntEquals_LineMsg(CuTest* tc, const char* file, int line, const char* message,
int expected, int actual)
{
diff --git a/test/CuTest.h b/test/CuTest.h
index 1895bec..930ae9c 100644
--- a/test/CuTest.h
+++ b/test/CuTest.h
@@ -90,6 +90,9 @@ void CuAssert_Line(CuTest* tc, const char* file, int line, const char* message,
void CuAssertStrEquals_LineMsg(CuTest* tc,
const char* file, int line, const char* message,
const char* expected, const char* actual);
+void CuAssertStrnEquals_LineMsg(CuTest* tc,
+ const char* file, int line, const char* message,
+ const char* expected, size_t explen, const char* actual);
void CuAssertIntEquals_LineMsg(CuTest* tc,
const char* file, int line, const char* message,
int expected, int actual);
@@ -108,6 +111,8 @@ void CuAssertPtrEquals_LineMsg(CuTest* tc,
#define CuAssertStrEquals(tc,ex,ac) CuAssertStrEquals_LineMsg((tc),__FILE__,__LINE__,NULL,(ex),(ac))
#define CuAssertStrEquals_Msg(tc,ms,ex,ac) CuAssertStrEquals_LineMsg((tc),__FILE__,__LINE__,(ms),(ex),(ac))
+#define CuAssertStrnEquals(tc,ex,exlen,ac) CuAssertStrnEquals_LineMsg((tc),__FILE__,__LINE__,NULL,(ex),(exlen),(ac))
+#define CuAssertStrnEquals_Msg(tc,ms,ex,exlen,ac) CuAssertStrnEquals_LineMsg((tc),__FILE__,__LINE__,(ms),(ex),(exlen),ac))
#define CuAssertIntEquals(tc,ex,ac) CuAssertIntEquals_LineMsg((tc),__FILE__,__LINE__,NULL,(ex),(ac))
#define CuAssertIntEquals_Msg(tc,ms,ex,ac) CuAssertIntEquals_LineMsg((tc),__FILE__,__LINE__,(ms),(ex),(ac))
#define CuAssertDblEquals(tc,ex,ac,dl) CuAssertDblEquals_LineMsg((tc),__FILE__,__LINE__,NULL,(ex),(ac),(dl))
diff --git a/test/serf_get.c b/test/serf_get.c
index ac1bb8e..b63bb66 100644
--- a/test/serf_get.c
+++ b/test/serf_get.c
@@ -68,6 +68,18 @@ static apr_status_t ignore_all_cert_errors(void *data, int failures,
return APR_SUCCESS;
}
+static char *
+convert_organisation_to_str(apr_hash_t *org, apr_pool_t *pool)
+{
+ return apr_psprintf(pool, "%s, %s, %s, %s, %s (%s)",
+ (char*)apr_hash_get(org, "OU", APR_HASH_KEY_STRING),
+ (char*)apr_hash_get(org, "O", APR_HASH_KEY_STRING),
+ (char*)apr_hash_get(org, "L", APR_HASH_KEY_STRING),
+ (char*)apr_hash_get(org, "ST", APR_HASH_KEY_STRING),
+ (char*)apr_hash_get(org, "C", APR_HASH_KEY_STRING),
+ (char*)apr_hash_get(org, "E", APR_HASH_KEY_STRING));
+}
+
static apr_status_t print_certs(void *data, int failures, int error_depth,
const serf_ssl_certificate_t * const * certs,
apr_size_t certs_len)
@@ -86,8 +98,34 @@ static apr_status_t print_certs(void *data, int failures, int error_depth,
fprintf(stderr, "Chain provided with depth=%d\n", error_depth);
while ((current = *certs) != NULL)
- {
+ {
+ apr_hash_t *issuer, *subject, *serf_cert;
+ apr_array_header_t *san;
+
+ subject = serf_ssl_cert_subject(current, pool);
+ issuer = serf_ssl_cert_issuer(current, pool);
+ serf_cert = serf_ssl_cert_certificate(current, pool);
+
fprintf(stderr, "\n-----BEGIN CERTIFICATE-----\n");
+ fprintf(stderr, "Hostname: %s\n",
+ (const char *)apr_hash_get(subject, "CN", APR_HASH_KEY_STRING));
+ fprintf(stderr, "Sha1: %s\n",
+ (const char *)apr_hash_get(serf_cert, "sha1", APR_HASH_KEY_STRING));
+ fprintf(stderr, "Valid from: %s\n",
+ (const char *)apr_hash_get(serf_cert, "notBefore", APR_HASH_KEY_STRING));
+ fprintf(stderr, "Valid until: %s\n",
+ (const char *)apr_hash_get(serf_cert, "notAfter", APR_HASH_KEY_STRING));
+ fprintf(stderr, "Issuer: %s\n", convert_organisation_to_str(issuer, pool));
+
+ san = apr_hash_get(serf_cert, "subjectAltName", APR_HASH_KEY_STRING);
+ if (san) {
+ int i;
+ for (i = 0; i < san->nelts; i++) {
+ char *s = APR_ARRAY_IDX(san, i, char*);
+ fprintf(stderr, "SubjectAltName: %s\n", s);
+ }
+ }
+
fprintf(stderr, "%s\n", serf_ssl_cert_export(current, pool));
fprintf(stderr, "-----END CERTIFICATE-----\n");
++certs;
diff --git a/test/server/serfcacert.pem b/test/server/serfcacert.pem
new file mode 100644
index 0000000..f8324cd
--- /dev/null
+++ b/test/server/serfcacert.pem
@@ -0,0 +1,50 @@
+Certificate:
+ Data:
+ Version: 1 (0x0)
+ Serial Number: 1048578 (0x100002)
+ Signature Algorithm: sha1WithRSAEncryption
+ Issuer: C=BE, ST=Antwerp, L=Mechelen, O=In Serf we trust, Inc., OU=Test Suite Root CA, CN=Serf Root CA/emailAddress=serfrootca@example.com
+ Validity
+ Not Before: Apr 13 11:28:06 2013 GMT
+ Not After : Apr 13 11:28:06 2014 GMT
+ Subject: C=BE, ST=Antwerp, L=Mechelen, O=In Serf we trust, Inc., OU=Test Suite CA, CN=Serf CA/emailAddress=serfca@example.com
+ Subject Public Key Info:
+ Public Key Algorithm: rsaEncryption
+ Public-Key: (1024 bit)
+ Modulus:
+ 00:ab:10:e4:6c:e6:31:23:9f:f3:5d:a9:22:12:81:
+ 9a:b5:8d:7b:4d:8e:b7:8c:1f:2e:14:81:03:bb:44:
+ 50:79:d0:42:8c:f4:0f:86:f1:00:76:03:87:ac:a0:
+ a2:3a:6f:ab:b5:17:81:ce:86:d4:35:70:4c:a1:cb:
+ 2c:67:17:9b:06:b3:4f:1e:18:ce:9b:5d:15:8e:10:
+ 24:a5:9c:73:43:fe:b4:68:a8:65:50:58:31:3b:df:
+ b7:f8:33:d0:5d:af:c6:b1:ec:ed:73:09:cd:3e:42:
+ 6a:95:13:d0:bd:b8:9d:5a:23:24:fc:34:4f:b0:72:
+ 4b:15:e5:b4:13:4b:bc:24:85
+ Exponent: 65537 (0x10001)
+ Signature Algorithm: sha1WithRSAEncryption
+ 46:db:5f:de:b5:66:f8:9b:04:da:3c:f5:1a:99:98:c8:1f:57:
+ f8:1e:7a:f9:b4:1e:7e:21:97:11:70:64:2c:58:90:00:28:09:
+ 12:10:81:fb:27:01:37:4b:22:9a:56:95:42:e2:eb:4b:b5:8b:
+ bd:9f:09:4b:34:15:2f:ce:1e:dd:71:8c:40:0c:8a:6a:fe:a6:
+ 12:f1:68:b7:f3:be:e4:69:fb:b6:3b:c8:c4:13:9c:ae:09:d1:
+ dc:51:b9:77:90:14:2b:65:83:30:12:76:ef:33:24:65:99:63:
+ 2e:62:d7:21:db:e5:d9:a6:2d:05:17:a1:5e:ef:6f:26:f6:2f:
+ 96:b4
+-----BEGIN CERTIFICATE-----
+MIICwTCCAioCAxAAAjANBgkqhkiG9w0BAQUFADCBrjELMAkGA1UEBhMCQkUxEDAO
+BgNVBAgMB0FudHdlcnAxETAPBgNVBAcMCE1lY2hlbGVuMR8wHQYDVQQKDBZJbiBT
+ZXJmIHdlIHRydXN0LCBJbmMuMRswGQYDVQQLDBJUZXN0IFN1aXRlIFJvb3QgQ0Ex
+FTATBgNVBAMMDFNlcmYgUm9vdCBDQTElMCMGCSqGSIb3DQEJARYWc2VyZnJvb3Rj
+YUBleGFtcGxlLmNvbTAeFw0xMzA0MTMxMTI4MDZaFw0xNDA0MTMxMTI4MDZaMIGg
+MQswCQYDVQQGEwJCRTEQMA4GA1UECAwHQW50d2VycDERMA8GA1UEBwwITWVjaGVs
+ZW4xHzAdBgNVBAoMFkluIFNlcmYgd2UgdHJ1c3QsIEluYy4xFjAUBgNVBAsMDVRl
+c3QgU3VpdGUgQ0ExEDAOBgNVBAMMB1NlcmYgQ0ExITAfBgkqhkiG9w0BCQEWEnNl
+cmZjYUBleGFtcGxlLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAqxDk
+bOYxI5/zXakiEoGatY17TY63jB8uFIEDu0RQedBCjPQPhvEAdgOHrKCiOm+rtReB
+zobUNXBMocssZxebBrNPHhjOm10VjhAkpZxzQ/60aKhlUFgxO9+3+DPQXa/Gsezt
+cwnNPkJqlRPQvbidWiMk/DRPsHJLFeW0E0u8JIUCAwEAATANBgkqhkiG9w0BAQUF
+AAOBgQBG21/etWb4mwTaPPUamZjIH1f4Hnr5tB5+IZcRcGQsWJAAKAkSEIH7JwE3
+SyKaVpVC4utLtYu9nwlLNBUvzh7dcYxADIpq/qYS8Wi3877kafu2O8jEE5yuCdHc
+Ubl3kBQrZYMwEnbvMyRlmWMuYtch2+XZpi0FF6Fe728m9i+WtA==
+-----END CERTIFICATE-----
diff --git a/test/server/serfrootcacert.pem b/test/server/serfrootcacert.pem
new file mode 100644
index 0000000..440f39f
--- /dev/null
+++ b/test/server/serfrootcacert.pem
@@ -0,0 +1,60 @@
+Certificate:
+ Data:
+ Version: 3 (0x2)
+ Serial Number: 14060582211199810902 (0xc321390661bdbd56)
+ Signature Algorithm: sha1WithRSAEncryption
+ Issuer: C=BE, ST=Antwerp, L=Mechelen, O=In Serf we trust, Inc., OU=Test Suite Root CA, CN=Serf Root CA/emailAddress=serfrootca@example.com
+ Validity
+ Not Before: Apr 13 11:19:14 2013 GMT
+ Not After : Apr 11 11:19:14 2023 GMT
+ Subject: C=BE, ST=Antwerp, L=Mechelen, O=In Serf we trust, Inc., OU=Test Suite Root CA, CN=Serf Root CA/emailAddress=serfrootca@example.com
+ Subject Public Key Info:
+ Public Key Algorithm: rsaEncryption
+ Public-Key: (1024 bit)
+ Modulus:
+ 00:e1:dd:69:ea:ac:fd:f2:73:81:ec:ed:b6:b1:0e:
+ 70:23:8c:01:6d:ab:f3:43:ab:0f:fc:8a:6a:23:eb:
+ 6c:48:37:c9:c0:8f:29:61:00:7e:89:1f:00:d1:68:
+ dd:70:de:bd:34:32:0e:41:ac:f9:ea:c1:a6:0d:b5:
+ 65:be:5c:9e:f1:b4:27:54:c1:79:61:63:d4:2d:06:
+ 11:5f:cc:4c:d9:d3:ef:4e:da:9f:a4:26:16:cb:3f:
+ 86:f8:21:7d:c5:3a:32:34:c8:cb:85:ad:c4:3f:e4:
+ b3:ad:8e:a7:67:9e:0c:3b:5a:58:29:5f:ce:96:3b:
+ e3:f5:ca:42:eb:7b:44:d5:75
+ Exponent: 65537 (0x10001)
+ X509v3 extensions:
+ X509v3 Subject Key Identifier:
+ B2:3E:19:35:C1:C4:4F:23:79:ED:BF:E8:DC:5C:31:03:F0:2F:15:77
+ X509v3 Authority Key Identifier:
+ keyid:B2:3E:19:35:C1:C4:4F:23:79:ED:BF:E8:DC:5C:31:03:F0:2F:15:77
+
+ X509v3 Basic Constraints:
+ CA:TRUE
+ Signature Algorithm: sha1WithRSAEncryption
+ c3:ec:1f:3e:b1:87:d0:80:10:f9:bf:73:1b:38:d4:b1:b7:80:
+ 4d:ea:20:c1:79:7d:f5:58:42:11:13:28:ab:b1:b4:0a:88:9c:
+ 20:4d:9c:b5:5a:41:28:5e:f6:69:5e:55:bb:e2:1a:b9:c6:62:
+ 38:86:32:7b:93:28:ca:9e:af:d1:06:f9:93:c2:5d:92:c0:25:
+ 68:6a:e1:fe:85:2a:19:a7:6b:17:4d:23:9a:72:d6:d0:c1:80:
+ ff:74:10:8b:62:7a:11:c3:9a:87:2a:e4:7d:d1:8c:72:a6:bf:
+ c1:3b:d8:b8:33:c0:ff:b0:f7:d6:0e:a3:dd:36:fe:8a:41:a0:
+ 98:cc
+-----BEGIN CERTIFICATE-----
+MIIDLDCCApWgAwIBAgIJAMMhOQZhvb1WMA0GCSqGSIb3DQEBBQUAMIGuMQswCQYD
+VQQGEwJCRTEQMA4GA1UECAwHQW50d2VycDERMA8GA1UEBwwITWVjaGVsZW4xHzAd
+BgNVBAoMFkluIFNlcmYgd2UgdHJ1c3QsIEluYy4xGzAZBgNVBAsMElRlc3QgU3Vp
+dGUgUm9vdCBDQTEVMBMGA1UEAwwMU2VyZiBSb290IENBMSUwIwYJKoZIhvcNAQkB
+FhZzZXJmcm9vdGNhQGV4YW1wbGUuY29tMB4XDTEzMDQxMzExMTkxNFoXDTIzMDQx
+MTExMTkxNFowga4xCzAJBgNVBAYTAkJFMRAwDgYDVQQIDAdBbnR3ZXJwMREwDwYD
+VQQHDAhNZWNoZWxlbjEfMB0GA1UECgwWSW4gU2VyZiB3ZSB0cnVzdCwgSW5jLjEb
+MBkGA1UECwwSVGVzdCBTdWl0ZSBSb290IENBMRUwEwYDVQQDDAxTZXJmIFJvb3Qg
+Q0ExJTAjBgkqhkiG9w0BCQEWFnNlcmZyb290Y2FAZXhhbXBsZS5jb20wgZ8wDQYJ
+KoZIhvcNAQEBBQADgY0AMIGJAoGBAOHdaeqs/fJzgezttrEOcCOMAW2r80OrD/yK
+aiPrbEg3ycCPKWEAfokfANFo3XDevTQyDkGs+erBpg21Zb5cnvG0J1TBeWFj1C0G
+EV/MTNnT707an6QmFss/hvghfcU6MjTIy4WtxD/ks62Op2eeDDtaWClfzpY74/XK
+Qut7RNV1AgMBAAGjUDBOMB0GA1UdDgQWBBSyPhk1wcRPI3ntv+jcXDED8C8VdzAf
+BgNVHSMEGDAWgBSyPhk1wcRPI3ntv+jcXDED8C8VdzAMBgNVHRMEBTADAQH/MA0G
+CSqGSIb3DQEBBQUAA4GBAMPsHz6xh9CAEPm/cxs41LG3gE3qIMF5ffVYQhETKKux
+tAqInCBNnLVaQShe9mleVbviGrnGYjiGMnuTKMqer9EG+ZPCXZLAJWhq4f6FKhmn
+axdNI5py1tDBgP90EItiehHDmocq5H3RjHKmv8E72LgzwP+w99YOo902/opBoJjM
+-----END CERTIFICATE-----
diff --git a/test/server/serfservercert.pem b/test/server/serfservercert.pem
new file mode 100644
index 0000000..086e0e5
--- /dev/null
+++ b/test/server/serfservercert.pem
@@ -0,0 +1,50 @@
+Certificate:
+ Data:
+ Version: 1 (0x0)
+ Serial Number: 1048579 (0x100003)
+ Signature Algorithm: sha1WithRSAEncryption
+ Issuer: C=BE, ST=Antwerp, L=Mechelen, O=In Serf we trust, Inc., OU=Test Suite CA, CN=Serf CA/emailAddress=serfca@example.com
+ Validity
+ Not Before: Apr 13 11:41:01 2013 GMT
+ Not After : Apr 13 11:41:01 2014 GMT
+ Subject: C=BE, ST=Antwerp, L=Mechelen, O=In Serf we trust, Inc., OU=Test Suite Server, CN=Serf Server/emailAddress=serfserver@example.com
+ Subject Public Key Info:
+ Public Key Algorithm: rsaEncryption
+ Public-Key: (1024 bit)
+ Modulus:
+ 00:aa:8d:56:e7:0d:99:03:9b:3f:b3:c0:2a:63:33:
+ 51:65:4b:e7:d2:6c:60:d2:52:d7:8a:6d:c9:8b:93:
+ 3d:4c:1a:eb:29:26:9c:19:dc:a5:a6:70:3f:0b:a7:
+ 69:4d:8b:35:00:b6:8f:f2:4f:b6:38:43:b9:a7:c8:
+ 2d:51:7f:f2:f7:00:28:48:b8:f7:9a:7d:a5:7d:5c:
+ 17:f7:d0:14:54:86:39:88:43:1d:5c:d8:d4:56:9f:
+ 88:a8:3c:47:7f:65:cf:94:56:b0:d8:b6:dd:25:66:
+ 34:ba:cb:43:cd:df:93:ce:27:1b:57:7f:8a:50:f5:
+ 5a:33:d3:55:52:ff:9e:f7:4f
+ Exponent: 65537 (0x10001)
+ Signature Algorithm: sha1WithRSAEncryption
+ 82:02:80:89:ec:c2:56:51:1f:d1:f6:2f:8c:d9:50:49:c2:7f:
+ 00:76:53:65:15:96:bb:0f:7e:b3:5b:06:c2:9c:44:77:34:e9:
+ 64:41:ca:cd:aa:41:4a:6f:b0:95:cb:41:11:1b:75:0e:5e:d6:
+ 34:80:8f:22:a9:e4:ce:cd:9a:b6:0c:96:7e:e6:2a:f0:ce:eb:
+ 86:7a:2b:df:b8:13:3a:c8:b5:9d:5b:71:9c:40:61:56:c6:f9:
+ 90:b8:4f:1d:14:88:b2:ad:40:08:f5:88:ab:10:5d:74:6d:a6:
+ 29:3d:1b:01:68:9f:29:48:24:d9:3d:52:47:ca:bf:22:af:fd:
+ 7b:df
+-----BEGIN CERTIFICATE-----
+MIICvzCCAigCAxAAAzANBgkqhkiG9w0BAQUFADCBoDELMAkGA1UEBhMCQkUxEDAO
+BgNVBAgMB0FudHdlcnAxETAPBgNVBAcMCE1lY2hlbGVuMR8wHQYDVQQKDBZJbiBT
+ZXJmIHdlIHRydXN0LCBJbmMuMRYwFAYDVQQLDA1UZXN0IFN1aXRlIENBMRAwDgYD
+VQQDDAdTZXJmIENBMSEwHwYJKoZIhvcNAQkBFhJzZXJmY2FAZXhhbXBsZS5jb20w
+HhcNMTMwNDEzMTE0MTAxWhcNMTQwNDEzMTE0MTAxWjCBrDELMAkGA1UEBhMCQkUx
+EDAOBgNVBAgMB0FudHdlcnAxETAPBgNVBAcMCE1lY2hlbGVuMR8wHQYDVQQKDBZJ
+biBTZXJmIHdlIHRydXN0LCBJbmMuMRowGAYDVQQLDBFUZXN0IFN1aXRlIFNlcnZl
+cjEUMBIGA1UEAwwLU2VyZiBTZXJ2ZXIxJTAjBgkqhkiG9w0BCQEWFnNlcmZzZXJ2
+ZXJAZXhhbXBsZS5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAKqNVucN
+mQObP7PAKmMzUWVL59JsYNJS14ptyYuTPUwa6ykmnBncpaZwPwunaU2LNQC2j/JP
+tjhDuafILVF/8vcAKEi495p9pX1cF/fQFFSGOYhDHVzY1FafiKg8R39lz5RWsNi2
+3SVmNLrLQ83fk84nG1d/ilD1WjPTVVL/nvdPAgMBAAEwDQYJKoZIhvcNAQEFBQAD
+gYEAggKAiezCVlEf0fYvjNlQScJ/AHZTZRWWuw9+s1sGwpxEdzTpZEHKzapBSm+w
+lctBERt1Dl7WNICPIqnkzs2atgyWfuYq8M7rhnor37gTOsi1nVtxnEBhVsb5kLhP
+HRSIsq1ACPWIqxBddG2mKT0bAWifKUgk2T1SR8q/Iq/9e98=
+-----END CERTIFICATE-----
diff --git a/test/server/serfserverkey.pem b/test/server/serfserverkey.pem
new file mode 100644
index 0000000..ed461a2
--- /dev/null
+++ b/test/server/serfserverkey.pem
@@ -0,0 +1,18 @@
+-----BEGIN RSA PRIVATE KEY-----
+Proc-Type: 4,ENCRYPTED
+DEK-Info: DES-EDE3-CBC,8412FEAB72C5064F
+
+7hX15avmcrhdzHcirFHRc3clpNSnln+QFAsqXZjVc0TGWSKkrpQco783LDfIzLF1
+SWQUseIsIfELrxuFRV32kEwI75pwP27X82M5sDhp2Bw3Dxv++ZeMNRoCX1a3+fkO
+2I9QC6KFbvqdMeQXDAcwJXrR9ASCHtVoQbrdoMpoBo6n4NwRrF9loaPHtHgSnF64
+dQjmT0s7QU99qW/PbODjzfzpY+rqrtyu3lXx+XVkFTWrDTU+DpFXfOyUF3iqSd5U
+pEW1pimvRPF5geG8xxhAeOEfb8XZJINsfs1OI/5zpPyeXmBnwVNdgEW368pZ2ePp
+1MUd6Te6OwXoZXkCYghWm4iQSv2zSulCUq6pa55Rgb5+Zl8d74+vJ9N4Gt+g+0w6
+PkhkhizZiExYFV1GYmmTRx9BjzXgmo9qMDDtr9xENYB5KWgvSm1KmmUxKFZJZcPu
+zkv7vvlwrCPsUlsEOySanA0h6IME+ktPaQkBBG1aa28uorZD4Nbl81XYVt7jNifC
+hz9IHFxRjf51xA9WHQxDorztg74I0ZcOK1hcpCo40ivrI2Oruq3Zo/15eJNnorW2
+4cru/LaU29CZs1EaYLoANh7RFhTaQb+MkeYluwU7O6mF2DBaWvO+8lu61dLhLtEM
+SkJ3O1rOH5JzUf/bLat9L9fwGNJzPYcA1/3S6r+5q3tVdgR2s47v6WBOhXFFuR7K
+f5DC83PjOYSeWcgCoFP/Z1kW15pnJua4ORqo1NSvqFTh/jaeZHLDaX08f0GkR8s4
+c26JsBsKf6QWqQmISaWYQK2YgeEeAxM/tEnAUH2AouTJnu+6XzsL4w==
+-----END RSA PRIVATE KEY-----
diff --git a/test/server/test_server.c b/test/server/test_server.c
index 1ad2c9e..6130d6e 100644
--- a/test/server/test_server.c
+++ b/test/server/test_server.c
@@ -23,44 +23,6 @@
#include "test_server.h"
-struct serv_ctx_t {
- /* Pool for resource allocation. */
- apr_pool_t *pool;
-
- apr_int32_t options;
-
- /* Array of actions which server will replay when client connected. */
- test_server_action_t *action_list;
- /* Size of action_list array. */
- apr_size_t action_count;
- /* Index of current action. */
- apr_size_t cur_action;
-
- /* Array of messages the server will receive from the client. */
- test_server_message_t *message_list;
- /* Size of message_list array. */
- apr_size_t message_count;
- /* Index of current message. */
- apr_size_t cur_message;
-
- /* Number of messages received that the server didn't respond to yet. */
- apr_size_t outstanding_responses;
-
- /* Position in message buffer (incoming messages being read). */
- apr_size_t message_buf_pos;
-
- /* Position in action buffer. (outgoing messages being sent). */
- apr_size_t action_buf_pos;
-
- /* Address for server binding. */
- apr_sockaddr_t *serv_addr;
- apr_socket_t *serv_sock;
-
- /* Accepted client socket. NULL if there is no client socket. */
- apr_socket_t *client_sock;
-
-};
-
/* Replay support functions */
static void next_message(serv_ctx_t *servctx)
{
@@ -73,6 +35,20 @@ static void next_action(serv_ctx_t *servctx)
servctx->action_buf_pos = 0;
}
+static apr_status_t
+socket_write(serv_ctx_t *serv_ctx, const char *data,
+ apr_size_t *len)
+{
+ return apr_socket_send(serv_ctx->client_sock, data, len);
+}
+
+static apr_status_t
+socket_read(serv_ctx_t *serv_ctx, char *data,
+ apr_size_t *len)
+{
+ return apr_socket_recv(serv_ctx->client_sock, data, len);
+}
+
/* Verify received requests and take the necessary actions
(return a response, kill the connection ...) */
static apr_status_t replay(serv_ctx_t *servctx,
@@ -94,7 +70,7 @@ static apr_status_t replay(serv_ctx_t *servctx,
char buf[128];
apr_size_t len = sizeof(buf);
- status = apr_socket_recv(servctx->client_sock, buf, &len);
+ status = servctx->read(servctx, buf, &len);
if (! APR_STATUS_IS_EAGAIN(status)) {
/* we're out of actions! */
printf("Received more requests than expected.\n");
@@ -110,7 +86,7 @@ static apr_status_t replay(serv_ctx_t *servctx,
char buf[128];
apr_size_t len = sizeof(buf);
- status = apr_socket_recv(servctx->client_sock, buf, &len);
+ status = servctx->read(servctx, buf, &len);
if (status == APR_EOF) {
apr_socket_close(servctx->client_sock);
@@ -135,7 +111,7 @@ static apr_status_t replay(serv_ctx_t *servctx,
if (len > sizeof(buf))
len = sizeof(buf);
- status = apr_socket_recv(servctx->client_sock, buf, &len);
+ status = servctx->read(servctx, buf, &len);
if (status != APR_SUCCESS)
return status;
@@ -176,8 +152,9 @@ static apr_status_t replay(serv_ctx_t *servctx,
msg_len = strlen(action->text);
len = msg_len - servctx->action_buf_pos;
- status = apr_socket_send(servctx->client_sock,
- action->text + servctx->action_buf_pos, &len);
+ status = servctx->send(servctx,
+ action->text + servctx->action_buf_pos,
+ &len);
if (status != APR_SUCCESS)
return status;
@@ -219,7 +196,13 @@ apr_status_t test_server_run(serv_ctx_t *servctx,
const apr_pollfd_t *desc;
/* create a new pollset */
+#ifdef BROKEN_WSAPOLL
+ status = apr_pollset_create_ex(&pollset, 32, pool, 0,
+ APR_POLLSET_SELECT);
+#else
status = apr_pollset_create(&pollset, 32, pool, 0);
+#endif
+
if (status != APR_SUCCESS)
return status;
@@ -261,6 +244,13 @@ apr_status_t test_server_run(serv_ctx_t *servctx,
}
if (desc->desc.s == servctx->client_sock) {
+ if (servctx->handshake) {
+ status = servctx->handshake(servctx);
+ }
+
+ if (status)
+ goto cleanup;
+
/* Replay data to socket. */
status = replay(servctx, desc->rtnevents, pool);
@@ -286,20 +276,20 @@ cleanup:
return status;
}
-/* Start a TCP server on port SERV_PORT in thread THREAD. srv_replay is a array
- of action to replay when connection started. replay_count is count of
- actions in srv_replay. */
-apr_status_t test_start_server(serv_ctx_t **servctx_p,
- apr_sockaddr_t *address,
- test_server_message_t *message_list,
- apr_size_t message_count,
- test_server_action_t *action_list,
- apr_size_t action_count,
- apr_int32_t options,
- apr_pool_t *pool)
+
+/* Setup the context needed to start a TCP server on adress.
+ message_list is a list of expected requests.
+ action_list is the list of responses to be returned in order.
+ */
+void test_setup_server(serv_ctx_t **servctx_p,
+ apr_sockaddr_t *address,
+ test_server_message_t *message_list,
+ apr_size_t message_count,
+ test_server_action_t *action_list,
+ apr_size_t action_count,
+ apr_int32_t options,
+ apr_pool_t *pool)
{
- apr_status_t status;
- apr_socket_t *serv_sock;
serv_ctx_t *servctx;
servctx = apr_pcalloc(pool, sizeof(*servctx));
@@ -313,12 +303,58 @@ apr_status_t test_start_server(serv_ctx_t **servctx_p,
servctx->action_list = action_list;
servctx->action_count = action_count;
+ /* Start replay from first action. */
+ servctx->cur_action = 0;
+ servctx->action_buf_pos = 0;
+ servctx->outstanding_responses = 0;
+
+ servctx->read = socket_read;
+ servctx->send = socket_write;
+
+ *servctx_p = servctx;
+}
+
+void test_setup_https_server(serv_ctx_t **servctx_p,
+ apr_sockaddr_t *address,
+ test_server_message_t *message_list,
+ apr_size_t message_count,
+ test_server_action_t *action_list,
+ apr_size_t action_count,
+ apr_int32_t options,
+ const char *keyfile,
+ const char *certfile,
+ apr_pool_t *pool)
+{
+ serv_ctx_t *servctx;
+
+ test_setup_server(servctx_p, address, message_list,
+ message_count, action_list, action_count,
+ options, pool);
+
+ servctx = *servctx_p;
+
+ servctx->handshake = ssl_handshake;
+ /* Override with SSL encrypt/decrypt functions */
+ servctx->read = ssl_socket_read;
+ servctx->send = ssl_socket_write;
+
+ init_ssl_context(servctx, keyfile, certfile);
+}
+
+apr_status_t test_start_server(serv_ctx_t *servctx)
+{
+ apr_status_t status;
+ apr_socket_t *serv_sock;
+
/* create server socket */
#if APR_VERSION_AT_LEAST(1, 0, 0)
- status = apr_socket_create(&serv_sock, address->family, SOCK_STREAM, 0,
- pool);
+ status = apr_socket_create(&serv_sock, servctx->serv_addr->family,
+ SOCK_STREAM, 0,
+ servctx->pool);
#else
- status = apr_socket_create(&serv_sock, address->family, SOCK_STREAM, pool);
+ status = apr_socket_create(&serv_sock, servctx->serv_addr->family,
+ SOCK_STREAM,
+ servctx->pool);
#endif
if (status != APR_SUCCESS)
@@ -332,28 +368,29 @@ apr_status_t test_start_server(serv_ctx_t **servctx_p,
if (status != APR_SUCCESS)
return status;
- /* Start replay from first action. */
- servctx->cur_action = 0;
- servctx->action_buf_pos = 0;
- servctx->outstanding_responses = 0;
-
/* listen for clients */
- apr_socket_listen(serv_sock, SOMAXCONN);
+ status = apr_socket_listen(serv_sock, SOMAXCONN);
if (status != APR_SUCCESS)
return status;
servctx->serv_sock = serv_sock;
servctx->client_sock = NULL;
+
return APR_SUCCESS;
}
apr_status_t test_server_destroy(serv_ctx_t *servctx, apr_pool_t *pool)
{
- apr_socket_close(servctx->serv_sock);
+ apr_status_t status;
+
+ status = apr_socket_close(servctx->serv_sock);
if (servctx->client_sock) {
apr_socket_close(servctx->client_sock);
}
- return APR_SUCCESS;
+ if (servctx->ssl_ctx)
+ cleanup_ssl_context(servctx);
+
+ return status;
}
diff --git a/test/server/test_server.h b/test/server/test_server.h
index 9e8b0e2..65a61e6 100644
--- a/test/server/test_server.h
+++ b/test/server/test_server.h
@@ -16,8 +16,6 @@
#ifndef TEST_SERVER_H
#define TEST_SERVER_H
-typedef struct serv_ctx_t serv_ctx_t;
-
#define TEST_SERVER_DUMP 1
/* Default port for our test server. */
@@ -26,6 +24,15 @@ typedef struct serv_ctx_t serv_ctx_t;
#define PROXY_PORT 23456
+typedef struct serv_ctx_t serv_ctx_t;
+
+typedef apr_status_t (*send_func_t)(serv_ctx_t *serv_ctx, const char *data,
+ apr_size_t *len);
+typedef apr_status_t (*receive_func_t)(serv_ctx_t *serv_ctx, char *data,
+ apr_size_t *len);
+
+typedef apr_status_t (*handshake_func_t)(serv_ctx_t *serv_ctx);
+
typedef struct
{
enum {
@@ -44,14 +51,70 @@ typedef struct
const char *text;
} test_server_message_t;
-apr_status_t test_start_server(serv_ctx_t **servctx_p,
- apr_sockaddr_t *address,
- test_server_message_t *message_list,
- apr_size_t message_count,
- test_server_action_t *action_list,
- apr_size_t action_count,
- apr_int32_t options,
- apr_pool_t *pool);
+struct serv_ctx_t {
+ /* Pool for resource allocation. */
+ apr_pool_t *pool;
+
+ apr_int32_t options;
+
+ /* Array of actions which server will replay when client connected. */
+ test_server_action_t *action_list;
+ /* Size of action_list array. */
+ apr_size_t action_count;
+ /* Index of current action. */
+ apr_size_t cur_action;
+
+ /* Array of messages the server will receive from the client. */
+ test_server_message_t *message_list;
+ /* Size of message_list array. */
+ apr_size_t message_count;
+ /* Index of current message. */
+ apr_size_t cur_message;
+
+ /* Number of messages received that the server didn't respond to yet. */
+ apr_size_t outstanding_responses;
+
+ /* Position in message buffer (incoming messages being read). */
+ apr_size_t message_buf_pos;
+
+ /* Position in action buffer. (outgoing messages being sent). */
+ apr_size_t action_buf_pos;
+
+ /* Address for server binding. */
+ apr_sockaddr_t *serv_addr;
+ apr_socket_t *serv_sock;
+
+ /* Accepted client socket. NULL if there is no client socket. */
+ apr_socket_t *client_sock;
+
+ send_func_t send;
+ receive_func_t read;
+
+ handshake_func_t handshake;
+ void *ssl_ctx;
+};
+
+void test_setup_server(serv_ctx_t **servctx_p,
+ apr_sockaddr_t *address,
+ test_server_message_t *message_list,
+ apr_size_t message_count,
+ test_server_action_t *action_list,
+ apr_size_t action_count,
+ apr_int32_t options,
+ apr_pool_t *pool);
+
+void test_setup_https_server(serv_ctx_t **servctx_p,
+ apr_sockaddr_t *address,
+ test_server_message_t *message_list,
+ apr_size_t message_count,
+ test_server_action_t *action_list,
+ apr_size_t action_count,
+ apr_int32_t options,
+ const char *keyfile,
+ const char *certfile,
+ apr_pool_t *pool);
+
+apr_status_t test_start_server(serv_ctx_t *serv_ctx);
apr_status_t test_server_run(serv_ctx_t *servctx,
apr_short_interval_time_t duration,
@@ -59,6 +122,16 @@ apr_status_t test_server_run(serv_ctx_t *servctx,
apr_status_t test_server_destroy(serv_ctx_t *servctx, apr_pool_t *pool);
+apr_status_t init_ssl_context(serv_ctx_t *serv_ctx,
+ const char *keyfile,
+ const char *certfile);
+apr_status_t ssl_handshake(serv_ctx_t *servctx);
+apr_status_t ssl_socket_write(serv_ctx_t *serv_ctx, const char *data,
+ apr_size_t *len);
+apr_status_t ssl_socket_read(serv_ctx_t *serv_ctx, char *data, apr_size_t *len);
+void cleanup_ssl_context(serv_ctx_t *serv_ctx);
+
+
#ifndef APR_VERSION_AT_LEAST /* Introduced in APR 1.3.0 */
#define APR_VERSION_AT_LEAST(major,minor,patch) \
(((major) < APR_MAJOR_VERSION) \
@@ -67,4 +140,5 @@ apr_status_t test_server_destroy(serv_ctx_t *servctx, apr_pool_t *pool);
(patch) <= APR_PATCH_VERSION))
#endif /* APR_VERSION_AT_LEAST */
+
#endif /* TEST_SERVER_H */
diff --git a/test/server/test_sslserver.c b/test/server/test_sslserver.c
new file mode 100644
index 0000000..74492ec
--- /dev/null
+++ b/test/server/test_sslserver.c
@@ -0,0 +1,252 @@
+/* Copyright 2013 Justin Erenkrantz and Greg Stein
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "serf.h"
+#include "test_server.h"
+
+#include "serf_private.h"
+
+//#ifdef SERF_HAVE_OPENSSL
+
+#include <openssl/bio.h>
+#include <openssl/ssl.h>
+#include <openssl/err.h>
+
+#define TEST_VERBOSE 0
+
+static int init_done = 0;
+
+typedef struct ssl_context_t {
+ int handshake_done;
+
+ SSL_CTX* ctx;
+ SSL* ssl;
+ BIO *bio;
+
+} ssl_context_t;
+
+int pem_passwd_cb(char *buf, int size, int rwflag, void *userdata)
+{
+ strncpy(buf, "serftest", size);
+ buf[size - 1] = '\0';
+ return strlen(buf);
+}
+
+static int bio_apr_socket_create(BIO *bio)
+{
+ bio->shutdown = 1;
+ bio->init = 1;
+ bio->num = -1;
+ bio->ptr = NULL;
+
+ return 1;
+}
+
+static int bio_apr_socket_destroy(BIO *bio)
+{
+ /* Did we already free this? */
+ if (bio == NULL) {
+ return 0;
+ }
+
+ return 1;
+}
+
+static long bio_apr_socket_ctrl(BIO *bio, int cmd, long num, void *ptr)
+{
+ long ret = 1;
+
+ switch (cmd) {
+ default:
+ /* abort(); */
+ break;
+ case BIO_CTRL_FLUSH:
+ /* At this point we can't force a flush. */
+ break;
+ case BIO_CTRL_PUSH:
+ case BIO_CTRL_POP:
+ ret = 0;
+ break;
+ }
+ return ret;
+}
+
+/* Returns the amount read. */
+static int bio_apr_socket_read(BIO *bio, char *in, int inlen)
+{
+ apr_size_t len = inlen;
+ serv_ctx_t *serv_ctx = bio->ptr;
+ apr_status_t status;
+
+ BIO_clear_retry_flags(bio);
+
+ status = apr_socket_recv(serv_ctx->client_sock, in, &len);
+ if (status == APR_EAGAIN) {
+ BIO_set_retry_read(bio);
+ if (len == 0)
+ return -1;
+
+ }
+
+ if (SERF_BUCKET_READ_ERROR(status))
+ return -1;
+
+ serf__log(TEST_VERBOSE, __FILE__, "Read %d bytes from socket with status %d.\n",
+ len, status);
+
+ return len;
+}
+
+/* Returns the amount written. */
+static int bio_apr_socket_write(BIO *bio, const char *in, int inlen)
+{
+ apr_size_t len = inlen;
+ serv_ctx_t *serv_ctx = bio->ptr;
+
+ apr_status_t status = apr_socket_send(serv_ctx->client_sock, in, &len);
+
+ if (SERF_BUCKET_READ_ERROR(status))
+ return -1;
+
+ serf__log(TEST_VERBOSE, __FILE__, "Wrote %d of %d bytes to socket.\n",
+ len, inlen);
+
+ return len;
+}
+
+
+static BIO_METHOD bio_apr_socket_method = {
+ BIO_TYPE_SOCKET,
+ "APR sockets",
+ bio_apr_socket_write,
+ bio_apr_socket_read,
+ NULL, /* Is this called? */
+ NULL, /* Is this called? */
+ bio_apr_socket_ctrl,
+ bio_apr_socket_create,
+ bio_apr_socket_destroy,
+#ifdef OPENSSL_VERSION_NUMBER
+ NULL /* sslc does not have the callback_ctrl field */
+#endif
+};
+
+apr_status_t init_ssl_context(serv_ctx_t *serv_ctx,
+ const char *keyfile,
+ const char *certfile)
+{
+ ssl_context_t *ssl_ctx = apr_pcalloc(serv_ctx->pool, sizeof(*ssl_ctx));
+ serv_ctx->ssl_ctx = ssl_ctx;
+
+ /* Init OpenSSL globally */
+ if (!init_done)
+ {
+ CRYPTO_malloc_init();
+ ERR_load_crypto_strings();
+ SSL_load_error_strings();
+ SSL_library_init();
+ OpenSSL_add_all_algorithms();
+ init_done = 1;
+ }
+
+ /* Init this connection */
+ if (!ssl_ctx->ctx) {
+ ssl_ctx->ctx = SSL_CTX_new(SSLv23_server_method());
+ SSL_CTX_set_cipher_list(ssl_ctx->ctx, "ALL");
+ SSL_CTX_set_default_passwd_cb(ssl_ctx->ctx, pem_passwd_cb);
+
+ ssl_ctx->ssl = SSL_new(ssl_ctx->ctx);
+ SSL_use_PrivateKey_file(ssl_ctx->ssl, keyfile, SSL_FILETYPE_PEM);
+ SSL_use_certificate_file(ssl_ctx->ssl, certfile, SSL_FILETYPE_PEM);
+
+
+ ssl_ctx->bio = BIO_new(&bio_apr_socket_method);
+ ssl_ctx->bio->ptr = serv_ctx;
+ SSL_set_bio(ssl_ctx->ssl, ssl_ctx->bio, ssl_ctx->bio);
+ }
+
+ return APR_SUCCESS;
+}
+
+apr_status_t ssl_handshake(serv_ctx_t *serv_ctx)
+{
+ ssl_context_t *ssl_ctx = serv_ctx->ssl_ctx;
+ int result;
+
+ if (ssl_ctx->handshake_done)
+ return APR_SUCCESS;
+
+ /* SSL handshake */
+ result = SSL_accept(ssl_ctx->ssl);
+ if (result == 1) {
+ serf__log(TEST_VERBOSE, __FILE__, "Handshake successful.\n");
+ ssl_ctx->handshake_done = 1;
+ }
+ else {
+ int ssl_err;
+
+ ssl_err = SSL_get_error(ssl_ctx->ssl, result);
+ switch (ssl_err) {
+ case SSL_ERROR_WANT_READ:
+ case SSL_ERROR_WANT_WRITE:
+ return APR_EAGAIN;
+ default:
+ serf__log(TEST_VERBOSE, __FILE__, "SSL Error %d: ", ssl_err);
+ ERR_print_errors_fp(stderr);
+ serf__log_nopref(TEST_VERBOSE, "\n");
+ return APR_EGENERAL;
+ }
+ }
+
+ return APR_EAGAIN;
+}
+
+apr_status_t
+ssl_socket_write(serv_ctx_t *serv_ctx, const char *data,
+ apr_size_t *len)
+{
+ ssl_context_t *ssl_ctx = serv_ctx->ssl_ctx;
+
+ int result = SSL_write(ssl_ctx->ssl, data, *len);
+ if (result > 0) {
+ *len = result;
+ return APR_SUCCESS;
+ }
+
+ return APR_EGENERAL;
+}
+
+apr_status_t
+ssl_socket_read(serv_ctx_t *serv_ctx, char *data,
+ apr_size_t *len)
+{
+ ssl_context_t *ssl_ctx = serv_ctx->ssl_ctx;
+
+ int result = SSL_read(ssl_ctx->ssl, data, *len);
+ if (result > 0) {
+ *len = result;
+ return APR_SUCCESS;
+ }
+
+ return APR_EGENERAL;
+}
+
+void cleanup_ssl_context(serv_ctx_t *serv_ctx)
+{
+ ssl_context_t *ssl_ctx = serv_ctx->ssl_ctx;
+
+ SSL_clear(ssl_ctx->ssl);
+ SSL_CTX_free(ssl_ctx->ctx);
+}
+//#endif /* SERF_HAVE_OPENSSL */ \ No newline at end of file
diff --git a/test/test_buckets.c b/test/test_buckets.c
index 7d4f7ac..4707d70 100644
--- a/test/test_buckets.c
+++ b/test/test_buckets.c
@@ -20,8 +20,44 @@
#include "serf.h"
#include "test_serf.h"
+/* test case has access to internal functions. */
+#include "serf_private.h"
+
#define CRLF "\r\n"
+static apr_status_t read_all(serf_bucket_t *bkt,
+ char *buf,
+ apr_size_t buf_len,
+ apr_size_t *read_len)
+{
+ const char *data;
+ apr_size_t data_len;
+ apr_status_t status;
+ apr_size_t read;
+
+ read = 0;
+
+ do
+ {
+ status = serf_bucket_read(bkt, SERF_READ_ALL_AVAIL, &data, &data_len);
+
+ if (!SERF_BUCKET_READ_ERROR(status))
+ {
+ if (data_len > buf_len - read)
+ {
+ /* Buffer is not large enough to read all data */
+ data_len = buf_len - read;
+ status = APR_EGENERAL;
+ }
+ memcpy(buf + read, data, data_len);
+ read += data_len;
+ }
+ } while(status == APR_SUCCESS);
+
+ *read_len = read;
+ return status;
+}
+
static void test_simple_bucket_readline(CuTest *tc)
{
apr_status_t status;
@@ -201,7 +237,7 @@ static void test_bucket_header_set(CuTest *tc)
CuAssertStrEquals(tc, "bar,baz,test", serf_bucket_headers_get(hdrs, "Foo"));
- // headers are case insensitive.
+ /* headers are case insensitive. */
CuAssertStrEquals(tc, "bar,baz,test", serf_bucket_headers_get(hdrs, "fOo"));
test_teardown(test_pool);
}
@@ -384,6 +420,44 @@ static void test_iovec_buckets(CuTest *tc)
test_teardown(test_pool);
}
+/* Construct a header bucket with some headers, and then read from it. */
+static void test_header_buckets(CuTest *tc)
+{
+ apr_status_t status;
+ apr_pool_t *test_pool = test_setup();
+ serf_bucket_alloc_t *alloc = serf_bucket_allocator_create(test_pool, NULL,
+ NULL);
+ const char *cur;
+
+ serf_bucket_t *hdrs = serf_bucket_headers_create(alloc);
+ CuAssertTrue(tc, hdrs != NULL);
+
+ serf_bucket_headers_set(hdrs, "Content-Type", "text/plain");
+ serf_bucket_headers_set(hdrs, "Content-Length", "100");
+
+ /* Note: order not guaranteed, assume here that it's fifo. */
+ cur = "Content-Type: text/plain" CRLF
+ "Content-Length: 100" CRLF
+ CRLF
+ CRLF;
+ while (1) {
+ const char *data;
+ apr_size_t len;
+
+ status = serf_bucket_read(hdrs, SERF_READ_ALL_AVAIL, &data, &len);
+ CuAssert(tc, "Unexpected error when waiting for response headers",
+ !SERF_BUCKET_READ_ERROR(status));
+ if (SERF_BUCKET_READ_ERROR(status) ||
+ APR_STATUS_IS_EOF(status))
+ break;
+
+ /* Check that the bytes read match with expected at current position. */
+ CuAssertStrnEquals(tc, cur, len, data);
+ cur += len;
+ }
+ CuAssertIntEquals(tc, APR_EOF, status);
+}
+
static void test_aggregate_buckets(CuTest *tc)
{
apr_status_t status;
@@ -409,6 +483,255 @@ static void test_aggregate_buckets(CuTest *tc)
test_teardown(test_pool);
}
+/* Test for issue: the server aborts the connection in the middle of
+ streaming the body of the response, where the length was set with the
+ Content-Length header. Test that we get a decent error code from the
+ response bucket instead of APR_EOF. */
+static void test_response_body_too_small_cl(CuTest *tc)
+{
+ serf_bucket_t *bkt, *tmp;
+ apr_pool_t *test_pool = test_setup();
+ serf_bucket_alloc_t *alloc = serf_bucket_allocator_create(test_pool, NULL,
+ NULL);
+
+ /* Make a response of 60 bytes, but set the Content-Length to 100. */
+#define BODY "12345678901234567890"\
+ "12345678901234567890"\
+ "12345678901234567890"
+
+ tmp = SERF_BUCKET_SIMPLE_STRING("HTTP/1.1 200 OK" CRLF
+ "Content-Type: text/plain" CRLF
+ "Content-Length: 100" CRLF
+ CRLF
+ BODY,
+ alloc);
+
+ bkt = serf_bucket_response_create(tmp, alloc);
+
+ {
+ const char *data;
+ apr_size_t len;
+ apr_status_t status;
+
+ status = serf_bucket_read(bkt, SERF_READ_ALL_AVAIL, &data, &len);
+
+ CuAssert(tc, "Read more data than expected.",
+ strlen(BODY) >= len);
+ CuAssert(tc, "Read data is not equal to expected.",
+ strncmp(BODY, data, len) == 0);
+ CuAssert(tc, "Error expected due to response body too short!",
+ SERF_BUCKET_READ_ERROR(status));
+ CuAssertIntEquals(tc, SERF_ERROR_TRUNCATED_HTTP_RESPONSE, status);
+ }
+}
+#undef BODY
+
+/* Test for issue: the server aborts the connection in the middle of
+ streaming the body of the response, using chunked encoding. Test that we get
+ a decent error code from the response bucket instead of APR_EOF. */
+static void test_response_body_too_small_chunked(CuTest *tc)
+{
+ serf_bucket_t *bkt, *tmp;
+ apr_pool_t *test_pool = test_setup();
+ serf_bucket_alloc_t *alloc = serf_bucket_allocator_create(test_pool, NULL,
+ NULL);
+
+ /* Make a response of 60 bytes, but set the chunk size to 60 and don't end
+ with chunk of length 0. */
+#define BODY "12345678901234567890"\
+"12345678901234567890"\
+"12345678901234567890"
+
+ tmp = SERF_BUCKET_SIMPLE_STRING("HTTP/1.1 200 OK" CRLF
+ "Content-Type: text/plain" CRLF
+ "Transfer-Encoding: chunked" CRLF
+ CRLF
+ "64" CRLF BODY,
+ alloc);
+
+ bkt = serf_bucket_response_create(tmp, alloc);
+
+ {
+ const char *data;
+ apr_size_t len;
+ apr_status_t status;
+
+ status = serf_bucket_read(bkt, SERF_READ_ALL_AVAIL, &data, &len);
+
+ CuAssert(tc, "Read more data than expected.",
+ strlen(BODY) >= len);
+ CuAssert(tc, "Read data is not equal to expected.",
+ strncmp(BODY, data, len) == 0);
+ CuAssert(tc, "Error expected due to response body too short!",
+ SERF_BUCKET_READ_ERROR(status));
+ CuAssertIntEquals(tc, SERF_ERROR_TRUNCATED_HTTP_RESPONSE, status);
+ }
+}
+#undef BODY
+
+/* Test for issue: the server aborts the connection in the middle of
+ streaming trailing CRLF after body chunk. Test that we get
+ a decent error code from the response bucket instead of APR_EOF. */
+static void test_response_body_chunked_no_crlf(CuTest *tc)
+{
+ serf_bucket_t *bkt, *tmp;
+ apr_pool_t *test_pool = test_setup();
+ serf_bucket_alloc_t *alloc = serf_bucket_allocator_create(test_pool, NULL,
+ NULL);
+
+ tmp = SERF_BUCKET_SIMPLE_STRING("HTTP/1.1 200 OK" CRLF
+ "Content-Type: text/plain" CRLF
+ "Transfer-Encoding: chunked" CRLF
+ CRLF
+ "2" CRLF
+ "AB",
+ alloc);
+
+ bkt = serf_bucket_response_create(tmp, alloc);
+
+ {
+ char buf[1024];
+ apr_size_t len;
+ apr_status_t status;
+
+ status = read_all(bkt, buf, sizeof(buf), &len);
+
+ CuAssertIntEquals(tc, SERF_ERROR_TRUNCATED_HTTP_RESPONSE, status);
+ }
+ test_teardown(test_pool);
+}
+
+/* Test for issue: the server aborts the connection in the middle of
+ streaming trailing CRLF after body chunk. Test that we get
+ a decent error code from the response bucket instead of APR_EOF. */
+static void test_response_body_chunked_incomplete_crlf(CuTest *tc)
+{
+ serf_bucket_t *bkt, *tmp;
+ apr_pool_t *test_pool = test_setup();
+ serf_bucket_alloc_t *alloc = serf_bucket_allocator_create(test_pool, NULL,
+ NULL);
+
+ tmp = SERF_BUCKET_SIMPLE_STRING("HTTP/1.1 200 OK" CRLF
+ "Content-Type: text/plain" CRLF
+ "Transfer-Encoding: chunked" CRLF
+ CRLF
+ "2" CRLF
+ "AB"
+ "\r",
+ alloc);
+
+ bkt = serf_bucket_response_create(tmp, alloc);
+
+ {
+ char buf[1024];
+ apr_size_t len;
+ apr_status_t status;
+
+ status = read_all(bkt, buf, sizeof(buf), &len);
+
+ CuAssertIntEquals(tc, SERF_ERROR_TRUNCATED_HTTP_RESPONSE, status);
+ }
+ test_teardown(test_pool);
+}
+
+static void test_response_body_chunked_gzip_small(CuTest *tc)
+{
+ serf_bucket_t *bkt, *tmp;
+ apr_pool_t *test_pool = test_setup();
+ serf_bucket_alloc_t *alloc = serf_bucket_allocator_create(test_pool, NULL,
+ NULL);
+
+ tmp = SERF_BUCKET_SIMPLE_STRING("HTTP/1.1 200 OK" CRLF
+ "Content-Type: text/plain" CRLF
+ "Transfer-Encoding: chunked" CRLF
+ "Content-Encoding: gzip" CRLF
+ CRLF
+ "2" CRLF
+ "A",
+ alloc);
+
+ bkt = serf_bucket_response_create(tmp, alloc);
+
+ {
+ char buf[1024];
+ apr_size_t len;
+ apr_status_t status;
+
+ status = read_all(bkt, buf, sizeof(buf), &len);
+
+ CuAssertIntEquals(tc, SERF_ERROR_TRUNCATED_HTTP_RESPONSE, status);
+ }
+ test_teardown(test_pool);
+}
+
+static void test_response_bucket_peek_at_headers(CuTest *tc)
+{
+ apr_pool_t *test_pool = test_setup();
+ serf_bucket_t *resp_bkt1, *tmp, *hdrs;
+ serf_status_line sl;
+ serf_bucket_alloc_t *alloc = serf_bucket_allocator_create(test_pool, NULL,
+ NULL);
+ const char *hdr_val, *cur;
+ apr_status_t status;
+
+#define EXP_RESPONSE "HTTP/1.1 200 OK" CRLF\
+ "Content-Type: text/plain" CRLF\
+ "Content-Length: 100" CRLF\
+ CRLF\
+ "12345678901234567890"\
+ "12345678901234567890"\
+ "12345678901234567890"
+
+ tmp = SERF_BUCKET_SIMPLE_STRING(EXP_RESPONSE,
+ alloc);
+
+ resp_bkt1 = serf_bucket_response_create(tmp, alloc);
+
+ status = serf_bucket_response_status(resp_bkt1, &sl);
+ CuAssertIntEquals(tc, 200, sl.code);
+ CuAssertStrEquals(tc, "OK", sl.reason);
+ CuAssertIntEquals(tc, SERF_HTTP_11, sl.version);
+
+ /* Ensure that the status line & headers are read in the response_bucket. */
+ status = serf_bucket_response_wait_for_headers(resp_bkt1);
+ CuAssert(tc, "Unexpected error when waiting for response headers",
+ !SERF_BUCKET_READ_ERROR(status));
+
+ hdrs = serf_bucket_response_get_headers(resp_bkt1);
+ CuAssertPtrNotNull(tc, hdrs);
+
+ hdr_val = serf_bucket_headers_get(hdrs, "Content-Type");
+ CuAssertStrEquals(tc, "text/plain", hdr_val);
+ hdr_val = serf_bucket_headers_get(hdrs, "Content-Length");
+ CuAssertStrEquals(tc, "100", hdr_val);
+
+ /* Create a new bucket for the response which still has the original
+ status line & headers. */
+
+ status = serf_response_full_become_aggregate(resp_bkt1);
+ CuAssertIntEquals(tc, APR_SUCCESS, status);
+ cur = EXP_RESPONSE;
+
+ while (1) {
+ const char *data;
+ apr_size_t len;
+ apr_status_t status;
+
+ status = serf_bucket_read(resp_bkt1, SERF_READ_ALL_AVAIL, &data, &len);
+ CuAssert(tc, "Unexpected error when waiting for response headers",
+ !SERF_BUCKET_READ_ERROR(status));
+ if (SERF_BUCKET_READ_ERROR(status) ||
+ APR_STATUS_IS_EOF(status))
+ break;
+
+ /* Check that the bytes read match with expected at current position. */
+ CuAssertStrnEquals(tc, cur, len, data);
+ cur += len;
+ }
+
+}
+#undef EXP_RESPONSE
+
CuSuite *test_buckets(void)
{
CuSuite *suite = CuSuiteNew();
@@ -417,9 +740,16 @@ CuSuite *test_buckets(void)
SUITE_ADD_TEST(suite, test_response_bucket_read);
SUITE_ADD_TEST(suite, test_response_bucket_headers);
SUITE_ADD_TEST(suite, test_response_bucket_chunked_read);
+ SUITE_ADD_TEST(suite, test_response_body_too_small_cl);
+ SUITE_ADD_TEST(suite, test_response_body_too_small_chunked);
+ SUITE_ADD_TEST(suite, test_response_body_chunked_no_crlf);
+ SUITE_ADD_TEST(suite, test_response_body_chunked_incomplete_crlf);
+ SUITE_ADD_TEST(suite, test_response_body_chunked_gzip_small);
+ SUITE_ADD_TEST(suite, test_response_bucket_peek_at_headers);
SUITE_ADD_TEST(suite, test_bucket_header_set);
SUITE_ADD_TEST(suite, test_iovec_buckets);
SUITE_ADD_TEST(suite, test_aggregate_buckets);
+ SUITE_ADD_TEST(suite, test_header_buckets);
return suite;
}
diff --git a/test/test_context.c b/test/test_context.c
index d2a24d0..14d4fa9 100644
--- a/test/test_context.c
+++ b/test/test_context.c
@@ -43,6 +43,61 @@ typedef struct {
test_baton_t *tb;
} handler_baton_t;
+/* Helper function, runs the client and server context loops and validates
+ that no errors were encountered, and all messages were sent and received. */
+static apr_status_t
+test_helper_run_requests_no_check(CuTest *tc, test_baton_t *tb,
+ int num_requests,
+ handler_baton_t handler_ctx[],
+ apr_pool_t *pool)
+{
+ apr_pool_t *iter_pool;
+ int i, done = 0;
+ apr_status_t status;
+
+ apr_pool_create(&iter_pool, pool);
+
+ while (!done)
+ {
+ apr_pool_clear(iter_pool);
+
+ status = test_server_run(tb->serv_ctx, 0, iter_pool);
+ if (!APR_STATUS_IS_TIMEUP(status) &&
+ SERF_BUCKET_READ_ERROR(status))
+ return status;
+
+ status = serf_context_run(tb->context, 0, iter_pool);
+ if (!APR_STATUS_IS_TIMEUP(status) &&
+ SERF_BUCKET_READ_ERROR(status))
+ return status;
+
+ done = 1;
+ for (i = 0; i < num_requests; i++)
+ done &= handler_ctx[i].done;
+ }
+ apr_pool_destroy(iter_pool);
+
+ return APR_SUCCESS;
+}
+
+static void
+test_helper_run_requests_expect_ok(CuTest *tc, test_baton_t *tb,
+ int num_requests,
+ handler_baton_t handler_ctx[],
+ apr_pool_t *pool)
+{
+ apr_status_t status;
+
+ status = test_helper_run_requests_no_check(tc, tb, num_requests,
+ handler_ctx, pool);
+ CuAssertIntEquals(tc, APR_SUCCESS, status);
+
+ /* Check that all requests were received */
+ CuAssertIntEquals(tc, num_requests, tb->sent_requests->nelts);
+ CuAssertIntEquals(tc, num_requests, tb->accepted_requests->nelts);
+ CuAssertIntEquals(tc, num_requests, tb->handled_requests->nelts);
+}
+
static serf_bucket_t* accept_response(serf_request_t *request,
serf_bucket_t *stream,
void *acceptor_baton,
@@ -133,15 +188,67 @@ static apr_status_t handle_response(serf_request_t *request,
return APR_SUCCESS;
}
+static void setup_handler(test_baton_t *tb, handler_baton_t *handler_ctx,
+ const char *method, const char *path,
+ int req_id,
+ serf_response_handler_t handler)
+{
+ handler_ctx->method = method;
+ handler_ctx->path = path;
+ handler_ctx->done = FALSE;
+
+ handler_ctx->acceptor = accept_response;
+ handler_ctx->acceptor_baton = NULL;
+ handler_ctx->handler = handler ? handler : handle_response;
+ handler_ctx->req_id = req_id;
+ handler_ctx->accepted_requests = tb->accepted_requests;
+ handler_ctx->sent_requests = tb->sent_requests;
+ handler_ctx->handled_requests = tb->handled_requests;
+ handler_ctx->tb = tb;
+}
+
+static void create_new_prio_request(test_baton_t *tb,
+ handler_baton_t *handler_ctx,
+ const char *method, const char *path,
+ int req_id)
+{
+ setup_handler(tb, handler_ctx, method, path, req_id, NULL);
+ serf_connection_priority_request_create(tb->connection,
+ setup_request,
+ handler_ctx);
+}
+
+static void create_new_request(test_baton_t *tb,
+ handler_baton_t *handler_ctx,
+ const char *method, const char *path,
+ int req_id)
+{
+ setup_handler(tb, handler_ctx, method, path, req_id, NULL);
+ serf_connection_request_create(tb->connection,
+ setup_request,
+ handler_ctx);
+}
+
+static void
+create_new_request_with_resp_hdlr(test_baton_t *tb,
+ handler_baton_t *handler_ctx,
+ const char *method, const char *path,
+ int req_id,
+ serf_response_handler_t handler)
+{
+ setup_handler(tb, handler_ctx, method, path, req_id, handler);
+ serf_connection_request_create(tb->connection,
+ setup_request,
+ handler_ctx);
+}
+
/* Validate that requests are sent and completed in the order of creation. */
static void test_serf_connection_request_create(CuTest *tc)
{
test_baton_t *tb;
- serf_request_t *request1, *request2;
- handler_baton_t handler_ctx, handler2_ctx;
+ handler_baton_t handler_ctx[2];
+ const int num_requests = sizeof(handler_ctx)/sizeof(handler_ctx[0]);
apr_status_t status;
- apr_pool_t *iter_pool;
- apr_array_header_t *accepted_requests, *handled_requests, *sent_requests;
int i;
test_server_message_t message_list[] = {
{CHUNKED_REQUEST(1, "1")},
@@ -152,74 +259,31 @@ static void test_serf_connection_request_create(CuTest *tc)
{SERVER_RESPOND, CHUNKED_EMPTY_RESPONSE},
{SERVER_RESPOND, CHUNKED_EMPTY_RESPONSE},
};
- apr_pool_t *test_pool = test_setup();
- accepted_requests = apr_array_make(test_pool, 2, sizeof(int));
- sent_requests = apr_array_make(test_pool, 2, sizeof(int));
- handled_requests = apr_array_make(test_pool, 2, sizeof(int));
+ apr_pool_t *test_pool = test_setup();
/* Set up a test context with a server */
status = test_server_setup(&tb,
- message_list, 2,
- action_list, 2, 0, NULL,
+ message_list, num_requests,
+ action_list, num_requests, 0, NULL,
test_pool);
CuAssertIntEquals(tc, APR_SUCCESS, status);
- handler_ctx.method = "GET";
- handler_ctx.path = "/";
- handler_ctx.done = FALSE;
-
- handler_ctx.acceptor = accept_response;
- handler_ctx.acceptor_baton = NULL;
- handler_ctx.handler = handle_response;
- handler_ctx.req_id = 1;
- handler_ctx.accepted_requests = accepted_requests;
- handler_ctx.sent_requests = sent_requests;
- handler_ctx.handled_requests = handled_requests;
-
- request1 = serf_connection_request_create(tb->connection,
- setup_request,
- &handler_ctx);
+ create_new_request(tb, &handler_ctx[0], "GET", "/", 1);
+ create_new_request(tb, &handler_ctx[1], "GET", "/", 2);
- handler2_ctx = handler_ctx;
- handler2_ctx.req_id = 2;
-
- request2 = serf_connection_request_create(tb->connection,
- setup_request,
- &handler2_ctx);
-
- apr_pool_create(&iter_pool, test_pool);
-
- while (!handler_ctx.done || !handler2_ctx.done)
- {
- apr_pool_clear(iter_pool);
-
- status = test_server_run(tb->serv_ctx, 0, iter_pool);
- if (APR_STATUS_IS_TIMEUP(status))
- status = APR_SUCCESS;
- CuAssertIntEquals(tc, APR_SUCCESS, status);
-
- status = serf_context_run(tb->context, 0, iter_pool);
- if (APR_STATUS_IS_TIMEUP(status))
- status = APR_SUCCESS;
- CuAssertIntEquals(tc, APR_SUCCESS, status);
- }
- apr_pool_destroy(iter_pool);
-
- /* Check that all requests were received */
- CuAssertIntEquals(tc, 2, sent_requests->nelts);
- CuAssertIntEquals(tc, 2, accepted_requests->nelts);
- CuAssertIntEquals(tc, 2, handled_requests->nelts);
+ test_helper_run_requests_expect_ok(tc, tb, num_requests, handler_ctx,
+ test_pool);
/* Check that the requests were sent in the order we created them */
- for (i = 0; i < sent_requests->nelts; i++) {
- int req_nr = APR_ARRAY_IDX(sent_requests, i, int);
+ for (i = 0; i < tb->sent_requests->nelts; i++) {
+ int req_nr = APR_ARRAY_IDX(tb->sent_requests, i, int);
CuAssertIntEquals(tc, i + 1, req_nr);
}
/* Check that the requests were received in the order we created them */
- for (i = 0; i < handled_requests->nelts; i++) {
- int req_nr = APR_ARRAY_IDX(handled_requests, i, int);
+ for (i = 0; i < tb->handled_requests->nelts; i++) {
+ int req_nr = APR_ARRAY_IDX(tb->handled_requests, i, int);
CuAssertIntEquals(tc, i + 1, req_nr);
}
@@ -232,11 +296,9 @@ static void test_serf_connection_request_create(CuTest *tc)
static void test_serf_connection_priority_request_create(CuTest *tc)
{
test_baton_t *tb;
- serf_request_t *request1, *request2, *request3;
- handler_baton_t handler_ctx, handler2_ctx, handler3_ctx;
+ handler_baton_t handler_ctx[3];
+ const int num_requests = sizeof(handler_ctx)/sizeof(handler_ctx[0]);
apr_status_t status;
- apr_pool_t *iter_pool;
- apr_array_header_t *accepted_requests, *handled_requests, *sent_requests;
int i;
test_server_message_t message_list[] = {
@@ -253,81 +315,29 @@ static void test_serf_connection_priority_request_create(CuTest *tc)
apr_pool_t *test_pool = test_setup();
- accepted_requests = apr_array_make(test_pool, 3, sizeof(int));
- sent_requests = apr_array_make(test_pool, 3, sizeof(int));
- handled_requests = apr_array_make(test_pool, 3, sizeof(int));
-
/* Set up a test context with a server */
status = test_server_setup(&tb,
- message_list, 3,
- action_list, 3, 0, NULL,
+ message_list, num_requests,
+ action_list, num_requests, 0, NULL,
test_pool);
CuAssertIntEquals(tc, APR_SUCCESS, status);
- handler_ctx.method = "GET";
- handler_ctx.path = "/";
- handler_ctx.done = FALSE;
-
- handler_ctx.acceptor = accept_response;
- handler_ctx.acceptor_baton = NULL;
- handler_ctx.handler = handle_response;
- handler_ctx.req_id = 2;
- handler_ctx.accepted_requests = accepted_requests;
- handler_ctx.sent_requests = sent_requests;
- handler_ctx.handled_requests = handled_requests;
-
- request1 = serf_connection_request_create(tb->connection,
- setup_request,
- &handler_ctx);
-
- handler2_ctx = handler_ctx;
- handler2_ctx.req_id = 3;
+ create_new_request(tb, &handler_ctx[0], "GET", "/", 2);
+ create_new_request(tb, &handler_ctx[1], "GET", "/", 3);
+ create_new_prio_request(tb, &handler_ctx[2], "GET", "/", 1);
- request2 = serf_connection_request_create(tb->connection,
- setup_request,
- &handler2_ctx);
- handler3_ctx = handler_ctx;
- handler3_ctx.req_id = 1;
-
- request3 = serf_connection_priority_request_create(tb->connection,
- setup_request,
- &handler3_ctx);
-
- apr_pool_create(&iter_pool, test_pool);
-
- while (!handler_ctx.done || !handler2_ctx.done || !handler3_ctx.done)
- {
- apr_pool_clear(iter_pool);
-
- status = test_server_run(tb->serv_ctx, 0, iter_pool);
- if (APR_STATUS_IS_TIMEUP(status))
- status = APR_SUCCESS;
- CuAssertIntEquals(tc, APR_SUCCESS, status);
-
- status = serf_context_run(tb->context, 0, iter_pool);
- if (APR_STATUS_IS_TIMEUP(status))
- status = APR_SUCCESS;
- CuAssertIntEquals(tc, APR_SUCCESS, status);
-
- /* Debugging purposes only! */
- serf_debug__closed_conn(tb->bkt_alloc);
- }
- apr_pool_destroy(iter_pool);
-
- /* Check that all requests were received */
- CuAssertIntEquals(tc, 3, sent_requests->nelts);
- CuAssertIntEquals(tc, 3, accepted_requests->nelts);
- CuAssertIntEquals(tc, 3, handled_requests->nelts);
+ test_helper_run_requests_expect_ok(tc, tb, num_requests, handler_ctx,
+ test_pool);
/* Check that the requests were sent in the order we created them */
- for (i = 0; i < sent_requests->nelts; i++) {
- int req_nr = APR_ARRAY_IDX(sent_requests, i, int);
+ for (i = 0; i < tb->sent_requests->nelts; i++) {
+ int req_nr = APR_ARRAY_IDX(tb->sent_requests, i, int);
CuAssertIntEquals(tc, i + 1, req_nr);
}
/* Check that the requests were received in the order we created them */
- for (i = 0; i < handled_requests->nelts; i++) {
- int req_nr = APR_ARRAY_IDX(handled_requests, i, int);
+ for (i = 0; i < tb->handled_requests->nelts; i++) {
+ int req_nr = APR_ARRAY_IDX(tb->handled_requests, i, int);
CuAssertIntEquals(tc, i + 1, req_nr);
}
@@ -337,13 +347,12 @@ static void test_serf_connection_priority_request_create(CuTest *tc)
/* Test that serf correctly handles the 'Connection:close' header when the
server is planning to close the connection. */
-#define NUM_REQUESTS 10
static void test_serf_closed_connection(CuTest *tc)
{
test_baton_t *tb;
- apr_array_header_t *accepted_requests, *handled_requests, *sent_requests;
apr_status_t status;
- handler_baton_t handler_ctx[NUM_REQUESTS];
+ handler_baton_t handler_ctx[10];
+ const int num_requests = sizeof(handler_ctx)/sizeof(handler_ctx[0]);
int done = FALSE, i;
test_server_message_t message_list[] = {
@@ -390,37 +399,18 @@ static void test_serf_closed_connection(CuTest *tc)
apr_pool_t *test_pool = test_setup();
- accepted_requests = apr_array_make(test_pool, NUM_REQUESTS, sizeof(int));
- sent_requests = apr_array_make(test_pool, NUM_REQUESTS, sizeof(int));
- handled_requests = apr_array_make(test_pool, NUM_REQUESTS, sizeof(int));
-
/* Set up a test context with a server. */
status = test_server_setup(&tb,
- message_list, 10,
+ message_list, num_requests,
action_list, 12,
0,
NULL,
test_pool);
CuAssertIntEquals(tc, APR_SUCCESS, status);
- for (i = 0 ; i < NUM_REQUESTS ; i++) {
- /* Send some requests on the connections */
- handler_ctx[i].method = "GET";
- handler_ctx[i].path = "/";
- handler_ctx[i].done = FALSE;
-
- handler_ctx[i].acceptor = accept_response;
- handler_ctx[i].acceptor_baton = NULL;
- handler_ctx[i].handler = handle_response;
- handler_ctx[i].req_id = i+1;
- handler_ctx[i].accepted_requests = accepted_requests;
- handler_ctx[i].sent_requests = sent_requests;
- handler_ctx[i].handled_requests = handled_requests;
- handler_ctx[i].tb = tb;
-
- serf_connection_request_create(tb->connection,
- setup_request,
- &handler_ctx[i]);
+ /* Send some requests on the connections */
+ for (i = 0 ; i < num_requests ; i++) {
+ create_new_request(tb, &handler_ctx[i], "GET", "/", i+1);
}
while (1) {
@@ -438,7 +428,7 @@ static void test_serf_closed_connection(CuTest *tc)
serf_debug__closed_conn(tb->bkt_alloc);
done = TRUE;
- for (i = 0 ; i < NUM_REQUESTS ; i++)
+ for (i = 0 ; i < num_requests ; i++)
if (handler_ctx[i].done == FALSE) {
done = FALSE;
break;
@@ -447,29 +437,26 @@ static void test_serf_closed_connection(CuTest *tc)
break;
}
- /* Check that all requests were received */
- CuAssertTrue(tc, sent_requests->nelts >= NUM_REQUESTS);
- CuAssertIntEquals(tc, NUM_REQUESTS, accepted_requests->nelts);
- CuAssertIntEquals(tc, NUM_REQUESTS, handled_requests->nelts);
+ /* Check that all requests were received */
+ CuAssertTrue(tc, tb->sent_requests->nelts >= num_requests);
+ CuAssertIntEquals(tc, num_requests, tb->accepted_requests->nelts);
+ CuAssertIntEquals(tc, num_requests, tb->handled_requests->nelts);
/* Cleanup */
test_server_teardown(tb, test_pool);
test_teardown(test_pool);
}
-#undef NUM_REQUESTS
/* Test if serf is sending the request to the proxy, not to the server
directly. */
static void test_serf_setup_proxy(CuTest *tc)
{
test_baton_t *tb;
- serf_request_t *request;
- handler_baton_t handler_ctx;
- apr_status_t status;
- apr_pool_t *iter_pool;
- apr_array_header_t *accepted_requests, *handled_requests, *sent_requests;
int i;
- int numrequests = 1;
+ handler_baton_t handler_ctx[1];
+ const int num_requests = sizeof(handler_ctx)/sizeof(handler_ctx[0]);
+ apr_pool_t *iter_pool;
+ apr_status_t status;
test_server_message_t message_list[] = {
{"GET http://localhost:" SERV_PORT_STR " HTTP/1.1" CRLF\
@@ -488,10 +475,6 @@ static void test_serf_setup_proxy(CuTest *tc)
apr_pool_t *test_pool = test_setup();
- accepted_requests = apr_array_make(test_pool, numrequests, sizeof(int));
- sent_requests = apr_array_make(test_pool, numrequests, sizeof(int));
- handled_requests = apr_array_make(test_pool, numrequests, sizeof(int));
-
/* Set up a test context with a server, no messages expected. */
status = test_server_proxy_setup(&tb,
/* server messages and actions */
@@ -504,25 +487,11 @@ static void test_serf_setup_proxy(CuTest *tc)
NULL, test_pool);
CuAssertIntEquals(tc, APR_SUCCESS, status);
- handler_ctx.method = "GET";
- handler_ctx.path = "/";
- handler_ctx.done = FALSE;
-
- handler_ctx.acceptor = accept_response;
- handler_ctx.acceptor_baton = NULL;
- handler_ctx.handler = handle_response;
- handler_ctx.req_id = 1;
- handler_ctx.accepted_requests = accepted_requests;
- handler_ctx.sent_requests = sent_requests;
- handler_ctx.handled_requests = handled_requests;
-
- request = serf_connection_request_create(tb->connection,
- setup_request,
- &handler_ctx);
+ create_new_request(tb, &handler_ctx[0], "GET", "/", 1);
apr_pool_create(&iter_pool, test_pool);
- while (!handler_ctx.done)
+ while (!handler_ctx[0].done)
{
apr_pool_clear(iter_pool);
@@ -547,19 +516,20 @@ static void test_serf_setup_proxy(CuTest *tc)
apr_pool_destroy(iter_pool);
/* Check that all requests were received */
- CuAssertIntEquals(tc, numrequests, sent_requests->nelts);
- CuAssertIntEquals(tc, numrequests, accepted_requests->nelts);
- CuAssertIntEquals(tc, numrequests, handled_requests->nelts);
+ CuAssertIntEquals(tc, num_requests, tb->sent_requests->nelts);
+ CuAssertIntEquals(tc, num_requests, tb->accepted_requests->nelts);
+ CuAssertIntEquals(tc, num_requests, tb->handled_requests->nelts);
+
/* Check that the requests were sent in the order we created them */
- for (i = 0; i < sent_requests->nelts; i++) {
- int req_nr = APR_ARRAY_IDX(sent_requests, i, int);
+ for (i = 0; i < tb->sent_requests->nelts; i++) {
+ int req_nr = APR_ARRAY_IDX(tb->sent_requests, i, int);
CuAssertIntEquals(tc, i + 1, req_nr);
}
/* Check that the requests were received in the order we created them */
- for (i = 0; i < handled_requests->nelts; i++) {
- int req_nr = APR_ARRAY_IDX(handled_requests, i, int);
+ for (i = 0; i < tb->handled_requests->nelts; i++) {
+ int req_nr = APR_ARRAY_IDX(tb->handled_requests, i, int);
CuAssertIntEquals(tc, i + 1, req_nr);
}
@@ -617,7 +587,6 @@ handle_response_keepalive_limit(serf_request_t *request,
static void test_keepalive_limit_one_by_one(CuTest *tc)
{
test_baton_t *tb;
- apr_array_header_t *accepted_requests, *handled_requests, *sent_requests;
apr_status_t status;
handler_baton_t handler_ctx[SEND_REQUESTS];
int done = FALSE, i;
@@ -644,35 +613,17 @@ static void test_keepalive_limit_one_by_one(CuTest *tc)
apr_pool_t *test_pool = test_setup();
- accepted_requests = apr_array_make(test_pool, RCVD_REQUESTS, sizeof(int));
- sent_requests = apr_array_make(test_pool, RCVD_REQUESTS, sizeof(int));
- handled_requests = apr_array_make(test_pool, RCVD_REQUESTS, sizeof(int));
-
/* Set up a test context with a server. */
status = test_server_setup(&tb,
- message_list, 7,
- action_list, 7, 0, NULL,
+ message_list, RCVD_REQUESTS,
+ action_list, RCVD_REQUESTS, 0, NULL,
test_pool);
CuAssertIntEquals(tc, APR_SUCCESS, status);
for (i = 0 ; i < SEND_REQUESTS ; i++) {
- /* Send some requests on the connections */
- handler_ctx[i].method = "GET";
- handler_ctx[i].path = "/";
- handler_ctx[i].done = FALSE;
-
- handler_ctx[i].acceptor = accept_response;
- handler_ctx[i].acceptor_baton = NULL;
- handler_ctx[i].handler = handle_response_keepalive_limit;
- handler_ctx[i].req_id = i+1;
- handler_ctx[i].accepted_requests = accepted_requests;
- handler_ctx[i].sent_requests = sent_requests;
- handler_ctx[i].handled_requests = handled_requests;
- handler_ctx[i].tb = tb;
-
- serf_connection_request_create(tb->connection,
- setup_request,
- &handler_ctx[i]);
+ create_new_request_with_resp_hdlr(tb, &handler_ctx[i], "GET", "/", i+1,
+ handle_response_keepalive_limit);
+ /* TODO: don't think this needs to be done in the loop. */
serf_connection_set_max_outstanding_requests(tb->connection, 1);
}
@@ -701,9 +652,9 @@ static void test_keepalive_limit_one_by_one(CuTest *tc)
}
/* Check that all requests were received */
- CuAssertIntEquals(tc, RCVD_REQUESTS, sent_requests->nelts);
- CuAssertIntEquals(tc, RCVD_REQUESTS, accepted_requests->nelts);
- CuAssertIntEquals(tc, RCVD_REQUESTS, handled_requests->nelts);
+ CuAssertIntEquals(tc, RCVD_REQUESTS, tb->sent_requests->nelts);
+ CuAssertIntEquals(tc, RCVD_REQUESTS, tb->accepted_requests->nelts);
+ CuAssertIntEquals(tc, RCVD_REQUESTS, tb->handled_requests->nelts);
/* Cleanup */
test_server_teardown(tb, test_pool);
@@ -771,8 +722,7 @@ handle_response_keepalive_limit_burst(serf_request_t *request,
static void test_keepalive_limit_one_by_one_and_burst(CuTest *tc)
{
test_baton_t *tb;
- apr_array_header_t *accepted_requests, *handled_requests, *sent_requests;
- apr_status_t status;
+ apr_status_t status;
handler_baton_t handler_ctx[SEND_REQUESTS];
int done = FALSE, i;
@@ -798,35 +748,16 @@ static void test_keepalive_limit_one_by_one_and_burst(CuTest *tc)
apr_pool_t *test_pool = test_setup();
- accepted_requests = apr_array_make(test_pool, RCVD_REQUESTS, sizeof(int));
- sent_requests = apr_array_make(test_pool, RCVD_REQUESTS, sizeof(int));
- handled_requests = apr_array_make(test_pool, RCVD_REQUESTS, sizeof(int));
-
/* Set up a test context with a server. */
status = test_server_setup(&tb,
- message_list, 7,
- action_list, 7, 0, NULL,
+ message_list, RCVD_REQUESTS,
+ action_list, RCVD_REQUESTS, 0, NULL,
test_pool);
CuAssertIntEquals(tc, APR_SUCCESS, status);
for (i = 0 ; i < SEND_REQUESTS ; i++) {
- /* Send some requests on the connections */
- handler_ctx[i].method = "GET";
- handler_ctx[i].path = "/";
- handler_ctx[i].done = FALSE;
-
- handler_ctx[i].acceptor = accept_response;
- handler_ctx[i].acceptor_baton = NULL;
- handler_ctx[i].handler = handle_response_keepalive_limit_burst;
- handler_ctx[i].req_id = i+1;
- handler_ctx[i].accepted_requests = accepted_requests;
- handler_ctx[i].sent_requests = sent_requests;
- handler_ctx[i].handled_requests = handled_requests;
- handler_ctx[i].tb = tb;
-
- serf_connection_request_create(tb->connection,
- setup_request,
- &handler_ctx[i]);
+ create_new_request_with_resp_hdlr(tb, &handler_ctx[i], "GET", "/", i+1,
+ handle_response_keepalive_limit_burst);
serf_connection_set_max_outstanding_requests(tb->connection, 1);
}
@@ -855,9 +786,9 @@ static void test_keepalive_limit_one_by_one_and_burst(CuTest *tc)
}
/* Check that all requests were received */
- CuAssertIntEquals(tc, RCVD_REQUESTS, sent_requests->nelts);
- CuAssertIntEquals(tc, RCVD_REQUESTS, accepted_requests->nelts);
- CuAssertIntEquals(tc, RCVD_REQUESTS, handled_requests->nelts);
+ CuAssertIntEquals(tc, RCVD_REQUESTS, tb->sent_requests->nelts);
+ CuAssertIntEquals(tc, RCVD_REQUESTS, tb->accepted_requests->nelts);
+ CuAssertIntEquals(tc, RCVD_REQUESTS, tb->handled_requests->nelts);
/* Cleanup */
test_server_teardown(tb, test_pool);
@@ -866,7 +797,6 @@ static void test_keepalive_limit_one_by_one_and_burst(CuTest *tc)
#undef SEND_REQUESTS
#undef RCVD_REQUESTS
-#define NUM_REQUESTS 5
typedef struct {
apr_off_t read;
apr_off_t written;
@@ -896,10 +826,10 @@ static apr_status_t progress_conn_setup(apr_socket_t *skt,
static void test_serf_progress_callback(CuTest *tc)
{
test_baton_t *tb;
- apr_array_header_t *accepted_requests, *handled_requests, *sent_requests;
apr_status_t status;
- handler_baton_t handler_ctx[NUM_REQUESTS];
- int done = FALSE, i;
+ handler_baton_t handler_ctx[5];
+ const int num_requests = sizeof(handler_ctx)/sizeof(handler_ctx[0]);
+ int i;
progress_baton_t *pb;
test_server_message_t message_list[] = {
@@ -919,15 +849,11 @@ static void test_serf_progress_callback(CuTest *tc)
};
apr_pool_t *test_pool = test_setup();
-
- accepted_requests = apr_array_make(test_pool, NUM_REQUESTS, sizeof(int));
- sent_requests = apr_array_make(test_pool, NUM_REQUESTS, sizeof(int));
- handled_requests = apr_array_make(test_pool, NUM_REQUESTS, sizeof(int));
-
+
/* Set up a test context with a server. */
status = test_server_setup(&tb,
- message_list, 5,
- action_list, 5, 0,
+ message_list, num_requests,
+ action_list, num_requests, 0,
progress_conn_setup, test_pool);
CuAssertIntEquals(tc, APR_SUCCESS, status);
@@ -936,64 +862,384 @@ static void test_serf_progress_callback(CuTest *tc)
tb->user_baton = pb;
serf_context_set_progress_cb(tb->context, progress_cb, tb);
- for (i = 0 ; i < NUM_REQUESTS ; i++) {
- /* Send some requests on the connections */
- handler_ctx[i].method = "GET";
- handler_ctx[i].path = "/";
- handler_ctx[i].done = FALSE;
-
- handler_ctx[i].acceptor = accept_response;
- handler_ctx[i].acceptor_baton = NULL;
- handler_ctx[i].handler = handle_response;
- handler_ctx[i].req_id = i+1;
- handler_ctx[i].accepted_requests = accepted_requests;
- handler_ctx[i].sent_requests = sent_requests;
- handler_ctx[i].handled_requests = handled_requests;
- handler_ctx[i].tb = tb;
-
- serf_connection_request_create(tb->connection,
+ /* Send some requests on the connections */
+ for (i = 0 ; i < num_requests ; i++) {
+ create_new_request(tb, &handler_ctx[i], "GET", "/", i+1);
+ }
+
+ test_helper_run_requests_expect_ok(tc, tb, num_requests, handler_ctx,
+ test_pool);
+
+ /* Check that progress was reported. */
+ CuAssertTrue(tc, pb->written > 0);
+ CuAssertTrue(tc, pb->read > 0);
+
+ /* Cleanup */
+ test_server_teardown(tb, test_pool);
+ test_teardown(test_pool);
+}
+
+
+/*****************************************************************************
+ * Issue #91: test that serf correctly handle an incoming 4xx reponse while
+ * the outgoing request wasn't written completely yet.
+ *****************************************************************************/
+
+#define REQUEST_PART1 "PROPFIND / HTTP/1.1" CRLF\
+"Host: lgo-ubuntu.local" CRLF\
+"User-Agent: SVN/1.8.0-dev (x86_64-apple-darwin11.4.2) serf/2.0.0" CRLF\
+"Content-Type: text/xml" CRLF\
+"Transfer-Encoding: chunked" CRLF \
+CRLF\
+"12d" CRLF\
+"<?xml version=""1.0"" encoding=""utf-8""?><propfind xmlns=""DAV:""><prop>"
+
+#define REQUEST_PART2 \
+"<resourcetype xmlns=""DAV:""/><getcontentlength xmlns=""DAV:""/>"\
+"<deadprop-count xmlns=""http://subversion.tigris.org/xmlns/dav/""/>"\
+"<version-name xmlns=""DAV:""/><creationdate xmlns=""DAV:""/>"\
+"<creator-displayname xmlns=""DAV:""/></prop></propfind>" CRLF\
+"0" CRLF \
+CRLF
+
+#define RESPONSE_408 "HTTP/1.1 408 Request Time-out" CRLF\
+"Date: Wed, 14 Nov 2012 19:50:35 GMT" CRLF\
+"Server: Apache/2.2.17 (Ubuntu)" CRLF\
+"Vary: Accept-Encoding" CRLF\
+"Content-Length: 305" CRLF\
+"Connection: close" CRLF\
+"Content-Type: text/html; charset=iso-8859-1" CRLF \
+CRLF\
+"<!DOCTYPE HTML PUBLIC ""-//IETF//DTD HTML 2.0//EN""><html><head>"\
+"<title>408 Request Time-out</title></head><body><h1>Request Time-out</h1>"\
+"<p>Server timeout waiting for the HTTP request from the client.</p><hr>"\
+"<address>Apache/2.2.17 (Ubuntu) Server at lgo-ubuntu.local Port 80</address>"\
+"</body></html>"
+
+
+static apr_status_t detect_eof(void *baton, serf_bucket_t *aggregate_bucket)
+{
+ serf_bucket_t *body_bkt;
+ handler_baton_t *ctx = baton;
+
+ if (ctx->done) {
+ body_bkt = serf_bucket_simple_create(REQUEST_PART1, strlen(REQUEST_PART2),
+ NULL, NULL,
+ ctx->tb->bkt_alloc);
+ serf_bucket_aggregate_append(aggregate_bucket, body_bkt);
+ }
+
+ return APR_EAGAIN;
+}
+
+static apr_status_t setup_request_timeout(
+ serf_request_t *request,
+ void *setup_baton,
+ serf_bucket_t **req_bkt,
+ serf_response_acceptor_t *acceptor,
+ void **acceptor_baton,
+ serf_response_handler_t *handler,
+ void **handler_baton,
+ apr_pool_t *pool)
+{
+ handler_baton_t *ctx = setup_baton;
+ serf_bucket_t *body_bkt;
+
+ *req_bkt = serf__bucket_stream_create(serf_request_get_alloc(request),
+ detect_eof,
+ ctx);
+
+ /* create a simple body text */
+ body_bkt = serf_bucket_simple_create(REQUEST_PART1, strlen(REQUEST_PART1),
+ NULL, NULL,
+ serf_request_get_alloc(request));
+ serf_bucket_aggregate_append(*req_bkt, body_bkt);
+
+ APR_ARRAY_PUSH(ctx->sent_requests, int) = ctx->req_id;
+
+ *acceptor = ctx->acceptor;
+ *acceptor_baton = ctx;
+ *handler = ctx->handler;
+ *handler_baton = ctx;
+
+ return APR_SUCCESS;
+}
+
+static apr_status_t handle_response_timeout(
+ serf_request_t *request,
+ serf_bucket_t *response,
+ void *handler_baton,
+ apr_pool_t *pool)
+{
+ handler_baton_t *ctx = handler_baton;
+ serf_status_line sl;
+ apr_status_t status;
+
+ if (! response) {
+ serf_connection_request_create(ctx->tb->connection,
setup_request,
- &handler_ctx[i]);
+ ctx);
+ return APR_SUCCESS;
}
- while (1) {
- status = test_server_run(tb->serv_ctx, 0, test_pool);
- if (APR_STATUS_IS_TIMEUP(status))
- status = APR_SUCCESS;
- CuAssertIntEquals(tc, APR_SUCCESS, status);
+ if (serf_request_is_written(request) != APR_EBUSY) {
+ return APR_EGENERAL;
+ }
- status = serf_context_run(tb->context, 0, test_pool);
- if (APR_STATUS_IS_TIMEUP(status))
- status = APR_SUCCESS;
- CuAssertIntEquals(tc, APR_SUCCESS, status);
- /* Debugging purposes only! */
- serf_debug__closed_conn(tb->bkt_alloc);
+ status = serf_bucket_response_status(response, &sl);
+ if (SERF_BUCKET_READ_ERROR(status)) {
+ return status;
+ }
+ if (!sl.version && (APR_STATUS_IS_EOF(status) ||
+ APR_STATUS_IS_EAGAIN(status))) {
+ return status;
+ }
+ if (sl.code == 408) {
+ APR_ARRAY_PUSH(ctx->handled_requests, int) = ctx->req_id;
+ ctx->done = TRUE;
+ }
- done = TRUE;
- for (i = 0 ; i < NUM_REQUESTS ; i++)
- if (handler_ctx[i].done == FALSE) {
- done = FALSE;
- break;
- }
- if (done)
- break;
+ /* discard the rest of the body */
+ while (1) {
+ const char *data;
+ apr_size_t len;
+
+ status = serf_bucket_read(response, 2048, &data, &len);
+ if (SERF_BUCKET_READ_ERROR(status) ||
+ APR_STATUS_IS_EAGAIN(status) ||
+ APR_STATUS_IS_EOF(status))
+ return status;
}
- /* Check that all requests were received */
- CuAssertTrue(tc, sent_requests->nelts >= NUM_REQUESTS);
- CuAssertIntEquals(tc, NUM_REQUESTS, accepted_requests->nelts);
- CuAssertIntEquals(tc, NUM_REQUESTS, handled_requests->nelts);
+ return APR_SUCCESS;
+}
- /* Check that progress was reported. */
- CuAssertTrue(tc, pb->written > 0);
- CuAssertTrue(tc, pb->read > 0);
+static void test_serf_request_timeout(CuTest *tc)
+{
+ test_baton_t *tb;
+ apr_status_t status;
+ handler_baton_t handler_ctx[1];
+ const int num_requests = sizeof(handler_ctx)/sizeof(handler_ctx[0]);
+
+ test_server_message_t message_list[] = {
+ {REQUEST_PART1},
+ {REQUEST_PART2},
+ };
+
+ test_server_action_t action_list[] = {
+ {SERVER_RESPOND, RESPONSE_408},
+ };
+
+ apr_pool_t *test_pool = test_setup();
+
+ /* Set up a test context with a server. */
+ status = test_server_setup(&tb,
+ message_list, 2,
+ action_list, 1, 0,
+ NULL, test_pool);
+ CuAssertIntEquals(tc, APR_SUCCESS, status);
+
+ /* Send some requests on the connection */
+ handler_ctx[0].method = "PROPFIND";
+ handler_ctx[0].path = "/";
+ handler_ctx[0].done = FALSE;
+
+ handler_ctx[0].acceptor = accept_response;
+ handler_ctx[0].acceptor_baton = NULL;
+ handler_ctx[0].handler = handle_response_timeout;
+ handler_ctx[0].req_id = 1;
+ handler_ctx[0].accepted_requests = tb->accepted_requests;
+ handler_ctx[0].sent_requests = tb->sent_requests;
+ handler_ctx[0].handled_requests = tb->handled_requests;
+ handler_ctx[0].tb = tb;
+
+ serf_connection_request_create(tb->connection,
+ setup_request_timeout,
+ &handler_ctx[0]);
+
+ test_helper_run_requests_expect_ok(tc, tb, num_requests, handler_ctx,
+ test_pool);
/* Cleanup */
test_server_teardown(tb, test_pool);
test_teardown(test_pool);
}
-#undef NUM_REQUESTS
+
+static apr_status_t
+ssl_server_cert_cb_expect_failures(void *baton, int failures,
+ const serf_ssl_certificate_t *cert)
+{
+ /* We expect an error from the certificate validation function. */
+ if (failures)
+ return APR_SUCCESS;
+ else
+ return APR_EGENERAL;
+}
+
+static apr_status_t
+ssl_server_cert_cb_expect_allok(void *baton, int failures,
+ const serf_ssl_certificate_t *cert)
+{
+ /* No error expected, certificate is valid. */
+ if (failures)
+ return APR_EGENERAL;
+ else
+ return APR_SUCCESS;
+}
+
+/* Validate that we can connect successfully to an https server. */
+static void test_serf_ssl_handshake(CuTest *tc)
+{
+ test_baton_t *tb;
+ handler_baton_t handler_ctx[1];
+ const int num_requests = sizeof(handler_ctx)/sizeof(handler_ctx[0]);
+ apr_status_t status;
+ test_server_message_t message_list[] = {
+ {CHUNKED_REQUEST(1, "1")},
+ };
+
+ test_server_action_t action_list[] = {
+ {SERVER_RESPOND, CHUNKED_EMPTY_RESPONSE},
+ };
+
+
+ /* Set up a test context with a server */
+ apr_pool_t *test_pool = test_setup();
+ status = test_https_server_setup(&tb,
+ message_list, num_requests,
+ action_list, num_requests, 0,
+ NULL, /* default conn setup */
+ "test/server/serfserverkey.pem",
+ "test/server/serfservercert.pem",
+ ssl_server_cert_cb_expect_failures,
+ test_pool);
+ CuAssertIntEquals(tc, APR_SUCCESS, status);
+
+ create_new_request(tb, &handler_ctx[0], "GET", "/", 1);
+
+ test_helper_run_requests_expect_ok(tc, tb, num_requests, handler_ctx,
+ test_pool);
+
+ test_server_teardown(tb, test_pool);
+ test_teardown(test_pool);
+}
+
+static apr_status_t
+https_set_root_ca_conn_setup(apr_socket_t *skt,
+ serf_bucket_t **input_bkt,
+ serf_bucket_t **output_bkt,
+ void *setup_baton,
+ apr_pool_t *pool)
+{
+ serf_ssl_certificate_t *cacert, *rootcacert;
+ test_baton_t *tb = setup_baton;
+ apr_status_t status;
+
+ status = default_https_conn_setup(skt, input_bkt, output_bkt,
+ setup_baton, pool);
+ if (status)
+ return status;
+
+ status = serf_ssl_load_cert_file(&cacert, "test/server/serfcacert.pem",
+ pool);
+ if (status)
+ return status;
+ status = serf_ssl_trust_cert(tb->ssl_context, cacert);
+ if (status)
+ return status;
+
+ status = serf_ssl_load_cert_file(&rootcacert,
+ "test/server/serfrootcacert.pem",
+ pool);
+ if (status)
+ return status;
+ status = serf_ssl_trust_cert(tb->ssl_context, rootcacert);
+ if (status)
+ return status;
+
+ return status;
+}
+
+/* Validate that server certificate validation is ok when we
+ explicitly trust our self-signed root ca. */
+static void test_serf_ssl_trust_rootca(CuTest *tc)
+{
+ test_baton_t *tb;
+ handler_baton_t handler_ctx[1];
+ const int num_requests = sizeof(handler_ctx)/sizeof(handler_ctx[0]);
+ apr_status_t status;
+ test_server_message_t message_list[] = {
+ {CHUNKED_REQUEST(1, "1")},
+ };
+
+ test_server_action_t action_list[] = {
+ {SERVER_RESPOND, CHUNKED_EMPTY_RESPONSE},
+ };
+
+ /* Set up a test context with a server */
+ apr_pool_t *test_pool = test_setup();
+ status = test_https_server_setup(&tb,
+ message_list, num_requests,
+ action_list, num_requests, 0,
+ https_set_root_ca_conn_setup,
+ "test/server/serfserverkey.pem",
+ "test/server/serfservercert.pem",
+ ssl_server_cert_cb_expect_allok,
+ test_pool);
+ CuAssertIntEquals(tc, APR_SUCCESS, status);
+
+ create_new_request(tb, &handler_ctx[0], "GET", "/", 1);
+
+ test_helper_run_requests_expect_ok(tc, tb, num_requests, handler_ctx,
+ test_pool);
+
+ test_server_teardown(tb, test_pool);
+ test_teardown(test_pool);
+}
+
+/* Validate that when the application rejects the cert, the context loop
+ bails out with an error. */
+static void test_serf_ssl_application_rejects_cert(CuTest *tc)
+{
+ test_baton_t *tb;
+ handler_baton_t handler_ctx[1];
+ const int num_requests = sizeof(handler_ctx)/sizeof(handler_ctx[0]);
+ apr_status_t status;
+ test_server_message_t message_list[] = {
+ {CHUNKED_REQUEST(1, "1")},
+ };
+
+ test_server_action_t action_list[] = {
+ {SERVER_RESPOND, CHUNKED_EMPTY_RESPONSE},
+ };
+
+ /* Set up a test context with a server */
+ apr_pool_t *test_pool = test_setup();
+
+ /* The certificate is valid, but we tell serf to reject it by using the
+ ssl_server_cert_cb_expect_failures callback. */
+ status = test_https_server_setup(&tb,
+ message_list, num_requests,
+ action_list, num_requests, 0,
+ https_set_root_ca_conn_setup,
+ "test/server/serfserverkey.pem",
+ "test/server/serfservercert.pem",
+ ssl_server_cert_cb_expect_failures,
+ test_pool);
+ CuAssertIntEquals(tc, APR_SUCCESS, status);
+
+ create_new_request(tb, &handler_ctx[0], "GET", "/", 1);
+
+ status = test_helper_run_requests_no_check(tc, tb, num_requests,
+ handler_ctx, test_pool);
+ /* We expect an error from the certificate validation function. */
+ CuAssert(tc, "Application told serf the certificate should be rejected,"
+ " expected error!", status != APR_SUCCESS);
+
+ test_server_teardown(tb, test_pool);
+ test_teardown(test_pool);
+}
CuSuite *test_context(void)
{
@@ -1006,6 +1252,10 @@ CuSuite *test_context(void)
SUITE_ADD_TEST(suite, test_keepalive_limit_one_by_one);
SUITE_ADD_TEST(suite, test_keepalive_limit_one_by_one_and_burst);
SUITE_ADD_TEST(suite, test_serf_progress_callback);
+ SUITE_ADD_TEST(suite, test_serf_request_timeout);
+ SUITE_ADD_TEST(suite, test_serf_ssl_handshake);
+ SUITE_ADD_TEST(suite, test_serf_ssl_trust_rootca);
+ SUITE_ADD_TEST(suite, test_serf_ssl_application_rejects_cert);
return suite;
}
diff --git a/test/test_serf.h b/test/test_serf.h
index 454dfcc..6c0f5e7 100644
--- a/test/test_serf.h
+++ b/test/test_serf.h
@@ -93,8 +93,30 @@ typedef struct {
/* An extra baton which can be freely used by tests. */
void *user_baton;
+ apr_array_header_t *accepted_requests, *handled_requests, *sent_requests;
+
+ serf_ssl_context_t *ssl_context;
+ serf_ssl_need_server_cert_t server_cert_cb;
} test_baton_t;
+apr_status_t default_https_conn_setup(apr_socket_t *skt,
+ serf_bucket_t **input_bkt,
+ serf_bucket_t **output_bkt,
+ void *setup_baton,
+ apr_pool_t *pool);
+
+apr_status_t test_https_server_setup(test_baton_t **tb_p,
+ test_server_message_t *message_list,
+ apr_size_t message_count,
+ test_server_action_t *action_list,
+ apr_size_t action_count,
+ apr_int32_t options,
+ serf_connection_setup_t conn_setup,
+ const char *keyfile,
+ const char *certfile,
+ serf_ssl_need_server_cert_t server_cert_cb,
+ apr_pool_t *pool);
+
apr_status_t test_server_setup(test_baton_t **tb_p,
test_server_message_t *message_list,
apr_size_t message_count,
diff --git a/test/test_ssl.c b/test/test_ssl.c
index 81b939d..43e9f9a 100644
--- a/test/test_ssl.c
+++ b/test/test_ssl.c
@@ -55,14 +55,28 @@ static void test_ssl_init(CuTest *tc)
test_teardown(test_pool);
}
+
+static const char * get_ca_file(apr_pool_t *pool, const char * file)
+{
+ char *srcdir = "";
+
+ if (apr_env_get(&srcdir, "srcdir", pool) == APR_SUCCESS) {
+ return apr_pstrcat(pool, srcdir, "/", file, NULL);
+ }
+ else {
+ return file;
+ }
+}
+
+
/* Test that loading a custom CA certificate file works. */
static void test_ssl_load_cert_file(CuTest *tc)
{
serf_ssl_certificate_t *cert = NULL;
apr_pool_t *test_pool = test_setup();
- apr_status_t status = serf_ssl_load_cert_file(&cert, "test/serftestca.pem",
- test_pool);
+ apr_status_t status = serf_ssl_load_cert_file(
+ &cert, get_ca_file(test_pool, "test/serftestca.pem"), test_pool);
CuAssertIntEquals(tc, APR_SUCCESS, status);
CuAssertPtrNotNull(tc, cert);
@@ -78,7 +92,8 @@ static void test_ssl_cert_subject(CuTest *tc)
apr_pool_t *test_pool = test_setup();
- status = serf_ssl_load_cert_file(&cert, "test/serftestca.pem", test_pool);
+ status = serf_ssl_load_cert_file(
+ &cert, get_ca_file(test_pool, "test/serftestca.pem"), test_pool);
CuAssertIntEquals(tc, APR_SUCCESS, status);
CuAssertPtrNotNull(tc, cert);
diff --git a/test/test_util.c b/test/test_util.c
index 9496195..e99fb79 100644
--- a/test/test_util.c
+++ b/test/test_util.c
@@ -27,7 +27,8 @@
/* Server setup function(s)
*/
-#define SERV_URL "http://localhost:" SERV_PORT_STR
+#define HTTP_SERV_URL "http://localhost:" SERV_PORT_STR
+#define HTTPS_SERV_URL "https://localhost:" SERV_PORT_STR
static apr_status_t default_server_address(apr_sockaddr_t **address,
apr_pool_t *pool)
@@ -57,22 +58,51 @@ static void default_closed_connection(serf_connection_t *conn,
}
/* Default implementation of a serf_connection_setup_t callback. */
-static apr_status_t default_conn_setup(apr_socket_t *skt,
- serf_bucket_t **input_bkt,
- serf_bucket_t **output_bkt,
- void *setup_baton,
- apr_pool_t *pool)
+static apr_status_t default_http_conn_setup(apr_socket_t *skt,
+ serf_bucket_t **input_bkt,
+ serf_bucket_t **output_bkt,
+ void *setup_baton,
+ apr_pool_t *pool)
{
- test_baton_t *ctx = setup_baton;
+ test_baton_t *tb = setup_baton;
- *input_bkt = serf_bucket_socket_create(skt, ctx->bkt_alloc);
+ *input_bkt = serf_bucket_socket_create(skt, tb->bkt_alloc);
return APR_SUCCESS;
}
+/* This function makes serf use SSL on the connection. */
+apr_status_t default_https_conn_setup(apr_socket_t *skt,
+ serf_bucket_t **input_bkt,
+ serf_bucket_t **output_bkt,
+ void *setup_baton,
+ apr_pool_t *pool)
+{
+ test_baton_t *tb = setup_baton;
+
+ *input_bkt = serf_bucket_socket_create(skt, tb->bkt_alloc);
+ *input_bkt = serf_bucket_ssl_decrypt_create(*input_bkt, NULL,
+ tb->bkt_alloc);
+ tb->ssl_context = serf_bucket_ssl_encrypt_context_get(*input_bkt);
+
+ if (output_bkt) {
+ *output_bkt = serf_bucket_ssl_encrypt_create(*output_bkt,
+ tb->ssl_context,
+ tb->bkt_alloc);
+ }
+
+ if (tb->server_cert_cb)
+ serf_ssl_server_cert_callback_set(tb->ssl_context,
+ tb->server_cert_cb,
+ tb);
+
+ return APR_SUCCESS;
+}
static apr_status_t setup(test_baton_t **tb_p,
serf_connection_setup_t conn_setup,
+ const char *serv_url,
int use_proxy,
+ apr_size_t message_count,
apr_pool_t *pool)
{
apr_status_t status;
@@ -86,6 +116,11 @@ static apr_status_t setup(test_baton_t **tb_p,
tb->context = serf_context_create(pool);
tb->bkt_alloc = serf_bucket_allocator_create(pool, NULL, NULL);
+ tb->accepted_requests = apr_array_make(pool, message_count, sizeof(int));
+ tb->sent_requests = apr_array_make(pool, message_count, sizeof(int));
+ tb->handled_requests = apr_array_make(pool, message_count, sizeof(int));
+
+
status = default_server_address(&tb->serv_addr, pool);
if (status != APR_SUCCESS)
return status;
@@ -99,14 +134,13 @@ static apr_status_t setup(test_baton_t **tb_p,
serf_config_proxy(tb->context, tb->proxy_addr);
}
- status = apr_uri_parse(pool, SERV_URL, &url);
+ status = apr_uri_parse(pool, serv_url, &url);
if (status != APR_SUCCESS)
return status;
status = serf_connection_create2(&tb->connection, tb->context,
url,
- conn_setup ? conn_setup :
- default_conn_setup,
+ conn_setup,
tb,
default_closed_connection,
tb,
@@ -116,6 +150,43 @@ static apr_status_t setup(test_baton_t **tb_p,
}
+apr_status_t test_https_server_setup(test_baton_t **tb_p,
+ test_server_message_t *message_list,
+ apr_size_t message_count,
+ test_server_action_t *action_list,
+ apr_size_t action_count,
+ apr_int32_t options,
+ serf_connection_setup_t conn_setup,
+ const char *keyfile,
+ const char *certfile,
+ serf_ssl_need_server_cert_t server_cert_cb,
+ apr_pool_t *pool)
+{
+ apr_status_t status;
+ test_baton_t *tb;
+
+ status = setup(tb_p,
+ conn_setup ? conn_setup : default_https_conn_setup,
+ HTTPS_SERV_URL,
+ FALSE,
+ message_count,
+ pool);
+ if (status != APR_SUCCESS)
+ return status;
+
+ tb = *tb_p;
+ tb->server_cert_cb = server_cert_cb;
+
+ /* Prepare a server. */
+ test_setup_https_server(&tb->serv_ctx, tb->serv_addr,
+ message_list, message_count,
+ action_list, action_count, options,
+ keyfile, certfile,
+ pool);
+ status = test_start_server(tb->serv_ctx);
+
+ return status;
+}
apr_status_t test_server_setup(test_baton_t **tb_p,
test_server_message_t *message_list,
@@ -130,8 +201,10 @@ apr_status_t test_server_setup(test_baton_t **tb_p,
test_baton_t *tb;
status = setup(tb_p,
- conn_setup,
+ conn_setup ? conn_setup : default_http_conn_setup,
+ HTTP_SERV_URL,
FALSE,
+ message_count,
pool);
if (status != APR_SUCCESS)
return status;
@@ -139,9 +212,11 @@ apr_status_t test_server_setup(test_baton_t **tb_p,
tb = *tb_p;
/* Prepare a server. */
- status = test_start_server(&tb->serv_ctx, tb->serv_addr,
- message_list, message_count,
- action_list, action_count, options, pool);
+ test_setup_server(&tb->serv_ctx, tb->serv_addr,
+ message_list, message_count,
+ action_list, action_count, options,
+ pool);
+ status = test_start_server(tb->serv_ctx);
return status;
}
@@ -164,8 +239,10 @@ test_server_proxy_setup(test_baton_t **tb_p,
test_baton_t *tb;
status = setup(tb_p,
- conn_setup,
+ conn_setup ? conn_setup : default_http_conn_setup,
+ HTTP_SERV_URL,
TRUE,
+ serv_message_count,
pool);
if (status != APR_SUCCESS)
return status;
@@ -173,18 +250,22 @@ test_server_proxy_setup(test_baton_t **tb_p,
tb = *tb_p;
/* Prepare the server. */
- status = test_start_server(&tb->serv_ctx, tb->serv_addr,
- serv_message_list, serv_message_count,
- serv_action_list, serv_action_count,
- options, pool);
+ test_setup_server(&tb->serv_ctx, tb->serv_addr,
+ serv_message_list, serv_message_count,
+ serv_action_list, serv_action_count,
+ options,
+ pool);
+ status = test_start_server(tb->serv_ctx);
if (status != APR_SUCCESS)
return status;
/* Prepare the proxy. */
- status = test_start_server(&tb->proxy_ctx, tb->proxy_addr,
- proxy_message_list, proxy_message_count,
- proxy_action_list, proxy_action_count,
- options, pool);
+ test_setup_server(&tb->proxy_ctx, tb->proxy_addr,
+ proxy_message_list, proxy_message_count,
+ proxy_action_list, proxy_action_count,
+ options,
+ pool);
+ status = test_start_server(tb->proxy_ctx);
return status;
}