nginx - linux源码编译问题 --with-module 和--without-module的设计有什么意义

【字号: 日期:2022-07-26浏览:39作者:雯心

问题描述

nginx源码编译安装的时候看到./configure --help有些不太明白

--with-http_ssl_module enable ngx_http_ssl_module --with-http_v2_module enable ngx_http_v2_module --with-http_realip_module enable ngx_http_realip_module --with-http_addition_moduleenable ngx_http_addition_module --with-http_xslt_module enable ngx_http_xslt_module --with-http_xslt_module=dynamic enable dynamic ngx_http_xslt_module --with-http_image_filter_module enable ngx_http_image_filter_module --with-http_image_filter_module=dynamic --with-select_module enable select module --without-select_module disable select module --with-poll_module enable poll module --without-poll_module disable poll module

以上的 http_ssl模块,http_v2模块 都需要指定在 ./configure 后才能添加使用该功能吗?如果所有的--with 都是需要指定在 ./configure 后面编译才能使用,那 --without还有什么意义?

比如上面的select_module,如果需要 ./configure --with-select_module指定才能编译使用,那--without-select_module 这个编译配置选项有什么意义?

问题解答

回答1:

一部分模块是默认就会编译的,一部分是不会编译的,对于默认编译的,如果不想使用,可以使用without,对于默认不编译的,如果想使用,就用with.

官方文档中是这样描述select_module的

--with-select_module --without-select_module — enables or disables building a module that allows the server to work with the select() method. This module is built automatically if the platform does not appear to support more appropriate methods such as kqueue, epoll, or /dev/poll.

对于既有with,又有without的,比如select_module模块,这个模块会根据系统的支持情况决定默认情况下该模块是否自动编译到nginx中。因此就有了两个选项,可以手动的控制这种行为。

其它模块,如果只提供了with,那不就说明默认是不编译的,而只提供了without,则说明是默认编译的的

相关文章: