编译 apache 模块 --enable-mods-shared 与 --enable-modules

编译 apache 模块 --enable-mods-shared 与 --enable-modules

Apache 配置文档的片段httpd-2.4

--enable-mods-shared=MODULE-LIST

Defines a list of modules to be enabled and build as dynamic shared modules. This mean, these module have to be loaded dynamically by using the LoadModule directive.

--enable-mods-static=MODULE-LIST

This option behaves similar to --enable-mods-shared, but will link the given modules statically. This mean, these modules will always be present while running `httpd`. They need not be loaded with LoadModule.

--enable-modules=MODULE-LIST

This option behaves similar to --enable-mods-shared, and will also link the given modules dynamically. The special keyword none disables the build of all modules.

这是否意味着如果使用--enable-modules,它将在运行时自动链接,而不必使用该LoadModule指令?这样做有什么好处呢?我理解静态库和动态库之间的区别,但这让我感到困惑。

答案1

不,该--enable-modules选项的存在是为了能够设置--enable-module=none。具体autoconf行为在acinclude.m4

AC_ARG_ENABLE(modules,
APACHE_HELP_STRING(--enable-modules=MODULE-LIST,Space-separated list of modules to enable | "all" | "most" | "few" | "none" | "reallyall"),[
  if test "$enableval" = "none"; then
     module_default=no
     module_selection=none
  else
    for i in $enableval; do
      if test "$i" = "all" -o "$i" = "most" -o "$i" = "few" -o "$i" = "reallyall"
      then
        module_selection=$i
      else
        i=`echo $i | sed 's/-/_/g'`
        eval "enable_$i=shared"
      fi
    done
  fi
])

AC_ARG_ENABLE(mods-shared,
APACHE_HELP_STRING(--enable-mods-shared=MODULE-LIST,Space-separated list of shared modules to enable | "all" | "most" | "few" | "reallyall"),[
  for i in $enableval; do
    if test "$i" = "all" -o "$i" = "most" -o "$i" = "few" -o "$i" = "reallyall"
    then
      module_selection=$i
      module_default=shared
    else
      i=`echo $i | sed 's/-/_/g'`
      eval "enable_$i=shared"
    fi
  done
])

--enable-mods-shared不允许none争论。

唯一的额外区别是--enable-modules不设置module_default. module_default猜测接近脚本的开头并设置为shared(如果可能),或者static如果系统不支持动态共享对象。

稍后,如果模块名称设置为mostallreallyall,则这些模块将根据module_default设置的内容构建。

答案2

这里来自文档https://httpd.apache.org/docs/trunk/programs/configure.html

--enable-modules=MODULE-LIST
    This option behaves like to --enable-mods-shared, and will also link the given modules dynamically. The special keyword none disables the build of all modules.

我希望这能澄清它们是动态链接的。

相关内容