⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 apxs.in

📁 Apache HTTP Server 是一个功能强大的灵活的与HTTP/1.1相兼容的web服务器.这里给出的是Apache HTTP服务器的源码。
💻 IN
📖 第 1 页 / 共 2 页
字号:
#!@perlbin@ -w## Copyright 1999-2005 The Apache Software Foundation or its licensors, as# applicable.## Licensed under the Apache License, Version 2.0 (the "License");# you may not use this file except in compliance with the License.# You may obtain a copy of the License at##     http://www.apache.org/licenses/LICENSE-2.0## Unless required by applicable law or agreed to in writing, software# distributed under the License is distributed on an "AS IS" BASIS,# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.# See the License for the specific language governing permissions and# limitations under the License.require 5.003;use strict;package apxs;####  Configuration##my %config_vars = ();my $installbuilddir = "@exp_installbuilddir@";get_config_vars("$installbuilddir/config_vars.mk",\%config_vars);# read the configuration variables oncemy $prefix         = get_vars("prefix");my $CFG_PREFIX     = $prefix;my $exec_prefix    = get_vars("exec_prefix");my $datadir        = get_vars("datadir");my $localstatedir  = get_vars("localstatedir");my $CFG_TARGET     = get_vars("progname");my $CFG_SYSCONFDIR = get_vars("sysconfdir");my $CFG_CFLAGS     = join ' ', map { get_vars($_) }  qw(SHLTCFLAGS CFLAGS NOTEST_CPPFLAGS EXTRA_CPPFLAGS EXTRA_CFLAGS);my $includedir     = get_vars("includedir");my $CFG_INCLUDEDIR = eval qq("$includedir");my $CFG_CC         = get_vars("CC");my $libexecdir     = get_vars("libexecdir");my $CFG_LIBEXECDIR = eval qq("$libexecdir");my $sbindir        = get_vars("sbindir");my $CFG_SBINDIR    = eval qq("$sbindir");my $ltflags        = $ENV{'LTFLAGS'};$ltflags or $ltflags = "--silent";my %internal_vars = map {$_ => 1}    qw(TARGET CC CFLAGS CFLAGS_SHLIB LD_SHLIB LDFLAGS_SHLIB LIBS_SHLIB       PREFIX SBINDIR INCLUDEDIR LIBEXECDIR SYSCONFDIR);####  parse argument line###   defaults for parametersmy $opt_n = '';my $opt_g = '';my $opt_c = 0;my $opt_o = '';my @opt_D = ();my @opt_I = ();my @opt_L = ();my @opt_l = ();my @opt_W = ();my @opt_S = ();my $opt_e = 0;my $opt_i = 0;my $opt_a = 0;my $opt_A = 0;my $opt_q = 0;my $opt_h = 0;my $opt_p = 0;#   this subroutine is derived from Perl's getopts.pl with the enhancement of#   the "+" metacharacter at the format string to allow a list to be built by#   subsequent occurrences of the same option.sub Getopts {    my ($argumentative, @ARGV) = @_;    my $errs = 0;    local $_;    local $[ = 0;    my @args = split / */, $argumentative;    while (@ARGV && ($_ = $ARGV[0]) =~ /^-(.)(.*)/) {        my ($first, $rest) = ($1,$2);        if ($_ =~ m|^--$|) {            shift @ARGV;            last;        }        my $pos = index($argumentative,$first);        if ($pos >= $[) {            if ($pos < $#args && $args[$pos+1] eq ':') {                shift @ARGV;                if ($rest eq '') {                    unless (@ARGV) {                        error("Incomplete option: $first (needs an argument)");                        $errs++;                    }                    $rest = shift(@ARGV);                }                eval "\$opt_$first = \$rest;";            }            elsif ($pos < $#args && $args[$pos+1] eq '+') {                shift @ARGV;                if ($rest eq '') {                    unless (@ARGV) {                        error("Incomplete option: $first (needs an argument)");                        $errs++;                    }                    $rest = shift(@ARGV);                }                eval "push(\@opt_$first, \$rest);";            }            else {                eval "\$opt_$first = 1";                if ($rest eq '') {                    shift(@ARGV);                }                else {                    $ARGV[0] = "-$rest";                }            }        }        else {            error("Unknown option: $first");            $errs++;            if ($rest ne '') {                $ARGV[0] = "-$rest";            }            else {                shift(@ARGV);            }        }    }    return ($errs == 0, @ARGV);}sub usage {    print STDERR "Usage: apxs -g [-S <var>=<val>] -n <modname>\n";    print STDERR "       apxs -q [-S <var>=<val>] <query> ...\n";    print STDERR "       apxs -c [-S <var>=<val>] [-o <dsofile>] [-D <name>[=<value>]]\n";    print STDERR "               [-I <incdir>] [-L <libdir>] [-l <libname>] [-Wc,<flags>]\n";    print STDERR "               [-Wl,<flags>] [-p] <files> ...\n";    print STDERR "       apxs -i [-S <var>=<val>] [-a] [-A] [-n <modname>] <dsofile> ...\n";    print STDERR "       apxs -e [-S <var>=<val>] [-a] [-A] [-n <modname>] <dsofile> ...\n";    exit(1);}#   option handlingmy $rc;($rc, @ARGV) = &Getopts("qn:gco:I+D+L+l+W+S+eiaAp", @ARGV);&usage if ($rc == 0);&usage if ($#ARGV == -1 and not $opt_g);&usage if (not $opt_q and not ($opt_g and $opt_n) and not $opt_i and not $opt_c and not $opt_e);#   argument handlingmy @args = @ARGV;my $name = 'unknown';$name = $opt_n if ($opt_n ne '');if (@opt_S) {    my ($opt_S);    foreach $opt_S (@opt_S) {	if ($opt_S =~ m/^([^=]+)=(.*)$/) {	    my ($var) = $1;	    my ($val) = $2;	    my $oldval = eval "\$CFG_$var";	    unless ($var and $oldval) {		print STDERR "apxs:Error: no config variable $var\n";		&usage;	    }	    eval "\$CFG_${var}=\"${val}\"";	} else {	    print STDERR "apxs:Error: malformatted -S option\n";	    &usage;	}	    }}####  Initial shared object support check##my $httpd = get_vars("sbindir") . "/" . get_vars("progname");$httpd = eval qq("$httpd");$httpd = eval qq("$httpd");my $envvars = get_vars("sbindir") . "/envvars";$envvars = eval qq("$envvars");$envvars = eval qq("$envvars");#allow apxs to be run from the source tree, before installationif ($0 =~ m:support/apxs$:) {    ($httpd = $0) =~ s:support/apxs$::;}unless (-x "$httpd") {	error("$httpd not found or not executable");	exit 1;}unless (grep /mod_so/, `. $envvars && $httpd -l`) {    error("Sorry, no shared object support for Apache");    error("available under your platform. Make sure");    error("the Apache module mod_so is compiled into");    error("your server binary `$httpd'.");    exit 1;}sub get_config_vars{    my ($file, $rh_config) = @_;    open IN, $file or die "cannot open $file: $!";    while (<IN>){        if (/^\s*(.*?)\s*=\s*(.*)$/){            $rh_config->{$1} = $2;        }    }    close IN;}sub get_vars {    my $result = '';    my $ok = 0;    my $arg;    foreach $arg (@_) {        if (exists $config_vars{$arg} or exists $config_vars{lc $arg}) {            my $val = exists $config_vars{$arg}                ? $config_vars{$arg}                : $config_vars{lc $arg};            $val =~ s/[()]//g;            $result .= eval "qq($val)" if defined $val;            $result .= ";;";            $ok = 1;        }        if (not $ok) {            if (exists $internal_vars{$arg} or exists $internal_vars{lc $arg}) {                my $val = exists $internal_vars{$arg} ? $arg : lc $arg;                $val = eval "\$CFG_$val";                $result .= eval "qq($val)" if defined $val;                $result .= ";;";                $ok = 1;            }            if (not $ok) {                error("Invalid query string `$arg'");                exit(1);            }        }    }    $result =~ s|;;$||;    $result =~ s|:| |;    return $result;}####  Operation###   helper function for executing a list of#   system command with return code checkssub execute_cmds {    my (@cmds) = @_;    my ($cmd, $rc);    foreach $cmd (@cmds) {        notice($cmd);        $rc = system $cmd;        if ($rc) {            error(sprintf "Command failed with rc=%d\n", $rc << 8);            exit 1 ;        }    }}if ($opt_g) {    ##    ##  SAMPLE MODULE SOURCE GENERATION    ##    if (-d $name) {        error("Directory `$name' already exists. Remove first");        exit(1);    }    my $data = join('', <DATA>);    $data =~ s|%NAME%|$name|sg;    $data =~ s|%TARGET%|$CFG_TARGET|sg;    $data =~ s|%PREFIX%|$prefix|sg;    $data =~ s|%INSTALLBUILDDIR%|$installbuilddir|sg;    my ($mkf, $mods, $src) = ($data =~ m|^(.+)-=#=-\n(.+)-=#=-\n(.+)|s);    notice("Creating [DIR]  $name");    system("mkdir $name");    notice("Creating [FILE] $name/Makefile");    open(FP, ">${name}/Makefile") || die;    print FP $mkf;    close(FP);    notice("Creating [FILE] $name/modules.mk");    open(FP, ">${name}/modules.mk") || die;    print FP $mods;    close(FP);    notice("Creating [FILE] $name/mod_$name.c");    open(FP, ">${name}/mod_${name}.c") || die;    print FP $src;    close(FP);    notice("Creating [FILE] $name/.deps");    system("touch ${name}/.deps");    exit(0);}if ($opt_q) {    ##    ##  QUERY INFORMATION     ##    my $result = get_vars(@args);    print "$result\n";}my $apr_bindir = get_vars("APR_BINDIR");if (! -x "$apr_bindir/apr-config") {    error("$apr_bindir/apr-config not found!");    exit(1);}my $apu_bindir = get_vars("APU_BINDIR");if (! -x "$apu_bindir/apu-config") {    error("$apu_bindir/apu-config not found!");    exit(1);}my $libtool = `$apr_bindir/apr-config --installbuilddir`;chomp($libtool);$libtool = "$libtool/libtool";my $apr_includedir = `$apr_bindir/apr-config --includes`;chomp($apr_includedir);my $apu_includedir = `$apu_bindir/apu-config --includes`;chomp($apu_includedir);if ($opt_c) {    ##    ##  SHARED OBJECT COMPILATION    ##    #   split files into sources and objects    my @srcs = ();    my @objs = ();    my $f;    foreach $f (@args) {        if ($f =~ m|\.c$|) {            push(@srcs, $f);        }        else {            push(@objs, $f);        }    }    #   determine output file    my $dso_file;    if ($opt_o eq '') {        if ($#srcs > -1) {            $dso_file = $srcs[0];            $dso_file =~ s|\.[^.]+$|.la|;        }        elsif ($#objs > -1) {            $dso_file = $objs[0];            $dso_file =~ s|\.[^.]+$|.la|;        }        else {            $dso_file = "mod_unknown.la";        }    }    else {        $dso_file = $opt_o;        $dso_file =~ s|\.[^.]+$|.la|;    }    #   create compilation commands

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -