[BUILD] add support for build under Cygwin

After considering various possibilities, we compiled haproxy under cygwin.
Attached is an updated full diff that also has the TARGET=cygwin documented.
The whole thing compiles and installs with this diff only.

In cygwin 1.7 (now in beta), there is apparently support for ipv6.  Cygwin
1.5 (later versions, anyway) already includes some support in the form of a
define USE_IPV6.  When defined, it declares the sockaddr_in6 struct and
possibly other things.  The above definition AF_INET6=23 is taken from
their /usr/include/socket.h file (where it is #if 0'd out).

We are running into a socket limit.  It appears that Cygwin (running on
Windows 2003 Server) will only allow us to set ulimit -n (maximum open
files) to 3200, which means we're a little short of 1600 connections.

The limit of 3200 is an internal Cygwin limit.  Perhaps they can raise it in
the future.  Using the nbproc option, I was able to bring up 10 servers.  It
seems to me that they were able to handle over 2000 connections (even though
each had maxconn 1500 set, and the hard Cygwin fd limit).
This commit is contained in:
Yitzhak Sapir 2009-06-14 18:27:54 +02:00 committed by Willy Tarreau
parent d88edf2e52
commit 32087312e3
2 changed files with 11 additions and 2 deletions

View File

@ -70,7 +70,7 @@ DOCDIR = $(PREFIX)/doc/haproxy
# Use TARGET=<target_name> to optimize for a specifc target OS among the
# following list (use the default "generic" if uncertain) :
# generic, linux22, linux24, linux24e, linux26, solaris,
# freebsd, openbsd, custom
# freebsd, openbsd, cygwin, custom
TARGET =
#### TARGET CPU
@ -217,6 +217,14 @@ ifeq ($(TARGET),openbsd)
USE_POLL = implicit
USE_KQUEUE = implicit
USE_TPROXY = implicit
else
ifeq ($(TARGET),cygwin)
# This is for Cygwin
# Cygwin adds IPv6 support only in version 1.7 (in beta right now).
USE_POLL = implicit
USE_TPROXY = implicit
TARGET_CFLAGS = $(if $(filter 1.5.%, $(shell uname -r)), -DUSE_IPV6 -DAF_INET6=23 -DINET6_ADDRSTRLEN=46, )
endif # cygwin
endif # openbsd
endif # freebsd
endif # solaris
@ -440,7 +448,7 @@ all:
@echo "Please choose the target among the following supported list :"
@echo
@echo " linux26, linux24, linux24e, linux22, solaris"
@echo " freebsd, openbsd, custom, generic"
@echo " freebsd, openbsd, cygwin, custom, generic"
@echo
@echo "Use \"generic\" if you don't want any optimization, \"custom\" if you"
@echo "want to precisely tweak every option, or choose the target which"

1
README
View File

@ -26,6 +26,7 @@ and assign it to the TARGET variable :
- solaris for Solaris 8 or 10 (others untested)
- freebsd for FreeBSD 5 to 6.2 (others untested)
- openbsd for OpenBSD 3.1 to 3.7 (others untested)
- cygwin for Cygwin
- generic for any other OS.
- custom to manually adjust every setting