[MEDIUM] Added easier support for Doug Lea's malloc (dlmalloc)

It's now as easy as passing "DLMALLOC_SRC=<path_to_dlmalloc.c>" to
build with support for dlmalloc. The dlmalloc source is not provided
with haproxy in order to ensure that people will use either the most
recent, or the most suited version for their platform. The minimal
mmap size is specified in DLMALLOC_THRES, which defaults to 4096. It
should be increased on platforms with larger pages (eg: 8 kB on some
64 bit systems).
diff --git a/Makefile b/Makefile
index 39fa4d5..c5c262e 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,10 @@
 # This makefile supports different OS and CPU setups.
 # You should use it this way :
 #   make TARGET=os CPU=cpu REGEX=lib
-
+#
+# Some external components may be build with it, such dlmalloc :
+#
+#   make DLMALLOC_SRC=/usr/local/src/dlmalloc.c
 
 # Select target OS. TARGET must match a system for which COPTS and LIBS are
 # correctly defined below.
@@ -180,6 +183,12 @@
 OPTIONS += -DCONFIG_HAP_USE_REGPARM
 endif
 
+ifneq ($(DLMALLOC_SRC),)
+# May be changed to patch PAGE_SIZE on every platform
+DLMALLOC_THRES=4096
+OPT_OBJS += src/dlmalloc.o
+endif
+
 ifneq ($(VERSION),)
 OPTIONS += -DCONFIG_HAPROXY_VERSION=\"$(VERSION)$(SUBVERS)\"
 endif
@@ -228,6 +237,9 @@
 %.o:	%.c
 	$(CC) $(CFLAGS) -c -o $@ $<
 
+src/dlmalloc.o: $(DLMALLOC_SRC)
+	$(CC) $(CFLAGS) -DDEFAULT_MMAP_THRESHOLD=$(DLMALLOC_THRES) -c -o $@ $<
+
 clean:
 	rm -f *.[oas] src/*.[oas] core haproxy test
 	for dir in . src include/* doc; do rm -f $$dir/*~ $$dir/*.rej;done