gpt4 book ai didi

apache - Apache 和 conf.d 安装过程的 Autoconf 宏?

转载 作者:行者123 更新时间:2023-12-04 06:53:17 25 4
gpt4 key购买 nike

我有一个使用 autotools 构建和安装的包。
包的一部分是一个可以在本地机器上运行的网站。
所以在包中有一个 .conf 文件,它是
复制或链接到/etc/apache2/conf.d 目录。是什么
包会这样做的标准方式?如果可能的话,我想要
用户没有额外的步骤来使网站正常工作。我想要
让他们安装软件包,然后能够浏览到
http://localhost/newpackage启动并运行。

另外,有没有办法让 autoconf 知道 apache 安装或
标准方式通过然后环境一些怎么样?如果有人可以
为我指明正确的方向,这会很棒。

史蒂夫

最佳答案

您应该做的第一件事是找到 apache 扩展工具 apxs 或 apxs2(取决于您正在构建的 apache 版本和/或平台)。知道工具所在的位置后,您可以运行查询以获取某些 apache 配置参数。例如要获取系统配置目录,您可以运行:

apxs2 -q SYSCONFDIR

以下是如何找到 apache 扩展工具的片段:(小心它可能包含语法错误)
dnl Note: AC_DEFUN goes here plus other stuff

AC_MSG_CHECKING(for apache APXS)
AC_ARG_WITH(apxs,
[AS_HELP_STRING([[--with-apxs[=FILE]]],
[path to the apxs, defaults to "apxs".])],
[
if test "$withval" = "yes"; then
APXS=apxs
else
APXS="$withval"
fi
])

if test -z "$APXS"; then
for i in /usr/sbin /usr/local/apache/bin /usr/bin ; do
if test -f "$i/apxs2"; then
APXS="$i/apxs2"
break
fi
if test -f "$i/apxs"; then
APXS="$i/apxs"
break
fi
done
fi
AC_SUBST(APXS)

在 automake Makefile.am 中使用 APXS 的方法如下所示:
## Find apache sys config dir
APACHE2_SYSCONFDIR = `@APXS@ -q SYSCONFDIR`

## Misc automake stuff goes here

install: install-am
cp my.conf $(DESTDIR)${APACHE2_SYSCONFDIR}/conf.d/my.conf

我假设您熟悉 automake 和 autoconf 工具。

关于apache - Apache 和 conf.d 安装过程的 Autoconf 宏?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2819273/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com