The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
Changes 2540
MANIFEST 67
MANIFEST.SKIP 033
META.json 540
META.yml 821
Makefile.PL 21117
lib/Config/AutoConf.pm 22129
t/00.load.t 51
t/01.checkprog.t 726
t/02.compile.t 28
t/03.link.t 11
t/05.settings.t 032
t/pod-coverage.t 70
t/pod.t 70
t/testdata/foo.pc 011
15 files changed (This is a version diff) 116466
@@ -1,20 +1,35 @@
 Revision history for Config-AutoConf
 
-0.22   Dec 11, 2012
+0.25   2014-04-14
+		- Fix settings test that would complain with a duplicate plan
+		  when no PkgConfig was present.
+
+0.24   2014-04-11
+        - Fix lost dependencies during Makefile.PL update
+        - add even core dependencies to support older Perls
+        - adjust $LIBEXT/$EXEEXT initialization to support HP-UX/HPPA
+
+0.23   2014-04-10
+        - bring back to 5.6 (Peter 'Ribasushi' Rabbitson)
+        - introduce pkg-config based checks (Jens 'Sno' Rehsack)
+        - fix spurious invocation issues (Jens 'Sno' Rehsack)
+        - Changes reformatted as per CPAN::Changes::Spec
+
+0.22   2012-12-11
          - Flag some more tests as TODO.
 
-0.21   Dec 2, 2012
+0.21   2012-12-02
          - Flag -lm tests as 'TODO' as they might fail in some Windows
            machines
 
-0.20   Nov 9, 2012
+0.20   2012-11-09
          - Add stdint.h into check_default_headers
          - Make POD tests author only.
 
-0.19   Feb  7, 2012
+0.19   2012-02-07
          - Added new method, check_lm
 
-0.18   Feb  2, 2012
+0.18   2012-02-02
          - msg_methods msg prefix can be configured.
          - Added new methods: (Jens Rehsack)
            check_alignof_type, check_alignof_types, check_sizeof_type,
@@ -23,13 +38,13 @@ Revision history for Config-AutoConf
            push_libraries, push_library_paths, push_link_flags,
            push_preprocess_flags.
 
-0.17    Jan  4, 2012
+0.17    2012-01-04
         - Re-fixed tests that do not run in <= v5.010
 
-0.17_02 Jan  3, 2012
+0.17_02 2012-01-03
         - Fixed tests that do not run on older Perl version.
 
-0.17_01 Jan  2, 2012
+0.17_01 2012-01-02
         - New object oriented interface (Jens Rehsack)
         - Added new methods: (Jens Rehsack)
           cache_val, check_all_headers, check_cached, check_decl,
@@ -42,62 +57,62 @@ Revision history for Config-AutoConf
         - check_headers rewritten (Jens Rehsack)
         - Use proper 'extern "C"' code
 
-0.16    Sep 23, 2010
+0.16    2010-09-23
         - Config::AutoConf::Linker moved to ExtUtils::LibBuilder.
 
-0.15    Mar  8, 2010
+0.15    2010-05-08
         - Config::AutoConf::Linker more silent.
 
-0.14    Feb 14, 2010
+0.14    2010-02-14
         - Added rewind to Linker.pm module. This code is still under heavy tests.
 
-0.13    Jun  2, 2009
+0.13    2009-06-02
         - First stable release with code to detect how to build a C dynamic library.
 
-0.12_3  Jun  1, 2009
+0.12_3  2009-06-01
         - Trying other way arround to change LD_LIBRARY_PATH under
           t/04, that was failing under FreeBSD.
 
-0.12_2  May 19, 2009
+0.12_2  2009-05-19
 	- Added t/04 that was missing from MANIFEST
 
-0.12_1	May 18, 2009
+0.12_1	2009-05-18
 	- Added code to detect how to build a library. 
           It is a big, really big hack. Still not documented.
 
-0.11	January 9, 2009
+0.11	2009-01-09
 	- check_prog with better support for Windows machines.
 
-0.10    September 3, 2008
+0.10    2008-09-03
 	- Removed the tilde on my name, from Makefile.PL.
 	  Was generating some weird results on VMS and Solaris.
 
-0.09    April 23, 2008
+0.09    2008-04-23
 	- Added 'check_headers?' methods to check for C heading files;
 	- fixed the deletion of .c files created by failing tests;
 	- Require perl 5.8.1 and ExtUtils::CBuilder 0.23
 
-0.08    March 29, 2008
+0.08    2008-03-29
 	- require a 5.8 Perl 
 
-0.07	March 21, 2008
+0.07	2008-03-19
 	- re-factored some tests to make them Win-aware
 
-0.06	March 19, 2008
+0.06	2008-03-19
 	- added -quiet option to ExtUtils::CBuilder for less noise when 
 	  detecting things.
 
-0.05	March 18, 2008
+0.05	2008-03-18
 	- added 'check_prog_yacc' method to check for a yacc implementation
 	  (see POD)
 
-0.04	March 18, 2008
+0.04	2008-03-18
 	- adapt to new ExtUtils::CBuilder API
 
-0.03	August 12, 2005
+0.03	2005-08-12
 	- Added 'check_file' and 'check_files' methods (kind of stupid methods)
 
-0.02	February 14, 2005
+0.02	2005-02-14
 	- Moved from ExtUtils:: to Config::
 
 Previous releases
@@ -1,13 +1,14 @@
 Changes
-MANIFEST
-META.yml # Will be created by "make dist"
+lib/Config/AutoConf.pm
 Makefile.PL
+MANIFEST
+MANIFEST.SKIP
+META.json
+META.yml
 README
-lib/Config/AutoConf.pm
 t/00.load.t
-t/pod-coverage.t
-t/pod.t
 t/01.checkprog.t
 t/02.compile.t
 t/03.link.t
-META.json                                Module JSON meta-data (added by MakeMaker)
+t/05.settings.t
+t/testdata/foo.pc
@@ -0,0 +1,33 @@
+\B\.svn\b
+\B\.git\b
+\.gitignore$
+\.[Bb][Aa][Kk]$
+\.orig$
+\.old$
+\.tdy$
+\.tmp$
+\..*swp
+^Makefile$
+^Build$
+^Build\.bat$
+\.Inline/.*
+_Inline/.*
+\.bak$
+\.tar$
+\.tgz$
+\.tar\.gz$
+^mess/
+^tmp/
+^testdata/
+^blib/
+^sandbox/
+^pm_to_blib$
+^_build/.*
+~$
+.*\.planner
+^\..*
+Config-AutoConf-.*
+^applied_patches/
+\bxt
+^MYMETA\.json$
+^MYMETA\..*$
@@ -4,7 +4,7 @@
       "Alberto Simoes <ambs@cpan.org>"
    ],
    "dynamic_config" : 1,
-   "generated_by" : "ExtUtils::MakeMaker version 6.6302, CPAN::Meta::Converter version 2.120921",
+   "generated_by" : "ExtUtils::MakeMaker version 6.96, CPAN::Meta::Converter version 2.140640",
    "license" : [
       "perl_5"
    ],
@@ -21,23 +21,58 @@
    },
    "prereqs" : {
       "build" : {
+         "requires" : {}
+      },
+      "configure" : {
          "requires" : {
             "ExtUtils::MakeMaker" : "0"
          }
       },
-      "configure" : {
+      "develop" : {
          "requires" : {
-            "ExtUtils::MakeMaker" : "0"
+            "Test::CPAN::Changes" : "0",
+            "Test::CheckManifest" : "0",
+            "Test::Pod" : "0",
+            "Test::Pod::Coverage" : "0",
+            "Test::Pod::Spelling::CommonMistakes" : "0"
          }
       },
       "runtime" : {
+         "recommends" : {
+            "Scalar::Util" : "1.18"
+         },
          "requires" : {
             "Capture::Tiny" : "0",
+            "Carp" : "0",
+            "Config" : "0",
+            "Cwd" : "0",
             "ExtUtils::CBuilder" : "0.23",
-            "Test::More" : "0"
+            "File::Basename" : "0",
+            "File::Spec" : "0",
+            "File::Temp" : "0",
+            "Text::ParseWords" : "0"
+         }
+      },
+      "test" : {
+         "requires" : {
+            "Test::More" : "0.9"
          }
       }
    },
    "release_status" : "stable",
-   "version" : "0.22"
+   "resources" : {
+      "bugtracker" : {
+         "mailto" : "bug-config-autoconf@rt.cpan.org",
+         "web" : "http://rt.cpan.org/Public/Dist/Display.html?Name=Config-AutoConf"
+      },
+      "homepage" : "https://metacpan.org/release/Config-AutoConf",
+      "license" : [
+         "http://dev.perl.org/licenses/"
+      ],
+      "repository" : {
+         "type" : "git",
+         "web" : "https://github.com/ambs/Config-AutoConf"
+      }
+   },
+   "version" : "0.25"
 }
@@ -3,22 +3,35 @@ abstract: 'A module to implement some of AutoConf macros in pure perl.'
 author:
   - 'Alberto Simoes <ambs@cpan.org>'
 build_requires:
-  ExtUtils::MakeMaker: 0
+  Test::More: '0.9'
 configure_requires:
-  ExtUtils::MakeMaker: 0
+  ExtUtils::MakeMaker: '0'
 dynamic_config: 1
-generated_by: 'ExtUtils::MakeMaker version 6.6302, CPAN::Meta::Converter version 2.120921'
+generated_by: 'ExtUtils::MakeMaker version 6.96, CPAN::Meta::Converter version 2.140640'
 license: perl
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.4.html
-  version: 1.4
+  version: '1.4'
 name: Config-AutoConf
 no_index:
   directory:
     - t
     - inc
+recommends:
+  Scalar::Util: '1.18'
 requires:
-  Capture::Tiny: 0
-  ExtUtils::CBuilder: 0.23
-  Test::More: 0
-version: 0.22
+  Capture::Tiny: '0'
+  Carp: '0'
+  Config: '0'
+  Cwd: '0'
+  ExtUtils::CBuilder: '0.23'
+  File::Basename: '0'
+  File::Spec: '0'
+  File::Temp: '0'
+  Text::ParseWords: '0'
+resources:
+  bugtracker: http://rt.cpan.org/Public/Dist/Display.html?Name=Config-AutoConf
+  homepage: https://metacpan.org/release/Config-AutoConf
+  license: http://dev.perl.org/licenses/
+  repository: https://github.com/ambs/Config-AutoConf
+version: '0.25'
@@ -2,25 +2,121 @@ use strict;
 use warnings;
 use ExtUtils::MakeMaker;
 
-use 5.008002;
+my %RUN_DEPS = (
+    'Carp'               => 0,
+    'Capture::Tiny'      => 0,
+    'Config'             => 0,
+    'Cwd'                => 0,
+    'File::Basename'     => 0,
+    'File::Spec'         => 0,
+    'File::Temp'         => 0,
+    'ExtUtils::CBuilder' => '0.23',
+    'Text::ParseWords'   => 0,
+);
+my %CONFIGURE_DEPS = ('ExtUtils::MakeMaker' => 0);
+my %BUILD_DEPS = ();
 
-WriteMakefile(
-	      NAME          => 'Config::AutoConf',
-	      AUTHOR        => 'Alberto Simoes <ambs@cpan.org>',
-              LICENSE       => 'perl',
-	      VERSION_FROM  => 'lib/Config/AutoConf.pm',
-	      ABSTRACT_FROM => 'lib/Config/AutoConf.pm',
-	      PL_FILES      => {},
-	      PREREQ_PM     => {
-				'Capture::Tiny'      => 0,
-				'ExtUtils::CBuilder' => 0.23,
-				'Test::More'         => 0,
-			       },
-	      dist          => {
-				COMPRESS => 'gzip -9f',
-				SUFFIX   => 'gz'
-			       },
-	      clean         => {
-				FILES => 'Config-AutoConf-*'
-			       },
-	     );
+my %TEST_DEPS = ('Test::More' => 0.90);
+
+WriteMakefile1(
+    META_ADD         => {
+        'meta-spec' => { version => 2 },
+        resources   => {
+            homepage => 'https://metacpan.org/release/Config-AutoConf',
+            repository => {
+                url  => 'git@github.com:ambs/Config-AutoConf.git',
+                web  => 'https://github.com/ambs/Config-AutoConf',
+                type => 'git',
+            },
+            license    => 'http://dev.perl.org/licenses/',
+            bugtracker  => {
+                web    => 'http://rt.cpan.org/Public/Dist/Display.html?Name=Config-AutoConf',
+                mailto => 'bug-config-autoconf@rt.cpan.org',
+            },
+        },
+        prereqs => {
+            develop => {
+                requires => {
+                    'Test::CPAN::Changes'                 => 0,
+                    'Test::CheckManifest'                 => 0,
+                    'Test::Pod'                           => 0,
+                    'Test::Pod::Coverage'                 => 0,
+                    'Test::Pod::Spelling::CommonMistakes' => 0,
+                },
+            },
+            configure => {
+                requires => {%CONFIGURE_DEPS},
+            },
+            build   => { requires => {%BUILD_DEPS} },
+            test    => { requires => {%TEST_DEPS} },
+            runtime => {
+                requires => {
+                    %RUN_DEPS,
+                },
+		recommends => {
+		    'Scalar::Util' => '1.18',
+		},
+            },
+        },
+    },
+    NAME           => 'Config::AutoConf',
+    AUTHOR         => 'Alberto Simoes <ambs@cpan.org>',
+    VERSION_FROM   => 'lib/Config/AutoConf.pm',
+    ABSTRACT_FROM  => 'lib/Config/AutoConf.pm',
+    LICENSE        => 'perl',
+    PREREQ_PM      => \%RUN_DEPS,
+    BUILD_REQUIRES => \%BUILD_DEPS,
+    TEST_REQUIRES  => \%TEST_DEPS,
+    test           => { TESTS => 't/*.t xt/*.t' },
+);
+
+sub WriteMakefile1
+{    # originally written by Alexandr Ciornii, version 0.21. Added by eumm-upgrade.
+    my %params       = @_;
+    my $eumm_version = $ExtUtils::MakeMaker::VERSION;
+    $eumm_version = eval $eumm_version;
+    die "EXTRA_META is deprecated" if ( exists( $params{EXTRA_META} ) );
+    die "License not specified"    if ( !exists( $params{LICENSE} ) );
+    if ( $params{TEST_REQUIRES} and ( $eumm_version < 6.6303 ) )
+    {
+        if ( $params{BUILD_REQUIRES} )
+        {
+            $params{BUILD_REQUIRES} = { %{ $params{BUILD_REQUIRES} }, %{ delete $params{TEST_REQUIRES} } };
+        }
+        else
+        {
+            $params{BUILD_REQUIRES} = delete $params{TEST_REQUIRES};
+        }
+    }
+    if ( $params{BUILD_REQUIRES} and ( $eumm_version < 6.5503 ) )
+    {
+        #EUMM 6.5502 has problems with BUILD_REQUIRES
+        $params{PREREQ_PM} = { %{ $params{PREREQ_PM} || {} }, %{ $params{BUILD_REQUIRES} } };
+        delete $params{BUILD_REQUIRES};
+    }
+    delete $params{CONFIGURE_REQUIRES}    if ( $eumm_version < 6.52 );
+    delete $params{MIN_PERL_VERSION}      if ( $eumm_version < 6.48 );
+    delete $params{META_MERGE}            if ( $eumm_version < 6.46 );
+    delete $params{META_ADD}{prereqs}     if ( $eumm_version < 6.58 );
+    delete $params{META_ADD}{'meta-spec'} if ( $eumm_version < 6.58 );
+    delete $params{META_ADD}              if ( $eumm_version < 6.46 );
+    delete $params{LICENSE}               if ( $eumm_version < 6.31 );
+    delete $params{AUTHOR}                if ( $] < 5.005 );
+    delete $params{ABSTRACT_FROM}         if ( $] < 5.005 );
+    delete $params{BINARY_LOCATION}       if ( $] < 5.005 );
+
+    # more or less taken from Moose' Makefile.PL
+    if ( $params{CONFLICTS} )
+    {
+        my $ok = CheckConflicts(%params);
+        exit(0) if ( $params{PREREQ_FATAL} and not $ok );
+        my $cpan_smoker = grep { $_ =~ m/(?:CR_SMOKER|CPAN_REPORTER|AUTOMATED_TESTING)/ } keys %ENV;
+        unless ( $cpan_smoker || $ENV{PERL_MM_USE_DEFAULT} || $ENV{SQL_STATEMENT_WARN_UPDATE} )
+        {
+            sleep 4 unless ($ok);
+        }
+        delete $params{CONFLICTS};
+    }
+
+    WriteMakefile(%params);
+}
@@ -1,6 +1,6 @@
 package Config::AutoConf;
 use ExtUtils::CBuilder;
-use 5.008002;
+use 5.006;
 
 use Config;
 use Carp qw/croak/;
@@ -8,9 +8,28 @@ use Carp qw/croak/;
 use File::Temp qw/tempfile/;
 use File::Basename;
 use File::Spec;
+use Text::ParseWords qw//;
 
 use Capture::Tiny qw/capture/;
-use Scalar::Util qw/looks_like_number/; # in core since 5.7.3
+
+# in core since 5.7.3
+eval { use Scalar::Util qw/looks_like_number/; };
+__PACKAGE__->can("looks_like_number") or eval <<'EOP';
+# from PP part of Params::Util
+sub looks_like_number {
+    local $_ = shift;
+
+    # checks from perlfaq4
+    return 0 if !defined($_);
+    if (ref($_)) {
+	    return overload::Overloaded($_) ? defined(0 + $_) : 0;
+    }
+    return 1 if (/^[+-]?[0-9]+$/); # is a +/- integer
+    return 1 if (/^([+-]?)(?=[0-9]|\.[0-9])[0-9]*(\.[0-9]*)?([Ee]([+-]?[0-9]+))?$/); # a C float
+    return 1 if ($] >= 5.008 and /^(Inf(inity)?|NaN)$/i) or ($] >= 5.006001 and /^Inf$/i);
+
+    0;
+EOP
 
 use base 'Exporter';
 
@@ -19,9 +38,20 @@ our @EXPORT = ('$LIBEXT', '$EXEEXT');
 use warnings;
 use strict;
 
-# XXX detect HP-UX / HPPA
-our $LIBEXT = (defined $Config{dlext}) ? ("." . $Config{dlext}) : ($^O =~ /darwin/i)  ? ".dylib" : ( ($^O =~ /mswin32/i) ? ".dll" : ".so" );
-our $EXEEXT = ($^O =~ /mswin32/i) ? ".exe" : "";
+# PA-RISC1.1-thread-multi
+my %special_dlext = (
+  darwin => ".dylib",
+  MSWin32 => ".dll",
+  ($Config{archname} =~ m/PA-RISC/i ? ("hpux" => ".sl") : ()),
+);
+
+our ($LIBEXT, $EXEEXT);
+
+defined $LIBEXT
+  or $LIBEXT = defined $Config{so} ? "." . $Config{so} :
+               defined $special_dlext{$^O} ? $special_dlext{$^O} : ".so";
+defined $EXEEXT
+  or $EXEEXT = ($^O =~ /mswin32/i) ? ".exe" : "";
 
 =encoding UTF-8
 
@@ -31,7 +61,7 @@ Config::AutoConf - A module to implement some of AutoConf macros in pure perl.
 
 =cut
 
-our $VERSION = '0.22';
+our $VERSION = '0.25';
 
 =head1 ABSTRACT
 
@@ -127,7 +157,7 @@ sub check_files {
   my $self = shift;
 
   for (@_) {
-    return 0 unless check_file($self, $_)
+    return 0 unless $self->check_file($_)
   }
 
   return 1;
@@ -144,12 +174,12 @@ returns the full path for the executable;
 sub check_prog {
   my $self = shift;
   # sanitize ac_prog
-  my $ac_prog = _sanitize(shift());
+  my $ac_prog = _sanitize(shift @_);
   my $PATH = $ENV{PATH};
   my $p;
 
-	my $ext = "";
-	$ext = ".exe" if $^O =~ /mswin/i;
+  my $ext = "";
+  $ext = ".exe" if $^O =~ /mswin/i;
 	
   for $p (split /$Config{path_sep}/,$PATH) {
     my $cmd = File::Spec->catfile($p,$ac_prog.$ext);
@@ -169,7 +199,7 @@ sub check_progs {
   my $self = shift;
   my @progs = @_;
   for (@progs) {
-    my $ans = check_prog($self, $_);
+    my $ans = $self->check_prog($_);
     return $ans if $ans;
   }
   return undef;
@@ -188,10 +218,10 @@ Returns the full path, if found.
 =cut
 
 sub check_prog_yacc {
-	my $self = shift;
-	my $binary = check_progs(qw/$self bison byacc yacc/);
-	$binary .= " -y" if ($binary =~ /bison$/);
-	return $binary;
+  my $self = shift;
+  my $binary = $self->check_progs(qw/bison byacc yacc/);
+  $binary .= " -y" if ($binary =~ /bison$/);
+  return $binary;
 }
 
 =head2 check_prog_awk
@@ -209,7 +239,7 @@ Note that it returns the full path, if found.
 
 sub check_prog_awk {
   my $self = shift;
-  return check_progs(qw/$self gawk mawk nawk awk/);
+  return $self->check_progs(qw/gawk mawk nawk awk/);
 }
 
 
@@ -229,17 +259,30 @@ sub check_prog_egrep {
 
   my $grep;
 
-  if ($grep = check_prog($self,"grep")) {
+  if ($grep = $self->check_prog("grep")) {
     my $ans = `echo a | ($grep -E '(a|b)') 2>/dev/null`;
     return "$grep -E" if $ans eq "a\n";
   }
 
-  if ($grep = check_prog($self, "egrep")) {
+  if ($grep = $self->check_prog("egrep")) {
     return $grep;
   }
   return undef;
 }
 
+=head2 check_prog_pkg_config
+
+Checks for C<pkg-config> program. No additional tests are made for it ...
+
+=cut
+ 
+sub check_prog_pkg_config {
+  my $self = shift->_get_instance();
+  my $cache_name = $self->_cache_name("prog", "pkg-config");
+  return $self->check_cached( $cache_name, "for pkg-config",
+    sub {$self->check_prog("pkg-config")} );
+}
+
 =head2 check_cc
 
 This function checks if you have a running C compiler.
@@ -1383,7 +1426,7 @@ sub check_headers {
   my $self = shift;
 
   for (@_) {
-    return $_ if check_header($self, $_)
+    return $_ if $self->check_header($_)
   }
 
   return undef;
@@ -1747,6 +1790,73 @@ sub search_libs {
   return $self->check_cached( $cache_name, "for library containing $func", $check_sub );
 }
 
+=head2 pkg_config_package_flags($package, [action-if-found], [action-if-not-found])
+
+Search for pkg-config flags for package as specified. The flags which are
+extracted are C<--cflags> and C<--libs>. The extracted flags are appended
+to the global C<extra_compile_flags> and C<extra_link_flags>, respectively.
+
+Call it with the package you're looking for and optional callback whether
+found or not.
+
+=cut
+
+my $_pkg_config_prog;
+
+sub _pkg_config_flag
+{
+    defined $_pkg_config_prog or croak("pkg_config_prog required");
+    my @pkg_config_args = @_;
+    my ( $stdout, $stderr, $exit ) =
+      capture { system( $_pkg_config_prog, @pkg_config_args ); };
+    chomp $stdout;
+    0 == $exit and return $stdout;
+    return;
+}
+
+sub pkg_config_package_flags
+{
+    my ( $self, $package, $action_if_found, $action_if_not_found ) = @_;
+    $self = $self->_get_instance();
+    (my $pkgpfx = $package) =~ s/^(\w+).*?$/$1/;
+    my $cache_name = $self->_cache_name( "pkg", $pkgpfx );
+    defined $_pkg_config_prog or $_pkg_config_prog = $self->check_prog_pkg_config;
+    my $check_sub = sub {
+	my ( @pkg_cflags, @pkg_libs );
+
+        (my $ENV_CFLAGS = $package) =~ s/^(\w+).*?$/$1_CFLAGS/;
+	my $CFLAGS = defined $ENV{$ENV_CFLAGS} ? $ENV{$ENV_CFLAGS}
+	                                       : _pkg_config_flag($package, "--cflags");
+        $CFLAGS and @pkg_cflags = (
+            map {
+                $_ =~ s/^\s+//;
+                $_ =~ s/\s+$//;
+                Text::ParseWords::shellwords $_;
+              } split( m/\n/, $CFLAGS )
+          )
+	  and push @{ $self->{extra_preprocess_flags} }, @pkg_cflags;
+	  # and push @{ $self->{extra_compile_flags}->{"C"} }, @pkg_cflags;
+# XXX extra_preprocess_flags
+
+        (my $ENV_LIBS = $package) =~ s/^(\w+).*?$/$1_LIBS/;
+        # do not separate between libs and extra (for now) - they come with -l prepended
+	my $LIBS = defined $ENV{$ENV_LIBS} ? $ENV{$ENV_LIBS}
+	                                   : _pkg_config_flag($package, "--libs");
+        $LIBS and @pkg_libs = (
+            map {
+                $_ =~ s/^\s+//;
+                $_ =~ s/\s+$//;
+                Text::ParseWords::shellwords $_;
+              } split( m/\n/, $LIBS )
+          )
+	  and push @{ $self->{extra_link_flags} }, @pkg_libs;
+
+	return join(" ", @pkg_cflags, @pkg_libs);
+    };
+
+    return $self->check_cached( $cache_name, "for pkg-config package of $package", $check_sub );
+}
+
 #
 #
 # Auxiliary funcs
@@ -1935,9 +2045,6 @@ sub _cache_name {
   my ($self, @names) = @_;
   my $cache_name = join( "_", $self->_cache_prefix(), "cv", @names );
      $cache_name =~ tr/_A-Za-z0-9/_/c;
-  if( $cache_name eq "ac_cv_0_0" ) {
-    Test::More::diag( "break here" );
-  }
   return $cache_name;
 }
 
@@ -3,9 +3,5 @@
 use Test::More tests => 1;
 
 BEGIN {
-  use_ok( 'Config::AutoConf' );
+  use_ok( 'Config::AutoConf' ) or BAIL_OUT("Can't load Config::AutoConf");
 }
-
-
-
-
@@ -1,6 +1,9 @@
 # -*- cperl -*-
 
-use Test::More tests => 6;
+use strict;
+use warnings;
+
+use Test::More tests => 8;
 use Config;
 use Config::AutoConf;
 
@@ -14,16 +17,32 @@ like(Config::AutoConf->check_progs("___perl___", "__perl__", "_perl_", "perl"),
 is(Config::AutoConf->check_progs("___perl___", "__perl__", "_perl_"), undef);	
 
 SKIP: {
-  my $awk;
-  skip "Not sure about your awk", 1 if $^O =~ m!MSWin32! || !$Config{awk};
-  ok(($awk = Config::AutoConf->check_prog_awk));
+  my $awk = Config::AutoConf->check_prog_awk;
+  $awk or skip "No awk", 1;
+  my $awk_bin = ( map { $_ =~ s/^\s+//; $_ =~ s/\s+$//; $_ } Text::ParseWords::shellwords $awk )[0];
+  ok(-x $awk_bin, "$awk is executable");
   diag("Found AWK as $awk");
 };
 
 SKIP: {
-  my $grep;
-  skip "Not sure about your grep", 1 if $^O =~ m!MSWin32! || !$Config{egrep};
-  ok(($grep = Config::AutoConf->check_prog_egrep));
+  my $grep = Config::AutoConf->check_prog_egrep;
+  $grep or skip "No egrep", 1;
+  my $grep_bin = ( map { $_ =~ s/^\s+//; $_ =~ s/\s+$//; $_ } Text::ParseWords::shellwords $grep )[0];
+  ok(-x $grep_bin, "$grep is executable");
   diag("Found EGREP as $grep");
 };
 
+SKIP: {
+  my $yacc = Config::AutoConf->check_prog_yacc;
+  $yacc or skip "No yacc", 1;
+  my $yacc_bin = ( map { $_ =~ s/^\s+//; $_ =~ s/\s+$//; $_ } Text::ParseWords::shellwords $yacc )[0];
+  ok(-x $yacc_bin, "$yacc is executable");
+  diag("Found YACC as $yacc");
+};
+
+SKIP: {
+  my $pkg_config = Config::AutoConf->check_prog_pkg_config;
+  $pkg_config or skip "No pkg-config", 1;
+  ok(-x $pkg_config, "$pkg_config is executable");
+  diag("Found PKG-CONFIG as $pkg_config");
+};
@@ -10,7 +10,7 @@ END {
   -e "config.h" and unlink "config.h";
 }
 
-diag("\n\nIgnore junk bellow.\n\n");
+diag("\n\nIgnore junk below.\n\n");
 
 ## OK, we really hope people have sdtio.h around
 ok(Config::AutoConf->check_header("stdio.h"));
@@ -94,7 +94,13 @@ open( $fh, "<", "config.h" );
 { local $/; $fbuf = <$fh>; }
 close( $fh );
 
-open( $fh, "+>", \$dbuf );
+if ($] < 5.008) {
+  require IO::String;
+  $fh = IO::String->new($dbuf);
+}
+else {
+  open( $fh, "+>", \$dbuf );
+}
 $ac->write_config_h( $fh );
 close( $fh );
 
@@ -6,7 +6,7 @@ use Config::AutoConf;
 
 END { -e "config.log" and unlink "config.log"; }
 
-diag("\n\nIgnore junk bellow.\n\n");
+diag("\n\nIgnore junk below.\n\n");
 
 my ($ac_1, $ac_2);
 
@@ -0,0 +1,32 @@
+# -*- cperl -*-
+
+use Test::More;
+
+use Config::AutoConf;
+
+use Cwd qw(abs_path);
+use File::Basename qw(dirname);
+use File::Spec;
+
+END { -e "config.log" and unlink "config.log"; }
+
+diag("\n\nIgnore junk below.\n\n");
+
+my $pkg_config = Config::AutoConf->check_prog_pkg_config;
+
+plan $pkg_config ? (tests => 3) : (plan skip_all => "No pkg-config");
+
+SCOPE: {
+  local $ENV{PKG_CONFIG_PATH} = File::Spec->catdir( dirname(abs_path($0)), "testdata" );
+  my $foo_flags = Config::AutoConf->pkg_config_package_flags("foo");
+  is($foo_flags, "-I/base/path/include/foo-0 -L/base/path/lib/foo -lfoo");
+}
+
+SCOPE: {
+  local $ENV{bar_CFLAGS} = "-Ibar";
+  local $ENV{bar_LIBS} = "-lbar";
+  my $bar_flags = Config::AutoConf->pkg_config_package_flags("bar>2");
+  is($bar_flags, "-Ibar -lbar");
+  my $cache_name = Config::AutoConf->_get_instance()->_cache_name(qw/pkg bar/);
+  ok(Config::AutoConf->_get_instance()->{cache}->{$cache_name});
+}
@@ -1,7 +0,0 @@
-#!perl -T
-
-use Test::More;
-eval "use Test::Pod::Coverage 1.04";
-plan skip_all => "Test::Pod::Coverage 1.04 required for testing POD coverage" if $@;
-plan skip_all => "Set AUTHOR_TESTS for author tests." unless $ENV{AUTHOR_TESTS};
-all_pod_coverage_ok();
@@ -1,7 +0,0 @@
-#!perl -T
-
-use Test::More;
-eval "use Test::Pod 1.14";
-plan skip_all => "Test::Pod 1.14 required for testing POD" if $@;
-plan skip_all => "Set AUTHOR_TESTS for author tests." unless $ENV{AUTHOR_TESTS};
-all_pod_files_ok();
@@ -0,0 +1,11 @@
+# $Id$
+prefix=/base/path
+exec_prefix=/base/path
+libdir=${exec_prefix}/lib/foo
+includedir=${prefix}/include/foo-0
+
+Name: foo
+Description: Provides some testable flags for Config::AutoConf
+Version: 0.23
+Libs: -L${libdir} -lfoo
+Cflags: -I${includedir}