]> git.kaiwu.me - haproxy.git/commitdiff
BUILD: makefile: add an option to enable or disable HTTP/2 (USE_H2)
authorWilly Tarreau <w@1wt.eu>
Thu, 21 May 2026 12:30:26 +0000 (14:30 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 3 Jul 2026 14:33:27 +0000 (16:33 +0200)
USE_H2 is enabled by default and allows to disable HTTP/2 when forced to
zero. It saves roughly 127kB on the executable.

Makefile

index e102821a8153dc207e90d2984a4e3d3679db4b47..9eb9aaaf682a8b21db0a9acb58823e6452df84b9 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -65,6 +65,7 @@
 #   USE_PTHREAD_EMULATION   : replace pthread's rwlocks with ours
 #   USE_SHM_OPEN            : use shm_open() for features that can make use of shared memory
 #   USE_KTLS                : use kTLS.(requires at least Linux 4.17).
+#   USE_H2                  : enable HTTP/2 subsystem. Always on.
 #
 # Options can be forced by specifying "USE_xxx=1" or can be disabled by using
 # "USE_xxx=" (empty string). The list of enabled and disabled options for a
@@ -338,7 +339,7 @@ use_opts = USE_EPOLL USE_KQUEUE USE_NETFILTER USE_POLL                        \
            USE_TPROXY USE_LINUX_TPROXY USE_LINUX_CAP                          \
            USE_LINUX_SPLICE USE_LIBCRYPT USE_CRYPT_H USE_ENGINE               \
            USE_GETADDRINFO USE_OPENSSL USE_OPENSSL_WOLFSSL USE_OPENSSL_AWSLC  \
-           USE_ECH USE_TRACE                                                  \
+           USE_ECH USE_TRACE USE_H2                                           \
            USE_SSL USE_LUA USE_ACCEPT4 USE_CLOSEFROM USE_ZLIB USE_SLZ         \
            USE_CPU_AFFINITY USE_TFO USE_NS USE_DL USE_RT USE_LIBATOMIC        \
            USE_MATH USE_DEVICEATLAS USE_51DEGREES                             \
@@ -364,6 +365,9 @@ USE_POLL   = default
 # traces are always enabled
 USE_TRACE  = default
 
+# HTTP/2 is always enabled
+USE_H2 = default
+
 # SLZ is always supported unless explicitly disabled by passing USE_SLZ=""
 # or disabled by enabling ZLIB using USE_ZLIB=1
 ifeq ($(USE_ZLIB:0=),)
@@ -567,6 +571,10 @@ ifneq ($(USE_ZLIB:0=),)
   ZLIB_LDFLAGS     = $(if $(ZLIB_LIB),-L$(ZLIB_LIB)) -lz
 endif
 
+ifneq ($(USE_H2:0=),)
+  OPTIONS_OBJS   += src/mux_h2.o src/h2.o
+endif
+
 ifneq ($(USE_SLZ:0=),)
   OPTIONS_OBJS   += src/slz.o
 endif
@@ -911,7 +919,7 @@ ifneq ($(EXTRA_OBJS),)
   OBJS += $(EXTRA_OBJS)
 endif
 
-OBJS += src/mux_h2.o src/mux_h1.o src/mux_fcgi.o src/log.o             \
+OBJS += src/mux_h1.o src/mux_fcgi.o src/log.o                          \
         src/server.o src/stream.o src/tcpcheck.o src/http_ana.o                \
         src/stick_table.o src/tools.o src/mux_spop.o src/sample.o      \
         src/activity.o src/cfgparse.o src/peers.o src/cli.o            \
@@ -929,7 +937,7 @@ OBJS += src/mux_h2.o src/mux_h1.o src/mux_fcgi.o src/log.o          \
         src/ceba_tree.o src/session.o src/payload.o src/htx.o          \
         src/cebl_tree.o src/ceb32_tree.o src/ceb64_tree.o              \
         src/server_state.o src/proto_rhttp.o src/flt_trace.o src/fd.o  \
-        src/task.o src/map.o src/fcgi-app.o src/h2.o src/mworker.o     \
+        src/task.o src/map.o src/fcgi-app.o src/mworker.o              \
         src/tcp_sample.o src/mjson.o src/h1_htx.o src/tcp_act.o                \
         src/ring.o src/flt_bwlim.o src/acl.o src/thread.o src/queue.o  \
         src/http_rules.o src/http.o src/channel.o src/proto_tcp.o      \