apxs.in revision 8350a6ee6ab2fafa65dc0216827d380deeedbb0a
402N/A# ==================================================================== 402N/A# The Apache Software License, Version 1.1 402N/A# Copyright (c) 2000-2001 The Apache Software Foundation. All rights 402N/A# Redistribution and use in source and binary forms, with or without 402N/A# modification, are permitted provided that the following conditions 402N/A# 1. Redistributions of source code must retain the above copyright 402N/A# notice, this list of conditions and the following disclaimer. 402N/A# 2. Redistributions in binary form must reproduce the above copyright 402N/A# notice, this list of conditions and the following disclaimer in 402N/A# the documentation and/or other materials provided with the 402N/A# 3. The end-user documentation included with the redistribution, 3817N/A# if any, must include the following acknowledgment: 402N/A# "This product includes software developed by the 814N/A# Alternately, this acknowledgment may appear in the software itself, 814N/A# if and wherever such third-party acknowledgments normally appear. 814N/A# 4. The names "Apache" and "Apache Software Foundation" must 402N/A# not be used to endorse or promote products derived from this 402N/A# software without prior written permission. For written 402N/A# permission, please contact apache@apache.org. 402N/A# 5. Products derived from this software may not be called "Apache", 402N/A# nor may "Apache" appear in their name, without prior written 618N/A# permission of the Apache Software Foundation. 402N/A# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 402N/A# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 844N/A# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 844N/A# DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR 402N/A# ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 1407N/A# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 402N/A# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 2899N/A# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 2899N/A# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 4250N/A# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 814N/A# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3817N/A# ==================================================================== 402N/A# This software consists of voluntary contributions made by many 3955N/A# individuals on behalf of the Apache Software Foundation. For more 3955N/A# information on the Apache Software Foundation, please see 402N/A# read the configuration variables once 402N/A# defaults for parameters 402N/A# this subroutine is derived from Perl's getopts.pl with the enhancement of 402N/A# the "+" metacharacter at the format string to allow a list to be built by 402N/A# subsequent occurrences of the same option. 402N/A print STDERR "Usage: apxs -g [-S <var>=<val>] -n <modname>\n"; 402N/A print STDERR " apxs -q [-S <var>=<val>] <query> ...\n"; 402N/A print STDERR " apxs -c [-S <var>=<val>] [-o <dsofile>] [-D <name>[=<value>]]\n"; 402N/A print STDERR " [-I <incdir>] [-L <libdir>] [-l <libname>] [-Wc,<flags>]\n"; 402N/A print STDERR " apxs -i [-S <var>=<val>] [-a] [-A] [-n <modname>] <dsofile> ...\n"; 402N/A print STDERR " apxs -e [-S <var>=<val>] [-a] [-A] [-n <modname>] <dsofile> ...\n"; 402N/A eval "\$CFG_${var}=\"${val}\""; 402N/A## Initial shared object support check 402N/A#allow apxs to be run from the source tree, before installation 402N/A error("Sorry, no shared object support for Apache"); 402N/A error("available under your platform. Make sure"); 402N/A error("the Apache module mod_so is compiled into"); 402N/A my ($file, $rh_config) = @_; 3353N/A open IN, $file or die "cannot open $file: $!"; 3353N/A if (/^\s*(.*?)\s*=\s*(.*)$/){ 3353N/A if (exists $config_vars{$arg} or exists $config_vars{lc $arg}) { 1938N/A my $val = exists $config_vars{$arg} 3477N/A $result .= eval "qq($val)"; 402N/A if (exists $internal_vars{$arg} or exists $internal_vars{lc $arg}) { 402N/A my $val = exists $internal_vars{$arg} ? $arg : lc $arg; 402N/A $val = eval "\$CFG_$val"; 402N/A $result .= eval "qq($val)"; 402N/A error("Invalid query string `$arg'"); 402N/A# helper function for executing a list of 402N/A# system command with return code checks ## SAMPLE MODULE SOURCE GENERATION system("touch ${name}/.deps"); ## SHARED OBJECT COMPILATION # split files into sources and objects # create compilation commands # allow one-step compilation and installation ## SHARED OBJECT INSTALLATION # determine installation commands if ($f !~ m#(\.so$|\.la$)#) { error("file $f is not a shared object"); $t =~ s|^.+/([^/]+)$|$1|; # determine module symbolname and filename error("Sorry, cannot determine bootstrap symbol name"); error("Please specify one with option `-n'"); $filename = "mod_${name}.c"; my $dir = $CFG_LIBEXECDIR; $dir =~ s|^$CFG_PREFIX/?||; push(@lmd, sprintf("LoadModule %-18s %s", "${name}_module", "$dir$t")); push(@amd, sprintf("AddModule %s", $filename)); my $content = join('', <FP>); if ($content !~ m|\n#?\s*LoadModule\s+|) { error("Activation failed for custom $CFG_SYSCONFDIR/$CFG_TARGET.conf file."); $content =~ s|^(.*\n#?\s*LoadModule\s+[^\n]+\n)|$1$c$lmd\n|sg; $lmd =~ m|LoadModule\s+(.+?)_module.*|; $content =~ s|^(.*\n#?\s*AddModule\s+[^\n]+\n)|$1$c$amd\n|sg; $content =~ s|^(.*\n)#?\s*$amd[^\n]*\n|$1$c$amd\n|sg; notice("unable to open configuration file"); print STDERR "apxs:Error: $_[0].\n"; ## Makefile -- Build procedure for sample %NAME% Apache module ## Autogenerated via ``apxs -n %NAME% -g''. # additional defines, includes and libraries #DEF=-Dmy_define=my_value # install the shared object file into Apache # install and activate shared object by reloading Apache to # force a reload of the shared object file ** $ apxs -c -i mod_%NAME%.c ap_rputs("The sample page from mod_%NAME%.c\n", r);