Autoconf macros for Apache installation process and conf.d?
I have a package that uses autotools to build and install. Part of the package is a website that you can run on your local computer. Thus, the package has a .conf file that must either be copied or linked to the / etc / apache 2 / conf.d directory. What is the standard way that packages could do this? If possible, I would like the user not to have an extra step to make the site work. I would like them to install the package and then be able to http: // localhost / newpackage to get it up and running.
Also, is there a way that autoconf knows about installing apache, or a standard way through the then environment in some way? If someone could point me in the right direction that would be great.
Steve
a source to share
The first thing you need to do is find the apache or apxs2 extension apxs (depends on the apache version and / or platform you are building for). Once you know where your tool is located, you can run queries to get specific apache configuration parameters. For example, to get the system config, you can run:
apxs2 -q SYSCONFDIR
Here is a snippet of how you can find the apache extension tool: (be careful, it may contain syntax errors)
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)
The way to use APXS in your automake Makefile.am would look something like this:
## 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
I assume you are familiar with the automake and autoconf tools.
a source to share