HPlogo Configuring and Managing MPE/iX Internet Services > Chapter 9 HP WebWise MPE/iX Secure Web Server

Module Creation Using the APXS Utility

MPE documents

Complete PDF
Table of Contents
Glossary
Index

E0802 Edition 6 ♥
E0701 Edition 5
E0400 Edition 4

Modules can also be created using the bin/apxs utility "Apache eXtenSion" tool. Details on using apxs are found in the apx manual page, http://www.apache.org/docs/programs/apxs.html. Apxs is a Perl script and requires a working Perl interpreter on the HP e3000. The Perl interpreter is not distributed or supported as part of FOS but is available as freeware via http://jazz.external.hp.com/src/hp_freeware/perl/. To prepare a system for running apxs:
  • Install the GNU tools.

  • Install the Perl interpreter.

  • Set up a Perl symbolic link.


  shell/iX> ln -s /PERL/PUB/PERL /usr/local/bin/perl

Apxs has a number of options. The -g and -n options will create a module skeleton with a corresponding Makefile. Log on as MGR.APACHE in order to execute apxs and to create a module with MGR.APACHE as the owner.

  :HELLO MGR.APACHE
  :XEQ SH.HPBIN.SYS -L
  shell/iX> ./bin/apxs -g -n hw
  Creating [DIR]  hw
  Creating [FILE] hw/Makefile
  Creating [FILE] hw/mod_hw.c
  shell/iX> cd hw
  shell/iX> ls
  Makefile   mod_hw.c

Apxs -g -n will create directory "hw" with the module source file mod_hw.c and its Makefile. This directory is where the module is developed. Note that the mod_hw.c file created here is not the same as the sample module code. To continue following this example, use the code listings given for mod_hw.c and hw.c.

Makefile can be used for compiling and linking the module. The default Makefile created here by apxs uses apxs for compiling and linking. We recommend changing this to use gcc and LinkEditor as shown in the section “Modified APXS Makefile (mod_hw)”. The modified Makefile still calls apxs for getting the correct compile options and include files but does not use apxs for compiling and linking.

Makefile can easily be modified for customization. For the sample module, mod_hw, the additional source file, hw.c, was added to Makefile. Using a Makefile is a convenient and flexible way to build modules.

Here is the output from executing mod_hw's modified apxs Makefile:

  shell/iX> cd /APACHER/PUB/hw
  shell/iX> makegcc -o mod_hw.o `/APACHE/PUB/bin/apxs -q CFLAGS` \
      -I`/APACHE/PUB/bin/apxs -q INCLUDEDIR` -c mod_hw.c
  gcc -o hw.o `/APACHE/PUB/bin/apxs -q CFLAGS`  -I`/APACHE/PUB/bin/apxs \
      -q INCLUDEDIR` -c hw.c
  callci "linkedit 'buildxl xl=./mod_hw.so;limit=5'"
  HP Link Editor/iX (HP30315A.06.15) Copyright Hewlett-Packard Co 1986

  LinkEd> buildxl xl=./mod_hw.so;limit=5
  LinkEd> addxl from=./mod_hw.o,./hw.o;to=./mod_hw.so
  ;rl=/lib/libm.a,/lib/libc.a ;merge;share
  1 OBJECT FILE HAS BEEN ADDED.




Module Creation Using a Template


Linking Libraries into a DSO