版权声明:可以任意转载,转载时请务必以超链接形式标明文章原始出处和作者信息及本声明。
https://windtear.net/archives/2006/06/23/001012.html
apache apxs Dynamic Shared Object (DSO) Support
http://httpd.apache.org/docs/2.0/dso.html
http://httpd.apache.org/docs/2.0/mod/mod_so.html
Apache Extension Tool (apxs)
Related Modules Related Directives
* mod_so
* LoadModule
--enable-`module`=shared
1. Build and install a distributed Apache module, say mod_foo.c,
into its own DSO mod_foo.so:
$ ./configure --prefix=/path/to/install --enable-foo=shared
$ make install
2. Build and install a third-party Apache module, say mod_foo.c,
into its own DSO mod_foo.so:
$ ./configure --add-module=module_type:/path/to/3rdparty/mod_foo.c --enable-foo=shared
$ make install
3. Configure Apache for later installation of shared modules:
$ ./configure --enable-so
$ make install
4. Build and install a third-party Apache module, say mod_foo.c,
into its own DSO mod_foo.so outside of the Apache source tree using apxs:
$ cd /path/to/3rdparty
$ apxs -c mod_foo.c
$ apxs -i -a -n foo mod_foo.la
本文针对 4 进行举例 编译一下 mod_usertrack:
### httpd-2.0.58/modules/metadata
# apxs -c mod_usertrack.c
/data/apache/build/libtool --silent --mode=compile gcc -prefer-pic \
-DAP_HAVE_DESIGNATED_INITIALIZER -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE \
-g -O2 -pthread -I/data/apache/include -I/data/apache/include -I/data/apache/include \
-c -o mod_usertrack.lo mod_usertrack.c && touch mod_usertrack.slo
/data/apache/build/libtool --silent --mode=link gcc -o mod_usertrack.la \
-rpath /data/apache/modules -module -avoid-version mod_usertrack.lo
# apxs -i -n usertrack_module .libs/mod_usertrack.so
/data/apache/build/instdso.sh SH_LIBTOOL='/data/apache/build/libtool' \
./modules/metadata/.libs/mod_usertrack.so /data/apache/modules
/data/apache/build/libtool --mode=install \
cp ./modules/metadata/.libs/mod_usertrack.so /data/apache/modules/
cp ./modules/metadata/.libs/mod_usertrack.so /data/apache/modules/mod_usertrack.so
Warning! dlname not found in /data/apache/modules/mod_usertrack.so.
Assuming installing a .so rather than a libtool archive.
chmod 755 /data/apache/modules/mod_usertrack.so
### apache_1.3.36/src/modules/standard
# apxs -c mod_usertrack.c
gcc -DLINUX=22 -DHAVE_SET_DUMPABLE -I/usr/include/gdbm -DUSE_HSREGEX -fpic \
-DSHARED_MODULE -I/usr/local/apache/include -c mod_usertrack.c
gcc -shared -o mod_usertrack.so mod_usertrack.o
|