httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@engelschall.com (Ralf S. Engelschall)
Subject [PATCH] APache eXtenSion (APXS) tool
Date Mon, 30 Mar 1998 13:39:20 GMT

APache eXtenSion tool (APXS)
============================

[Did anybody really thought I've no more goodies available ;-)]

Now that we have major-platform shared object support and an installation
system (APACI) for the complete package, we the first time can think about an
_AFTER INSTALLATION_ extension mechanism for Apache.

Because I'm a Perl hacker, I have a similar way in mind as Perl's XS
mechanism. So, today I sit down and created APXS from scratch. The idea
is the following:

  1. Apache is installed as usual but mod_so is enabled, even
     if no modules are actually enabled for shared object support (you can
     additionally enable one, of course).

     $ gunzip <apache-1.3.tar.gz
     $ cd apache-1.3
     $ ./configure --prefix=/tmp/apache --enable-module=so
     $ make 
     $ make install

  2. Now after installation under /tmp/apache/include all
     Apache C header files stay and in /tmp/apache/sbin/apxs a
     new tool exists.

  3. Some time later you have a mod_foo.c at hand which you
     want to bring into your Apache installation to extend its functionality.
     So, you use "apxs" to compile it into a mod_foo.so without fiddling
     around with the compiler flags yourself by running
     
     $ apxs -c mod_foo.c
     gcc -fpic -DSHARED_MODULE -I/tmp/apache/includedir -c mod_foo.c
     ld -Bshareable -o mod_foo.so mod_foo.o
     $ _
     
     and then install it into /tmp/apache/libexec/mod_foo.so
     plus a corresponding LoadModule entry for /tmp/apache/etc/httpd.conf via

     $ apxs -i mod_foo.so
     cp mod_foo.so /tmp/apache/libexec/mod_foo.so
     chmod 755 /tmp/apache/libexec/mod_foo.so
     [updating /tmp/apache/etc/httpd.conf file]
     $ _

     Of course one can do both steps with a single command by just combining
     the -c and -i options:

     $ apxs -c -i mod_foo.c
     gcc -fpic -DSHARED_MODULE -I/tmp/apache/includedir -c mod_foo.c
     ld -Bshareable -o mod_foo.so mod_foo.o
     cp mod_foo.so /tmp/apache/libexec/mod_foo.so
     chmod 755 /tmp/apache/libexec/mod_foo.so
     [updating /tmp/apache/etc/httpd.conf file]
     $ _

  4. After uncommenting the created LoadModule line you can immediately fire
     up Apache with the new module:

     $ /tmp/apache/sbin/apachectl start
     [Mon Mar 30 15:34:08 1998] [debug] mod_so.c(303): loaded module foo_module
     sbin/apachectl start: httpd started

     BINGO!

The "apxs" tool also supports complex extensions like PHP3 which have
pre-build objects:

   $ apxs -o libphp3.so mod_php3.o libmodphp3-so.a
   $ apxs -i libphp3.so

And of course it can be used to do mass-imports of modules:

   $ apxs -c mod_*.c
   $ apxs -i *.so

To bring this useful extension into Apache just minimal changes are required
to APACI and src/Configure to be able to create the "apxs" tool.

Oh, and one more interesting idea stolen from Perl's xsubpp for those users
who work with Apache the first time:

  $ apxs -g foo
  Creating sample module in mod_foo.c

Then in mod_foo.c you find:

  | /* 
  | **  mod_foo.c -- Sample foo module
  | **  Autogenerated via ``apxs -g''.
  | */
  | 
  | #include "httpd.h"
  | #include "http_config.h"
  | #include "conf.h"
  | 
  | static int foo_handler(request_rec *r)
  | {
  |     r->content_type = "text/html";      
  |     send_http_header(r);
  |     if (!r->header_only)
  |         rputs("The sample page from mod_foo.c\n", r);
  |     return OK;
  | }
  | 
  | static const handler_rec foo_handlers[] = { 
  |     { "foo", foo_handler }, { NULL }
  | };
  | 
  | module foo_module = {
  |     STANDARD_MODULE_STUFF, 
  |     NULL, 
  |     NULL, 
  |     NULL, 
  |     NULL, 
  |     NULL, 
  |     NULL,
  |     foo_handlers,
  |     NULL,
  |     NULL, 
  |     NULL, 
  |     NULL, 
  |     NULL, 
  |     NULL, 
  |     NULL, 
  |     NULL 
  | };

which then can be immediately used to play with the APXS stuff.

Comments?
                                       Ralf S. Engelschall
                                       rse@engelschall.com
                                       www.engelschall.com

First, here is the tool itself, including its manpage:

=====src/support/apxs.8===============================================
.TH apxs 8 "April 1998"
.\" Copyright (c) 1998 The Apache Group. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\"
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer. 
.\"
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in
.\"    the documentation and/or other materials provided with the
.\"    distribution.
.\"
.\" 3. All advertising materials mentioning features or use of this
.\"    software must display the following acknowledgment:
.\"    "This product includes software developed by the Apache Group
.\"    for use in the Apache HTTP server project (http://www.apache.org/)."
.\"
.\" 4. The names "Apache Server" and "Apache Group" must not be used to
.\"    endorse or promote products derived from this software without
.\"    prior written permission.
.\"
.\" 5. Redistributions of any form whatsoever must retain the following
.\"    acknowledgment:
.\"    "This product includes software developed by the Apache Group
.\"    for use in the Apache HTTP server project (http://www.apache.org/)."
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
.\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE APACHE GROUP OR
.\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\" ====================================================================
.\"
.\" This software consists of voluntary contributions made by many
.\" individuals on behalf of the Apache Group and was originally based
.\" on public domain software written at the National Center for
.\" Supercomputing Applications, University of Illinois, Urbana-Champaign.
.\" For more information on the Apache Group and the Apache HTTP server
.\" project, please see <http://www.apache.org/>.
.SH NAME
apxs \- APache eXtenSion tool
.SH SYNOPSIS
.B apxs 
[
.BI \-o " dsofile"
]
.B \-c
.IR srcfile ... 
[
.IR objfile ...
]

.B apxs 
.B \-i
.IB dsofile ...
.PP
.SH DESCRIPTION
.B apxs
is a tool for building and installing extension modules for the Apache
HyperText Transfer Protocol (HTTP) server. This assumes that Apache was built
with shared object support (mod_so is compiled in).  You can check if mod_so
is built into your 
.B httpd 
binary by running ``httpd -l''.  If mod_so is
present you can extend your Apache server under runtime by loading additional
modules from shared object files via the 
.B LoadModule 
directive.
.PP
.SH OPTIONS
.TP 12
.B \-c 
This first compiles the source files 
.I srcfile 
into object files and then builds a dynamically shared object in
.I dsofile
by linking these object files plus the optional
.I objfile
files.
If option
.B \-o
is not specified
the output file is
.B mod_unknown.so
.TP 12
.BI \-o " dsofile"
Specifies the name of the dynamically shared object. If not specified the name
.B mod_unknown.so
is used.
.TP 12
.B \-i
Installs one or more dynamically shared objects into the
servers 
.I libexec
directory and adds the corresponding 
.B LoadModule
line to the 
.B httpd.conf
configuration file.
.PD
.SH SEE ALSO
.BR httpd(8)
.

=====src/support/apxs.pl===============================================

#!/usr/local/bin/perl
# ====================================================================
# Copyright (c) 1998 The Apache Group.  All rights reserved.
# 
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 
# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer. 
# 
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in
#    the documentation and/or other materials provided with the
#    distribution.
# 
# 3. All advertising materials mentioning features or use of this
#    software must display the following acknowledgment:
#    "This product includes software developed by the Apache Group
#    for use in the Apache HTTP server project (http://www.apache.org/)."
# 
# 4. The names "Apache Server" and "Apache Group" must not be used to
#    endorse or promote products derived from this software without
#    prior written permission. For written permission, please contact
#    apache@apache.org.
# 
# 5. Redistributions of any form whatsoever must retain the following
#    acknowledgment:
#    "This product includes software developed by the Apache Group
#    for use in the Apache HTTP server project (http://www.apache.org/)."
# 
# THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
# EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE APACHE GROUP OR
# ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
# OF THE POSSIBILITY OF SUCH DAMAGE.
# ====================================================================
# 
# This software consists of voluntary contributions made by many
# individuals on behalf of the Apache Group and was originally based
# on public domain software written at the National Center for
# Supercomputing Applications, University of Illinois, Urbana-Champaign.
# For more information on the Apache Group and the Apache HTTP server
# project, please see <http://www.apache.org/>.
# 

##
##  apxs -- APache eXtenSion tool
##  Written by Ralf S. Engelschall <rse@apache.org>
##

##
##  Configuration
##

$CFG_CC         = '@CC@';         # via Makefile.tmpl
$CFG_LD         = '@LD@';         # via Makefile.tmpl
$CFG_CFLAGS     = '@CFLAGS@';     # via Makefile.tmpl
$CFG_LDFLAGS    = '@LDFLAGS@';    # via Makefile.tmpl
$CFG_INCDIR     = '@includedir@'; # via APACI
$CFG_LIBEXECDIR = '@libexecdir@'; # via APACI
$CFG_SYSCONFDIR = '@sysconfdir@'; # via APACI

##
##  parse argument line
##

#   defaults
$opt_g = '';
$opt_o = '';
$opt_c = 0;
$opt_n = '';
$opt_i = 0;

#   provide own getopt function for maximum portability
sub Getopts {
    my ($argumentative) = @_;
    my (@args, $first, $rest);
    my ($errs) = -1;

    @args = split( / */, $argumentative );
    while(@ARGV && ($_ = $ARGV[0]) =~ /^-(.)(.*)/) {
        ($first,$rest) = ($1,$2);
        $pos = index($argumentative,$first);
        if($pos >= 0) {
            if($pos < $#args && $args[$pos+1] eq ':') {
                shift(@ARGV);
                if($rest eq '') {
                    ++$errs unless @ARGV;
                    $rest = shift(@ARGV);
                }
                ${"opt_$first"} = $rest;
            }
            else {
                ${"opt_$first"} = 1;
                if($rest eq '') { shift(@ARGV); }
                else { $ARGV[0] = "-$rest"; }
            }
        }
        else {
            print STDERR "Unknown option: $first\n";
            ++$errs;
            if($rest ne '') { $ARGV[0] = "-$rest"; }
            else { shift(@ARGV); }
        }
    }
    $errs == 0;
}

sub usage {
    print STDERR "apxs:Error: invalid argument line\n";
    print STDERR "apxs:Usage: apxs -g <name>\n";
    print STDERR "apxs:Usage: apxs [-o mod_<name>.so] [-c] mod_<name>.c ...\n";
    print STDERR "apxs:Usage: apxs [-n <name>] [-i] mod_<name>.so ...\n";
    exit(1);
}

&usage if (&Getopts("g:co:in:v"));
&usage if ($#ARGV == -1 and not $opt_g);
&usage if (not $opt_g and not $opt_i and not $opt_c);

##
##  Operation
##

@files = @ARGV;

sub execute_cmds {
    my (@cmds) = @_;

    foreach $cmd (@cmds) {
        print STDERR "$cmd\n";
        $rc = system("$cmd");
        if ($rc != 0) {
            print STDERR "apxs:Break: Command failed with rc=$rc\n";
            exit(1);
        }
    }
}

if ($opt_g) {
    $sample = <<'EOT';
/* 
**  mod_%NAME%.c -- Sample %NAME% module
**  Autogenerated via ``apxs -g''.
*/

#include "httpd.h"
#include "http_config.h"
#include "conf.h"

static int %NAME%_handler(request_rec *r)
{
    r->content_type = "text/html";      
    send_http_header(r);
    if (!r->header_only)
        rputs("The sample page from mod_%NAME%.c\n", r);
    return OK;
}

static const handler_rec %NAME%_handlers[] = { 
    { "%NAME%", %NAME%_handler }, { NULL }
};

module %NAME%_module = {
    STANDARD_MODULE_STUFF, 
    NULL, 
    NULL, 
    NULL, 
    NULL, 
    NULL, 
    NULL,
    %NAME%_handlers,
    NULL,
    NULL, 
    NULL, 
    NULL, 
    NULL, 
    NULL, 
    NULL, 
    NULL 
};
EOT
    $sample =~ s|%NAME%|$opt_g|sg;
    print STDERR "Creating sample module in mod_${opt_g}.c\n";
    open(FP, ">mod_${opt_g}.c") || die;
    print FP $sample;
    close(FP);
}

if ($opt_c) {
    ##
    ##  COMPILATION
    ##

    #   split files into sources and objects
    @srcs = ();
    @objs = ();
    foreach $f (@files) {
        if ($f =~ m|\.c$|) {
            push(@srcs, $f);
        }
        else {
            push(@objs, $f);
        }
    }

    #   determine output file
    if ($opt_o eq '') {
        if ($#srcs > -1) {
            $dso_file = $srcs[0];
            $dso_file =~ s|\.[^.]+$|.so|;
        }
        elsif ($#objs > -1) {
            $dso_file = $objs[0];
            $dso_file =~ s|\.[^.]+$|.so|;
        }
        else {
            $dso_file = "mod_unknown.so";
        }
    }
    else {
        $dso_file = $opt_o;
    }

    #   create compilation commands
    @cmds = ();
    foreach $s (@srcs) {
        $o = $s;
        $o =~ s|\.c$|.o|;
        push(@cmds, "$CFG_CC $CFG_CFLAGS -I$CFG_INCDIR -c $s");
        unshift(@objs, $o);
    }

    #   create link command
    $cmd = "$CFG_LD $CFG_LDFLAGS -o $dso_file";
    foreach $o (@objs) {
        $cmd .= " $o";
    }
    push(@cmds, $cmd);

    #   execute the commands
    &execute_cmds(@cmds);

    if ($opt_i) {
        @files = ( $dso_file );
    }
}

if ($opt_i) {
    ##
    ##  INSTALLATION
    ##

    #   determine installation commands
    #   and LoadModule directives
    @lmd = ();
    @cmds = ();
    foreach $f (@files) {
        if ($f !~ m|\.so$|) {
            print STDERR "apxs:Error: file $f is not a shared object\n";
            exit(1);
        }
        $t = $f;
        $t =~ s|^.+/([^/]+)$|$1|;
        push(@cmds, "cp $f $CFG_LIBEXECDIR/$t");
        push(@cmds, "chmod 755 $CFG_LIBEXECDIR/$t");

        #   determine module name
        $name = '';
        $base = $f;
        $base =~ s|\.[^.]+$||;
        if (-f "$base.c") {
            open(FP, "<$base.c");
            $content = join('', <FP>);
            close(FP);
            if ($content =~ m|.*module\s+([a-zA-Z0-9_]+)_module\s*=\s*.*|s) {
                $name = "$1";
            }
        }
        if ($name eq '') {
            if ($base =~ m|.*mod_([a-zA-Z0-9_]+)\..+|) {
                $name = "$1";
            }
        }
        if ($name eq '') {
            print "apxs:Error: Sorry, cannot determine bootstrap symbol name\n";
            print "apxs:Error: Please specify one with option `-n'\n";
            exit(1);
        }
        push(@lmd, "LoadModule ${name}_module $CFG_LIBEXECDIR/$t");
    }

    #   execute the commands
    &execute_cmds(@cmds);

    #   update LoadModule section
    if (not -f "$CFG_SYSCONFDIR/httpd.conf") {
        print "apxs:Error: Sorry, cannot find httpd.conf file in $CFG_SYSCONFDIR\n";
        exit(1);
    }
    else {
        print STDERR "[updating $CFG_SYSCONFDIR/httpd.conf file]\n";
        open(FP, "<$CFG_SYSCONFDIR/httpd.conf") || die;
        $content = join('', <FP>);
        close(FP);
        foreach $lmd (@lmd) {
            # delete possible existing entry
            $content =~ s|\n#?\s*$lmd\n|\n|sg; 
            # insert fresh new entry
            $content =~ s|(\n.+_before_ they are used.+?\n)|$1#$lmd\n|sg;
        }
        open(FP, ">$CFG_SYSCONFDIR/httpd.conf.new") || die;
        print FP $content;
        close(FP);
        system("cp $CFG_SYSCONFDIR/httpd.conf $CFG_SYSCONFDIR/httpd.conf.bak && "
.
               "cp $CFG_SYSCONFDIR/httpd.conf.new $CFG_SYSCONFDIR/httpd.conf && "
.
               "rm $CFG_SYSCONFDIR/httpd.conf.new");
    }
}

##EOF##

Second, here is the patch to APACI and src/Configure to automatically install
these stuff:

Index: configure
===================================================================
RCS file: /e/apache/REPOS/apache-1.3/configure,v
retrieving revision 1.1
diff -u -r1.1 configure
--- configure	1998/03/29 12:27:28	1.1
+++ configure	1998/03/30 12:29:45
@@ -135,6 +135,7 @@
 localstatedir='$prefix/var'
 localstatesubdir_run='run'
 localstatesubdir_logs='logs'
+includedir='$prefix/includedir'
 
 #   check and debug
 layout=0
@@ -269,6 +270,7 @@
             echo " --sysconfdir=DIR       install configuration files in DIR   [PREFIX/etc]"
             echo " --datadir=DIR          install read-only  data files in DIR [PREFIX/share]"
             echo " --localstatedir=DIR    install modifiable data files in DIR [PREFIX/var]"
+            echo " --includedir=DIR       install includes files in DIR        [PREFIX/include]"
             echo " --compat               install with old Apache 1.2 installation paths"
             echo ""
             echo "Configuration options:"
@@ -321,6 +323,9 @@
         --localstatedir=*) 
             localstatedir="$apc_optarg" 
             ;;
+        --includedir=*)       
+            includedir="$apc_optarg"       
+            ;;
         --compat) 
             prefix='/usr/local/apache'
             exec_prefix='$prefix'
@@ -333,6 +338,7 @@
             localstatedir='$prefix'
             localstatesubdir_run='logs'
             localstatesubdir_logs='logs'
+            includedir='$prefix/include'
             ;;
         --add-module=*) 
             file="$apc_optarg"
@@ -571,7 +577,8 @@
 ##
 IFS=' '
 for var in exec_prefix bindir sbindir \
-           libexecdir mandir sysconfdir datadir localstatedir; do
+           libexecdir mandir sysconfdir datadir \
+           localstatedir includedir; do
     eval "val=\$$var";
     eval "$var=\"$val$subdir\""
     case $var in
@@ -608,6 +615,7 @@
     echo "           sysconfdir: $sysconfdir" 
     echo "              datadir: $datadir" 
     echo "        localstatedir: $localstatedir" 
+    echo "           includedir: $includedir" 
     echo ""
     echo "Compilation paths:"
     echo "           HTTPD_ROOT: $prefix"
@@ -648,6 +656,7 @@
 -e "s%@localstatedir@%$localstatedir%g" \
 -e "s%@localstatesubdir_run@%$localstatesubdir_run%g" \
 -e "s%@localstatesubdir_logs@%$localstatesubdir_logs%g" \
+-e "s%@includedir@%$includedir%g" \
 -e "s%@suexec@%$suexec%g" \
 -e "s%@suexec_caller@%$suexec_caller%g" \
 -e "s%@suexec_userdir@%$suexec_userdir%g"
Index: Makefile.tmpl
===================================================================
RCS file: /e/apache/REPOS/apache-1.3/Makefile.tmpl,v
retrieving revision 1.1
diff -u -r1.1 Makefile.tmpl
--- Makefile.tmpl	1998/03/29 12:27:29	1.1
+++ Makefile.tmpl	1998/03/30 12:57:53
@@ -90,6 +90,7 @@
 sysconfdir      = @sysconfdir@
 datadir         = @datadir@
 localstatedir   = @localstatedir@
+includedir      = @includedir@
 
 localstatesubdir_run  = @localstatesubdir_run@
 localstatesubdir_logs = @localstatesubdir_logs@
@@ -152,6 +153,7 @@
 		install-programs \
 		install-support  \
 		install-config   \
+		install-include  \
 		install-docroot 
 	-@rm -f .install.tmp
 	-@rm -f .install.conf
@@ -184,6 +186,7 @@
 	@echo "===> [mktree: Creating Apache installation tree]"
 	$(MKDIR) $(bindir)
 	$(MKDIR) $(sbindir)
+	$(MKDIR) $(libexecdir)
 	$(MKDIR) $(mandir)/man1
 	$(MKDIR) $(mandir)/man8
 	$(MKDIR) $(sysconfdir)
@@ -193,6 +196,7 @@
 	$(MKDIR) $(localstatedir)/$(localstatesubdir_logs)
 	$(MKDIR) $(localstatedir)/$(localstatesubdir_run)
 	$(MKDIR) $(localstatedir)/proxy
+	$(MKDIR) $(includedir)
 	@echo "<=== [mktree]"
 
 #   install the server program and optionally corresponding
@@ -203,8 +207,6 @@
 	$(INSTALL_DATA) $(SRC)/support/httpd.8 $(mandir)/man8/httpd.8
 	-@rm -f .install.conf; touch .install.conf
 	-@if [ ".`grep '^[ 	]*SharedModule' $(SRC)/Configuration.apaci`" != . ]; then \
-	    echo "$(MKDIR) $(libexecdir)"; \
-	    $(MKDIR) $(libexecdir); \
         for mod in `egrep '^[ 	]*SharedModule' $(SRC)/Configuration.apaci |\
 	                sed -e 's/^[ 	]*SharedModule[ 	]*//'`; do \
 	        file=`echo $$mod | sed -e 's;^.*/\([^/]*\);\1;'`; \
@@ -242,6 +244,13 @@
 	$(INSTALL_DATA) $(SRC)/support/logresolve.8 $(mandir)/man8/logresolve.8
 	$(INSTALL_PROGRAM) $(SRC)/support/rotatelogs $(sbindir)/rotatelogs
 	$(INSTALL_DATA) $(SRC)/support/rotatelogs.8 $(mandir)/man8/rotatelogs.8
+	sed -e 's;^#!/.*;#!$(PERL);' \
+		-e 's;\@libexecdir\@;$(libexecdir);' \
+		-e 's;\@includedir\@;$(includedir);' \
+		-e 's;\@sysconfdir\@;$(sysconfdir);' \
+    	< $(SRC)/support/apxs > .install.tmp && \
+    	$(INSTALL_SCRIPT) .install.tmp $(sbindir)/apxs
+	$(INSTALL_DATA) $(SRC)/support/apxs.8 $(mandir)/man8/apxs.8
 	@if [ ".$(suexec)" = .1 ]; then \
 	    echo "$(INSTALL_PROGRAM) $(SRC)/support/suexec $(sbindir)/suexec"; \
 	    $(INSTALL_PROGRAM) $(SRC)/support/suexec $(sbindir)/suexec; \
@@ -286,6 +295,14 @@
 	$(CP) $(ROOT)/conf/mime.types $(sysconfdir)/mime.types
 	$(CP) $(ROOT)/conf/magic $(sysconfdir)/magic
 	@echo "<=== [config]"
+
+#   install the Apache C header files 
+install-include:
+	@echo "===> [include: Installing Apache C header files]"
+	$(CP) $(SRC)/include/*.h $(includedir)/
+	osdir=`grep '^OSDIR' $(SRC)/Makefile.config | sed -e 's:^OSDIR=::'`; \
+	$(CP) $(SRC)/$$osdir/os.h $(includedir)/
+	@echo "<=== [include]"
 
 #   create an initial document root containing the Apache manual,
 #   icons and distributed CGI scripts.
Index: src/Configure
===================================================================
RCS file: /e/apache/REPOS/apache-1.3/src/Configure,v
retrieving revision 1.221
diff -u -r1.221 Configure
--- Configure	1998/03/27 00:38:50	1.221
+++ Configure	1998/03/30 11:55:39
@@ -152,6 +152,11 @@
 # Determine if shared objects are used
 using_shlib=`grep  '^SharedModule' $tmpfile >/dev/null && echo 1`
 
+# But perhaps later via apxs when just mod_so is compiled in!
+if [ ".$using_shlib" = . ]; then
+    using_shlib=`grep  '^AddModule modules/standard/mod_so.o' $tmpfile >/dev/null &&
echo 1`
+fi
+
 # Only "assignment" ("=") statements and Module lines
 # should be left at this point. If there is other stuff
 # we bail out
Index: src/support/Makefile.tmpl
===================================================================
RCS file: /e/apache/REPOS/apache-1.3/src/support/Makefile.tmpl,v
retrieving revision 1.12
diff -u -r1.12 Makefile.tmpl
--- Makefile.tmpl	1998/03/17 15:42:42	1.12
+++ Makefile.tmpl	1998/03/30 11:57:50
@@ -4,7 +4,7 @@
 INCLUDES=$(INCLUDES1) $(INCLUDES0) $(EXTRA_INCLUDES)
 LDFLAGS=$(LDFLAGS1) $(EXTRA_LDFLAGS) -L$(SRCDIR)/ap
 
-TARGETS=htpasswd htdigest rotatelogs logresolve ab
+TARGETS=htpasswd htdigest rotatelogs logresolve ab apxs
 
 OBJS=htpasswd.o htdigest.o rotatelogs.o logresolve.o ab.o
 
@@ -27,6 +27,14 @@
 
 ab: ab.o
 	$(CC) $(INCLUDES) $(CFLAGS) ab.o -o ab $(LDFLAGS) $(LIBS)
+
+apxs: apxs.pl
+	sed <apxs.pl >apxs \
+	    -e "s:@CC@:$(CC):g" \
+	    -e "s:@LD@:$(LD):g" \
+	    -e "s:@CFLAGS@:$(CFLAGS_SHLIB):g" \
+	    -e "s:@LDFLAGS@:$(LDFLAGS_SHLIB):g"
+	chmod a+x apxs
 
 clean:
 	rm -f $(TARGETS) *.o

Mime
View raw message