Apache The Definitive Guide, 3rd EditionApache: The Definitive GuideSearch this book

20.10. Modules

Almost everything in this chapter has been illustrated by a module implementing some kind of functionality. But how do modules fit into Apache? In fact, almost all of the work is done in the module itself, but a little extra is required outside. All that is required beyond that is to add it to the config.m4 file in its directory, which gets incorporated into the configure script. The lines for the two of the modules illustrated earlier are:

APACHE_MODULE(optional_fn_import, example optional function importer, , , no)
APACHE_MODULE(optional_fn_export, example optional function exporter, , , no)

The two modules can be enabled with the --enable-optional-fn-export and --enable-optional-fn-import flags to configure. Of course, the whole point is that you can enable either, both, or neither, and they will always work correctly.

The complete list of arguments for APACHE_MODULE( ) are:

APACHE_MODULE(name, helptext[, objects[, structname[, default[, config]]]])

where:

name
This is the name of the module, which normally matches the source filename (i.e., it is mod_name.c).

helptext
This is the text displayed when configure is run with --help as an argument.

objects
If this is present, it overrides the default object file of mod_name.o.

structname
The module structure is called name_module by default, but if this is present, it overrides it.

default
If present, this determines when the module is included. If set to yes, the module is always included unless explicitly disabled. If no, the module is never included unless explicitly enabled. If most, then it is not enabled unless --enable-most is specified. If absent or all, then it is only enabled when --enable-all is specified.



Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.