Configuring and Managing MPE/iX Internet Services (August 2002)
Chapter 9
HP WebWise MPE/iX Secure Web Server
Sample Module Code (mod_hw)
180
Make sure to use tabs (instead of spaces) when adding callci and gcc to the MakeFile.
shell/iX> cat Makefile
##
## Makefile -- Build procedure for sample hw Apache module
## Autogenerated via ‘‘apxs -n hw -g’’.
##
## 3/01 Modified Makefile to replace apxs by gcc and linkedit for compile and ## link
# the used tools
APXS=/APACHE/PUB/bin/apxs
APACHECTL=/APACHE/PUB/bin/apachectl
# defines, includes and libraries
DEF=‘$(APXS) -q CFLAGS‘
INC=-I‘$(APXS) -q INCLUDEDIR‘
LIB=/lib/libm.a,/lib/libc.a
# the default target
all: mod_hw.so
# link the shared object file
mod_hw.so: mod_hw.o hw.o
callci "linkedit ’buildxl xl=./mod_hw.so;limit=5’"
callci "linkedit ’addxl from=./mod_hw.o,./hw.o;to=./mod_hw.so; \
rl=$(LIB);merge;share’"
# compile the object files
mod_hw.o: mod_hw.c
gcc -o mod_hw.o $(DEF) $(INC) -c mod_hw.c
hw.o: hw.c
gcc -o hw.o $(DEF) $(INC) -c hw.c
# install the shared object file into Apache
install: all
$(APXS) -i -a -n ’hw’ mod_hw.so
# cleanup
clean:
-rm -f mod_hw.o mod_hw.so hw.o
# simple test
test: reload
lynx -mime_header http://localhost/hw
# install and activate shared object by reloading Apache to
# force a reload of the shared object file
reload: install restart
# the general Apache start/restart/stop
# procedures
start:
$(APACHECTL) start
restart:
$(APACHECTL) restart
stop:
$(APACHECTL) stop
Extended Apache Programming Interface (EAPI)
Apache 1.3.9 and later are built with an extended set of Apache APIs. This means that Apache 1.3.9 and later
expects these EAPIs to be built into any DSO they call. This EAPI feature is included in Apache so that a
DSO can be used by either Apache or WebWise, since WebWise requires EAPI for its SSL functionality.