If an Apache module is written entirely in C, there is a useful
program called apxs
which will facilitate and
automate the compilation of a dynamically loadable
module. Unfortunately this program is hardwired to use the C
compiler and linker and is not suited for the compilation and
linkage of a C++ module.
apxs
was compiled with the same options as apache
itself and therefore has a lot of information about where various
important parts of apache are installed and how to compile modules
for apache on the current system. Luckily this information is
available to C++ programmers via the -q
command line
switch.
# Get all of apxs's internal values.
APXS_CC=`$(APXS) -q CC`
APXS_TARGET=`$(APXS) -q TARGET`
APXS_CFLAGS=`$(APXS) -q CFLAGS`
APXS_SBINDIR=`$(APXS) -q SBINDIR`
APXS_CFLAGS_SHLIB=`$(APXS) -q CFLAGS_SHLIB`
APXS_INCLUDEDIR=`$(APXS) -q INCLUDEDIR`
APXS_LD_SHLIB=`$(APXS) -q LD_SHLIB`
APXS_LIBEXECDIR=`$(APXS) -q LIBEXECDIR`
APXS_LDFLAGS_SHLIB=`$(APXS) -q LDFLAGS_SHLIB`
APXS_SYSCONFDIR=`$(APXS) -q SYSCONFDIR`
APXS_LIBS_SHLIB=`$(APXS) -q LIBS_SHLIB`
# display the apxs variables
check_apxs_vars:
@echo APXS_CC $(APXS_CC);\
echo APXS_TARGET $(APXS_TARGET);\
echo APXS_CFLAGS $(APXS_CFLAGS);\
echo APXS_SBINDIR $(APXS_SBINDIR);\
echo APXS_CFLAGS_SHLIB $(APXS_CFLAGS_SHLIB);\
echo APXS_INCLUDEDIR $(APXS_INCLUDEDIR);\
echo APXS_LD_SHLIB $(APXS_LD_SHLIB);\
echo APXS_LIBEXECDIR $(APXS_LIBEXECDIR);\
echo APXS_LDFLAGS_SHLIB $(APXS_LDFLAGS_SHLIB);\
echo APXS_SYSCONFDIR $(APXS_SYSCONFDIR);\
echo APXS_LIBS_SHLIB $(APXS_LIBS_SHLIB)