Index: support/apxs.in =================================================================== --- support/apxs.in (revision 555457) +++ support/apxs.in (working copy) @@ -68,6 +68,7 @@ my @opt_l = (); my @opt_W = (); my @opt_S = (); +my @opt_E = ("so", "la", "sl", "dll", "dylib"); my $opt_e = 0; my $opt_i = 0; my $opt_a = 0; @@ -146,7 +147,7 @@ print STDERR " apxs -q [-v] [-S =] [ ...]\n"; print STDERR " apxs -c [-S =] [-o ] [-D [=]]\n"; print STDERR " [-I ] [-L ] [-l ] [-Wc,]\n"; - print STDERR " [-Wl,] [-p] ...\n"; + print STDERR " [-Wl,] [-E ] [-p] ...\n"; print STDERR " apxs -i [-S =] [-a] [-A] [-n ] ...\n"; print STDERR " apxs -e [-S =] [-a] [-A] [-n ] ...\n"; exit(1); @@ -154,7 +155,7 @@ # option handling my $rc; -($rc, @ARGV) = &Getopts("qn:gco:I+D+L+l+W+S+eiaApv", @ARGV); +($rc, @ARGV) = &Getopts("qn:gco:I+D+L+l+W+S+eiaApvE+", @ARGV); &usage if ($rc == 0); &usage if ($#ARGV == -1 and not $opt_g and not $opt_q); &usage if (not $opt_q and not ($opt_g and $opt_n) and not $opt_i and not $opt_c and not $opt_e); @@ -357,6 +358,15 @@ my $apu_includedir = `$apu_config --includes`; chomp($apu_includedir); +open(my $fh, "$libtool --config|"); +while (<$fh>){ + if (/(obj|lib)ext=['"](.*)['"]/) { + unshift @opt_E, split(/\s/, $2); + } +} +close $fh; +my $islibreg = '\.(' . join('|', @opt_E) . ')$'; + if ($opt_c) { ## ## SHARED OBJECT COMPILATION @@ -366,12 +376,13 @@ my @srcs = (); my @objs = (); my $f; + foreach $f (@args) { - if ($f =~ m|\.c$|) { - push(@srcs, $f); + if ($f =~ m|$islibreg|) { + push(@objs, $f); } else { - push(@objs, $f); + push(@srcs, $f); } } @@ -413,13 +424,13 @@ my $mod; foreach $s (@srcs) { my $slo = $s; - $slo =~ s|\.c$|.slo|; + $slo =~ s|\..*|.slo|; my $lo = $s; - $lo =~ s|\.c$|.lo|; + $lo =~ s|\..*|.lo|; my $la = $s; - $la =~ s|\.c$|.la|; + $la =~ s|\..*|.la|; my $o = $s; - $o =~ s|\.c$|.o|; + $o =~ s|\..*|.o|; push(@cmds, "$libtool $ltflags --mode=compile $CFG_CC $cflags -I$CFG_INCLUDEDIR $apr_includedir $apu_includedir $opt -c -o $lo $s && touch $slo"); unshift(@objs, $lo); } @@ -480,7 +491,7 @@ my $f; foreach $f (@args) { # ack all potential gcc, hp/ux, win32+os2+aix and os/x extensions - if ($f !~ m#(\.so$|\.la$|\.sl$|\.dll$|\.dylib$|)#) { + if ($f !~ m#$islibreg#) { error("file $f is not a shared object"); exit(1); } @@ -494,27 +505,26 @@ push(@cmds, "chmod 755 $CFG_LIBEXECDIR/$t"); } - # determine module symbolname and filename - my $filename = ''; + # determine module symbolname if ($name eq 'unknown') { $name = ''; my $base = $f; $base =~ s|\.[^.]+$||; - if (-f "$base.c") { - open(FP, "<$base.c"); - my $content = join('', ); - close(FP); - if ($content =~ m|.*module\s+(?:AP_MODULE_DECLARE_DATA\s+)?([a-zA-Z0-9_]+)_module\s*=\s*.*|s) { - $name = "$1"; - $filename = "$base.c"; - $filename =~ s|^[^/]+/||; + my $src; + foreach $src (glob("$base.*")) { + if ($src !~ m#$islibreg#) { + open(FP, "<$src"); + my $content = join('', ); + close(FP); + if ($content =~ m|.*module\s+(?:AP_MODULE_DECLARE_DATA\s+)?([a-zA-Z0-9_]+)_module\s*=\s*.*|s) { + $name = "$1"; + last; + } } } if ($name eq '') { if ($base =~ m|.*mod_([a-zA-Z0-9_]+)\..+|) { $name = "$1"; - $filename = $base; - $filename =~ s|^[^/]+/||; } } if ($name eq '') { @@ -523,9 +533,6 @@ exit(1); } } - if ($filename eq '') { - $filename = "mod_${name}.c"; - } my $dir = $CFG_LIBEXECDIR; $dir =~ s|^$CFG_PREFIX/?||; $dir =~ s|(.)$|$1/|;