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

Makefile
src/cache.c
src/flt_http_comp.c

index 9eb9aaaf682a8b21db0a9acb58823e6452df84b9..be1df359a311abdeaad7135bc9156c4b5cea1292 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_FCGI                : enable the FCGI subsystem. Always on.
 #   USE_H2                  : enable HTTP/2 subsystem. Always on.
 #
 # Options can be forced by specifying "USE_xxx=1" or can be disabled by using
@@ -339,7 +340,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_H2                                           \
+           USE_ECH USE_TRACE USE_FCGI 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                             \
@@ -365,6 +366,9 @@ USE_POLL   = default
 # traces are always enabled
 USE_TRACE  = default
 
+# FCGI is always enabled
+USE_FCGI = default
+
 # HTTP/2 is always enabled
 USE_H2 = default
 
@@ -575,6 +579,10 @@ ifneq ($(USE_H2:0=),)
   OPTIONS_OBJS   += src/mux_h2.o src/h2.o
 endif
 
+ifneq ($(USE_FCGI:0=),)
+  OPTIONS_OBJS   += src/mux_fcgi.o src/fcgi-app.o src/fcgi.o
+endif
+
 ifneq ($(USE_SLZ:0=),)
   OPTIONS_OBJS   += src/slz.o
 endif
@@ -919,7 +927,7 @@ ifneq ($(EXTRA_OBJS),)
   OBJS += $(EXTRA_OBJS)
 endif
 
-OBJS += src/mux_h1.o src/mux_fcgi.o src/log.o                          \
+OBJS += src/mux_h1.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            \
@@ -937,7 +945,7 @@ OBJS += 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/mworker.o              \
+        src/task.o src/map.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      \
index 31273b74bff3f619598859dc0ebe13d178bc8078..79cfa635724a72a66e3879c71bea14f60d28703f 100644 (file)
@@ -634,8 +634,10 @@ cache_store_check(struct proxy *px, struct flt_conf *fconf)
                }
                else if (f->id == http_comp_req_flt_id || f->id == http_comp_res_flt_id)
                        comp = 1;
+#if defined(USE_FCGI)
                else if (f->id == fcgi_flt_id)
                        continue;
+#endif
                else if ((f->id != fconf->id) && (cconf->flags & CACHE_FLT_F_IMPLICIT_DECL)) {
                        /* Implicit declaration is only allowed with the
                         * compression and fcgi. For other filters, an implicit
index a35e92a1d87c252a88016be6c9f175ce2fef7c09..92248324805970b9d450ee765f4ed3359c401f57 100644 (file)
@@ -1137,8 +1137,10 @@ check_implicit_http_comp_flt(struct proxy *proxy)
                                        goto end;
                                }
                        }
+#if defined(USE_FCGI)
                        else if (fconf->id == fcgi_flt_id)
                                continue;
+#endif
                        else
                                explicit = 1;
                }