Author: pgollucci
Date: Mon Aug 25 10:42:16 2008
New Revision: 688790

URL: http://svn.apache.org/viewvc?rev=688790&view=rev
Log:
MFC r688788

fix the build with autoconf >= 2.62


Modified:
    httpd/apreq/branches/v2_10/   (props changed)
    httpd/apreq/branches/v2_10/CHANGES
    httpd/apreq/branches/v2_10/glue/perl/Makefile.PL

Propchange: httpd/apreq/branches/v2_10/
------------------------------------------------------------------------------
    svn:mergeinfo = /httpd/apreq/trunk:688788

Modified: httpd/apreq/branches/v2_10/CHANGES
URL: 
http://svn.apache.org/viewvc/httpd/apreq/branches/v2_10/CHANGES?rev=688790&r1=688789&r2=688790&view=diff
==============================================================================
--- httpd/apreq/branches/v2_10/CHANGES (original)
+++ httpd/apreq/branches/v2_10/CHANGES Mon Aug 25 10:42:16 2008
@@ -4,6 +4,9 @@
 
 @section v2_10 Changes with libapreq2-2.10 (under developement)
 
+- Perl Glue Build [Philip M. Gollucci]
+  config.status format changed format yet again in autoconf 2.62+.
+
 - License [Mladen Turk]
   Add libapreq.rc and generate libapreq.res
 

Modified: httpd/apreq/branches/v2_10/glue/perl/Makefile.PL
URL: 
http://svn.apache.org/viewvc/httpd/apreq/branches/v2_10/glue/perl/Makefile.PL?rev=688790&r1=688789&r2=688790&view=diff
==============================================================================
--- httpd/apreq/branches/v2_10/glue/perl/Makefile.PL (original)
+++ httpd/apreq/branches/v2_10/glue/perl/Makefile.PL Mon Aug 25 10:42:16 2008
@@ -37,6 +37,51 @@
     read $file, $_[0], -s $file;
 }
 
+sub cmp_tuples {
+    my ($num_a, $num_b) = @_;
+
+    while (@$num_a && @$num_b) {
+        my $cmp = shift @$num_a <=> shift @$num_b;
+        return $cmp if $cmp;
+    }  
+
+    return @$num_a <=> @$num_b;
+}
+
+sub autoconf_foo {
+    my ($config, $re_start, $re_end, $re_match) = @_;
+
+    $$config =~ /^${re_start}APACHE2_INCLUDES${re_end}($re_match)/m or
+        die "Can't find apache include directory";
+    my $apache_includes = $1;
+    $$config =~ /^${re_start}APR_INCLUDES${re_end}($re_match)/m or
+        die "Can't find apache include directory";
+    $apache_includes .= " $1";
+
+    my $apr_libs ="";
+
+    $$config =~ m/^${re_start}APREQ_LIBNAME${re_end}($re_match)/m or
+        die "Can't find apreq libname";
+
+    ## XXX: 2.60 bug/hack
+    my $apreq_libname = $1;
+
+    $$config =~ m/^${re_start}PACKAGE_VERSION${re_end}($re_match)/m or
+        die "Can't find package version";
+    my $version = $1;
+
+       ## Code around an autoconf 2.60 bug
+       ## http://lists.gnu.org/archive/html/bug-autoconf/2006-06/msg00127.html
+       ## $ grep @PACKAGE_VERSION config.status-2.59 config.status-2.60 
+       ## config.status-2.59:s,@PACKAGE_VERSION@,2.09,;t t
+       ## config.status-2.60:s,@PACKAGE_VERSION@,|#_!!_#|2.09,g
+       foreach ($apache_includes, $apreq_libname, $version) {
+           s/\|#_!!_#\|//g;
+       }
+
+    return ($apache_includes, $apr_libs, $apreq_libname, $version);
+}
+
 my ($apache_includes, $apache_dir, $apr_libs, $apreq_libname, $perl_lib);
 
 if (WIN32) {
@@ -63,43 +108,23 @@
 }
 else {
     slurp my $config => "$base_dir/config.status";
-    $config =~ /^s,[EMAIL PROTECTED]@,([^,]+)/m or
-    $config =~ /^S\["APACHE2_INCLUDES"\]="([^"]+)/m or
-        die "Can't find apache include directory";
-    $apache_includes = $1;
-    $config =~ /^s,[EMAIL PROTECTED]@,([^,]+)/m or
-    $config =~ /^S\["APR_INCLUDES"\]="([^"]+)/m or
-        die "Can't find apache include directory";
-    $apache_includes .= " $1";
-
-#    $config =~ m/^s,[EMAIL PROTECTED]@,([^,]+)/m or
-#        die "Can't find apr ldflags";
-#    $apr_libs = $1;
-
-#    $config =~ m/^s,[EMAIL PROTECTED]@,([^,]+)/m or
-#        die "Can't find apr libraries";
-#    $apr_libs .= " $1";
 
-    $apr_libs ="";
+    $config =~ /GNU Autoconf (\d+\.\d+)/;
+    my $autoconf_ver = $1;
 
-    $config =~ m/^s,[EMAIL PROTECTED]@,([^,]+)/m or
-    $config =~ m/^S\["APREQ_LIBNAME"\]="([^"]+)/m or
-        die "Can't find apreq libname";
-    $apreq_libname = $1;
-
-    $config =~ m/^s,[EMAIL PROTECTED]@,([^,]+)/m or
-    $config =~ m/^S\["PACKAGE_VERSION"\]="([^"]+)/m or
-        die "Can't find package version";
-    $version = $1;
+    ### XXX: Lord have mercy on us.....
+    if (cmp_tuples([split /\./, $autoconf_ver], [qw(2 61)]) > 0) {
+        ### Autoconf >=2.62 changed the format of the file
+        ### I.E.: S["APACHE2_INCLUDES"]="-I/usr/local/include/apache2"
+        ($apache_includes, $apr_libs, $apreq_libname, $version) = 
+           autoconf_foo(\$config, qr/S\[\"/, qr/\"\]=\"/, qr/[^\"]+/);
+    }
+    else {
+       ### I.E.: s,@APACHE2_INCLUDES@,-I/usr/local/include/apache22,;t t
+       ($apache_includes, $apr_libs, $apreq_libname, $version) = 
+          autoconf_foo(\$config, qr/s,\@/, qr/\@,/, qr/[^,]+/);
+    }
 
-               ## Code around an autoconf 2.60 bug
-               ## 
http://lists.gnu.org/archive/html/bug-autoconf/2006-06/msg00127.html
-               ## $ grep @PACKAGE_VERSION config.status-2.59 
config.status-2.60 
-               ## config.status-2.59:s,@PACKAGE_VERSION@,2.09,;t t
-               ## config.status-2.60:s,@PACKAGE_VERSION@,|#_!!_#|2.09,g
-               foreach ($apache_includes, $apreq_libname, $version) {
-                   s/\|#_!!_#\|//g;
-               }
 }
 
 my $apreq_libs = WIN32 ?


Reply via email to