CORE_LIBS="$CORE_LIBS $OPENSSL/.openssl/lib/libssl.a"
CORE_LIBS="$CORE_LIBS $OPENSSL/.openssl/lib/libcrypto.a"
CORE_LIBS="$CORE_LIBS $NGX_LIBDL"
+
+ if [ "$NGX_PLATFORM" = win32 ]; then
+ CORE_LIBS="$CORE_LIBS -lgdi32 -lcrypt32 -lws2_32"
+ fi
;;
esac
*)
have=NGX_PCRE . auto/have
+
+ if [ "$NGX_PLATFORM" = win32 ]; then
+ have=PCRE_STATIC . auto/have
+ fi
+
CORE_DEPS="$CORE_DEPS $PCRE/pcre.h"
LINK_DEPS="$LINK_DEPS $PCRE/.libs/libpcre.a"
CORE_LIBS="$CORE_LIBS $PCRE/.libs/libpcre.a"
ngx_pcre=`echo \-DPCRE=\"$PCRE\" | sed -e "s/\//$ngx_regex_dirsep/g"`
;;
-esac
+ *)
+ ngx_makefile=
+ ;;
+esac
-case "$NGX_PLATFORM" in
- win32)
+if [ -n "$ngx_makefile" ]; then
- cat << END >> $NGX_MAKEFILE
+ cat << END >> $NGX_MAKEFILE
`echo "$PCRE/pcre.lib: $PCRE/pcre.h $NGX_MAKEFILE" \
| sed -e "s/\//$ngx_regex_dirsep/g"`
END
- ;;
+else
- *)
- cat << END >> $NGX_MAKEFILE
+ cat << END >> $NGX_MAKEFILE
$PCRE/pcre.h: $PCRE/Makefile
END
- ;;
-
-esac
+fi
ngx_zlib=`echo \-DZLIB=\"$ZLIB\" | sed -e "s/\//$ngx_regex_dirsep/g"`
;;
+ *)
+ ngx_makefile=
+ ;;
+
esac
case "$NGX_PLATFORM" in
win32)
- cat << END >> $NGX_MAKEFILE
+
+ if [ -n "$ngx_makefile" ]; then
+ cat << END >> $NGX_MAKEFILE
`echo "$ZLIB/zlib.lib: $NGX_MAKEFILE" | sed -e "s/\//$ngx_regex_dirsep/g"`
\$(MAKE) -f auto/lib/zlib/$ngx_makefile $ngx_opt $ngx_zlib
END
+ else
+
+ cat << END >> $NGX_MAKEFILE
+
+$ZLIB/libz.a: $NGX_MAKEFILE
+ cd $ZLIB \\
+ && \$(MAKE) distclean \\
+ && \$(MAKE) -f win32/Makefile.gcc \\
+ CFLAGS="$ZLIB_OPT" CC="\$(CC)" \\
+ libz.a
+
+END
+
+ fi
+
done=YES
;;
CORE_DEPS="$WIN32_DEPS"
CORE_SRCS="$WIN32_SRCS $IOCP_SRCS"
OS_CONFIG="$WIN32_CONFIG"
-CORE_LIBS="$CORE_LIBS advapi32.lib ws2_32.lib"
NGX_ICONS="$NGX_WIN32_ICONS"
SELECT_SRCS=$WIN32_SELECT_SRCS
+case "$NGX_CC_NAME" in
+
+ gcc)
+ CORE_LIBS="$CORE_LIBS -ladvapi32 -lws2_32"
+ ;;
+
+ *)
+ CORE_LIBS="$CORE_LIBS advapi32.lib ws2_32.lib"
+ ;;
+
+esac
+
EVENT_MODULES="$EVENT_MODULES $IOCP_MODULE"
EVENT_FOUND=YES
continue;
}
- if (ls[i].fd != -1) {
+ if (ls[i].fd != (ngx_socket_t) -1) {
continue;
}
s = ngx_socket(ls[i].sockaddr->sa_family, ls[i].type, 0);
- if (s == -1) {
+ if (s == (ngx_socket_t) -1) {
ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno,
ngx_socket_n " %V failed", &ls[i].addr_text);
return NGX_ERROR;
ngx_uint_t log_error, level;
ngx_socket_t fd;
- if (c->fd == -1) {
+ if (c->fd == (ngx_socket_t) -1) {
ngx_log_error(NGX_LOG_ALERT, c->log, 0, "connection already closed");
return;
}
}
}
- if (nls[n].fd == -1) {
+ if (nls[n].fd == (ngx_socket_t) -1) {
nls[n].open = 1;
}
}
ls = old_cycle->listening.elts;
for (i = 0; i < old_cycle->listening.nelts; i++) {
- if (ls[i].remain || ls[i].fd == -1) {
+ if (ls[i].remain || ls[i].fd == (ngx_socket_t) -1) {
continue;
}
ls = cycle->listening.elts;
for (i = 0; i < cycle->listening.nelts; i++) {
- if (ls[i].fd == -1 || !ls[i].open) {
+ if (ls[i].fd == (ngx_socket_t) -1 || !ls[i].open) {
continue;
}
ngx_log_debug1(NGX_LOG_DEBUG_EVENT, &uc->log, 0, "UDP socket %d", s);
- if (s == -1) {
+ if (s == (ngx_socket_t) -1) {
ngx_log_error(NGX_LOG_ALERT, &uc->log, ngx_socket_errno,
ngx_socket_n " failed");
return NGX_ERROR;
#endif
}
-#ifdef __WATCOMC__
+#if defined(__WATCOMC__) || defined(__GNUC__)
return 0;
#endif
}
return NGX_ERROR;
}
- if ((event == NGX_READ_EVENT) && (max_read >= FD_SETSIZE)
- || (event == NGX_WRITE_EVENT) && (max_write >= FD_SETSIZE))
+ if ((event == NGX_READ_EVENT && max_read >= FD_SETSIZE)
+ || (event == NGX_WRITE_EVENT && max_write >= FD_SETSIZE))
{
ngx_log_error(NGX_LOG_ERR, ev->log, 0,
"maximum number of descriptors "
s = accept(lc->fd, (struct sockaddr *) sa, &socklen);
#endif
- if (s == -1) {
+ if (s == (ngx_socket_t) -1) {
err = ngx_socket_errno;
if (err == NGX_EAGAIN) {
ngx_log_debug1(NGX_LOG_DEBUG_EVENT, &ls->log, 0,
ngx_socket_n " s:%d", s);
- if (s == -1) {
+ if (s == (ngx_socket_t) -1) {
ngx_log_error(NGX_LOG_ALERT, &ls->log, ngx_socket_errno,
ngx_socket_n " failed");
ngx_log_debug1(NGX_LOG_DEBUG_EVENT, pc->log, 0, "socket %d", s);
- if (s == -1) {
+ if (s == (ngx_socket_t) -1) {
ngx_log_error(NGX_LOG_ALERT, pc->log, ngx_socket_errno,
ngx_socket_n " failed");
return NGX_ERROR;
do_write = 1;
}
- if (p->upstream->fd != -1) {
+ if (p->upstream->fd != (ngx_socket_t) -1) {
rev = p->upstream->read;
flags = (rev->eof || rev->error) ? NGX_CLOSE_EVENT : 0;
}
}
- if (p->downstream->fd != -1 && p->downstream->data == p->output_ctx) {
+ if (p->downstream->fd != (ngx_socket_t) -1
+ && p->downstream->data == p->output_ctx)
+ {
wev = p->downstream->write;
if (ngx_handle_write_event(wev, p->send_lowat) != NGX_OK) {
return NGX_ABORT;
#define NGX_ATOMIC_T_LEN (sizeof("-2147483648") - 1)
-#if defined( __WATCOMC__ ) || defined( __BORLANDC__ ) || ( _MSC_VER >= 1300 )
+#if defined( __WATCOMC__ ) || defined( __BORLANDC__ ) || defined(__GNUC__) \
+ || ( _MSC_VER >= 1300 )
/* the new SDK headers */
/* THREAD: lock */
- if (c[i].fd != -1 && c[i].idle) {
+ if (c[i].fd != (ngx_socket_t) -1 && c[i].idle) {
c[i].close = 1;
c[i].read->handler(c[i].read);
}
if (ngx_exiting) {
c = cycle->connections;
for (i = 0; i < cycle->connection_n; i++) {
- if (c[i].fd != -1
+ if (c[i].fd != (ngx_socket_t) -1
&& c[i].read
&& !c[i].read->accept
&& !c[i].read->channel
#define _NGX_WIN32_CONFIG_H_INCLUDED_
+#undef WIN32
#define WIN32 0x0400
#define _WIN32_WINNT 0x0501
#include <mswsock.h>
#include <shellapi.h>
#include <stddef.h> /* offsetof() */
+
+#ifdef __GNUC__
+/* GCC MinGW's stdio.h includes sys/types.h */
+#define _OFF_T_
+#endif
+
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
*/
s = ngx_socket(AF_INET, SOCK_STREAM, IPPROTO_IP);
- if (s == -1) {
+ if (s == (ngx_socket_t) -1) {
ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno,
ngx_socket_n " falied");
return NGX_ERROR;
u_long bytes, flags;
WSABUF wsabuf[1];
ngx_err_t err;
- ngx_uint_t n;
+ ngx_int_t n;
ngx_event_t *rev;
wsabuf[0].buf = (char *) buf;
u_long bytes, flags;
WSABUF wsabuf[1];
ngx_err_t err;
- ngx_uint_t n;
+ ngx_int_t n;
ngx_event_t *rev;
LPWSAOVERLAPPED ovlp;