From: Tim Jenness <tjenness@cpan.org>
Date: Sat, 15 Sep 2001 13:41:28 +0000 (-1000)
Subject: h2xs.PL with C::Scan
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=869be49753bc37797fb9d87cc1db266b0703c28f;p=p5sagit%2Fp5-mst-13.2.git

h2xs.PL with C::Scan
Message-ID: <Pine.LNX.4.33.0109151338560.3075-100000@lapaki>

p4raw-id: //depot/perl@12033
---

diff --git a/utils/h2xs.PL b/utils/h2xs.PL
index 0a065ec..4e5319b 100644
--- a/utils/h2xs.PL
+++ b/utils/h2xs.PL
@@ -740,7 +740,8 @@ if( @path_h ){
     }
 }
 
-
+# Save current directory so that C::Scan can use it
+my $cwd = File::Spec->rel2abs( File::Spec->curdir );
 
 my ($ext, $nested, @modparts, $modfname, $modpname);
 
@@ -811,7 +812,7 @@ if( ! $opt_X ){  # use XS, unless it was disabled
       my @styles = $Config{gccversion} ? qw(C++ C9X GNU) : qw(C++ C9X);
       $c = new C::Scan 'filename' => $filename, 'filename_filter' => $filter,
 	'add_cppflags' => $addflags, 'c_styles' => \@styles;
-      $c->set('includeDirs' => ["$Config::Config{archlib}/CORE"]);
+      $c->set('includeDirs' => ["$Config::Config{archlib}/CORE", $cwd]);
 
       push @$fdecls_parsed, @{ $c->get('parsed_fdecls') };
       push(@$fdecls, @{$c->get('fdecls')});
@@ -870,7 +871,8 @@ if( ! $opt_X ){  # use XS, unless it was disabled
     }
     @fnames_no_prefix = @fnames;
     @fnames_no_prefix
-      = sort map { ++$prefix{$_} if s/^$opt_p(?!\d)//; $_ } @fnames_no_prefix;
+      = sort map { ++$prefix{$_} if s/^$opt_p(?!\d)//; $_ } @fnames_no_prefix
+         if defined $opt_p;
     # Remove macros which expand to typedefs
     print "Typedefs are @td.\n" if $opt_d;
     my %td = map {($_, $_)} @td;